fair-python-cookiecutter

An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata.

https://github.com/materials-data-science-and-informatics/fair-python-cookiecutter

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.4%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata.

Basic Info
  • Host: GitHub
  • Owner: Materials-Data-Science-and-Informatics
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 2.37 MB
Statistics
  • Stars: 28
  • Watchers: 4
  • Forks: 6
  • Open Issues: 7
  • Releases: 6
Created almost 3 years ago · Last pushed 12 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Authors Codemeta

README.md

Docs CI


FAIR Python Cookiecutter Logo   

fair-python-cookiecutter

An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata.

FAIR Software Mindmap

Check out the demo repository generated from this template!

Overview

Are you a researcher or research software engineer?

Did you somehow end up developing Python tools and libraries as part of your job?

Are you overwhelmed and confused by the increasing demands to research software?

Regardless whether you are just planning to start a new software project, or you just look for ideas about how you could improve its quality - this template is for you!

Unlike myriads of other templates, this template targets the typical case in academia - you built some nice little tool or library for your scientific community, and hope that others have a good experience - you want to provide a quality product that others enjoy using. In case they actually do use it with some success, you might also like to be acknowledged - for example, by having your tool cited.

To ensure quality, there are many best practices and recommendations for software development on various levels, both general as well as Python-specific. To help others find your project and also enable them to cite it, there are also recommendations concerning your software project metadata. In fact, there are so many recommendations that it can be hard to keep up and easy to become overwhelmed and confused.

To save you some time navigating all of that advice and figuring out how to apply it in practice, we did the work for you and provide you with this template! You can use it as is, adapt it, or at least get some inspiration for your projects.

Main Features

This template sets up a skeleton for a Python project that:

  • uses modern state-of-the-art development tools
  • provides a baseline for professional development and maintenance
  • helps following best practices for code and metadata quality
  • contains detailed documentation on how to work with it

It is built to help you adopting good practices and follow recommendations such as:

Furthermore, it implements emerging standards with the goal to improve software metadata and make it more FAIR:

Also see this paper for an overview and recommendations on the state of software citation in academic practice.

Getting Started

Make sure that you have a working Python interpreter in version at least 3.9, git and poetry installed.

To install the template, run pip install fair-python-cookiecutter.

Now you can use the tool to generate a new Python project:

bash fair-python-cookiecutter YourProjectName

This will spawn an interactive prompt, where you have to provide some information and make some choices for your new software project. Don't worry, you can always adapt everything later on by hand. After this, your software project will be created in a new directory.

To save you some time answering the questions, we recommend that you create an empty repository in GitHub or GitLab of your choice (i.e., the location where you plan to push your new project).

If you already have created an empty remote repository or know exactly its future location, you can provide the URL, which already will provide many required inputs:

bash fair-python-cookiecutter --repo-url https://github.com/YourOrganization/YourProjectName

Your new project repository will also include a copy of a developer guide, containing more information about the structure and features of the generated project.

Please familiarize yourself with the generated structures, files and the contents of the developer guide. Feel free to either remove the guide afterwards, or keep (and possibly adjust) it as extended technical project documentation for yourself and other future project contributors.

You can find a demo repository generated from this template here.

Example Code

When you are creating your project, you are asked for several inputs. You can have an example CLI(Command Line Interface) and/or API(Application Programming interface) code within your new project.

Lets assume your project name is my-awesome-project.

You can run the CLI App with below command. For further usage, please check typer documentation.

```bash poetry shell

Run your CLI App

my-awesome-project-cli calculate add 5 2 ```

You can run the API App with below command.

```bash poetry shell

Run the API program, it will be open for connection

my-awesome-project-api ```

Now, you can a tool to send a HTTP request for the API. You can open another terminal and run this command

```

send a request that does the same thing as the CLI

curl 'http://localhost:8000/calculate/add?x=5&y=2' ```

For further usage of the API, please check fastAPI documentation.

Configuring the Template

If you intend to use the template a lot, e.g. if you want to use (an adaptation of) this template as the default way to start a Python project for yourself and/or others, you might want to configure some template variables in your ~/.cookiecutterrc. Here is an example cookiecutter configuration:

yaml fair_python_cookiecutter: last_name: 'Carberry' first_name: 'Josiah' project_keywords: 'psychoceramics analytics' email: 'josiah.carberry@brown.edu' orcid: '0000-0002-1825-0097' affiliation: 'Brown University' copyright_holder: 'Brown University' license: 'MIT'

This information will be already pre-filled when you use the template, saving you some time and possibly avoiding possible mistakes from manual typing.

Modifying the Template

If you want to adjust it to your needs and likings (e.g. add, remove or substitute certain tools), you probably want to fork it to get your own copy. Then you can do the desired changes and use the URL of your template repository instead of this one to kickstart your projects.

However, if you think that your changes are of general interest and would improve this template for a majority of users, please get in touch and contribute or suggest an improvement!

In any case we are very happy to know about any similar or derivative templates, e.g. for more specific use-cases or based on other tool preferences.

Reusing Parts of the Template

If you already have an existing project where you would like to introduce things you like from this template, there are two main ways to do so:

  1. move your code into a fresh repository based on this template
  2. use parts of the template in your existing project structure

If your project currently has no sophisticated setup of tools or strong preferences about them, option 1 might be the simplest way to adopt the template. Your code then needs to be moved into the YOUR_PROJECT/src/YOUR_PACKAGE subdirectory.

On the other hand, if you already have a working setup that you do not wish to replace completely, you can take a look at

  • the .pre-commit-config.yaml file to adopt some of the quality assurance tools listed there
  • the CI pipelines defined in .github/workflows or .gitlab-ci.yml for automated tests and releases
  • the mkdocs.yml and docs/ subdirectory to see how the project website works

How to Cite

If you want to cite this project in your scientific work, please use the citation file in the repository.

Acknowledgements

We kindly thank all authors and contributors.

HMC Logo    FZJ Logo


This project was developed at the Institute for Materials Data Science and Informatics (IAS-9) of the Jülich Research Center and funded by the Helmholtz Metadata Collaboration (HMC), an incubator-platform of the Helmholtz Association within the framework of the Information and Data Science strategic initiative.

Owner

  • Name: Materials Data Science and Informatics
  • Login: Materials-Data-Science-and-Informatics
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
type: software
message: If you use this software, please cite it using this metadata.

title: "fair-python-cookiecutter"
version: "1.0.0"
abstract: "An opinionated cookiecutter template to kickstart a modern best-practice
  Python project with FAIR metadata."
repository-code: "https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter"
license: "MIT"
keywords:
- fair
- metadata
- python
- cookiecutter
- template
authors:
- family-names: Pirogov
  given-names: Anton
  email: a.pirogov@fz-juelich.de
  orcid: https://orcid.org/0000-0002-5077-7497
  affiliation: Forschungszentrum Jülich GmbH - Institute for Materials Data Science
    and Informatics (IAS9)
- email: m.soylu@fz-juelich.de
  family-names: Soylu
  given-names: Mustafa
  orcid: https://orcid.org/0000-0003-2637-0432
contact:
- given-names: Mustafa
  orcid: https://orcid.org/0000-0003-2637-0432
  email: m.soylu@fz-juelich.de
  family-names: Soylu
url: 
  https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter

CodeMeta (codemeta.json)

{
  "@context": [
    "https://doi.org/10.5063/schema/codemeta-2.0",
    "https://w3id.org/software-iodata",
    "https://raw.githubusercontent.com/jantman/repostatus.org/master/badges/latest/ontology.jsonld",
    "https://schema.org",
    "https://w3id.org/software-types"
  ],
  "@type": "SoftwareSourceCode",
  "author": [
    {
      "@type": "Person",
      "givenName": "Anton",
      "familyName": "Pirogov",
      "email": "a.pirogov@fz-juelich.de",
      "@id": "https://orcid.org/0000-0002-5077-7497",
      "identifier": "https://orcid.org/0000-0002-5077-7497"
    },
    {
      "@type": "Person",
      "givenName": "Mustafa",
      "familyName": "Soylu",
      "email": "m.soylu@fz-juelich.de",
      "@id": "https://orcid.org/0000-0003-2637-0432",
      "identifier": "https://orcid.org/0000-0003-2637-0432"
    }
  ],
  "name": "fair-python-cookiecutter",
  "description": "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata.",
  "version": "1.0.0",
  "keywords": [
    "fair",
    "metadata",
    "python",
    "cookiecutter",
    "template"
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Mustafa",
      "familyName": "Soylu",
      "email": "m.soylu@fz-juelich.de",
      "@id": "https://orcid.org/0000-0003-2637-0432",
      "identifier": "https://orcid.org/0000-0003-2637-0432"
    }
  ],
  "license": [
    "https://spdx.org/licenses/MIT"
  ],
  "softwareHelp": "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter",
  "codeRepository": "https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter",
  "buildInstructions": "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter",
  "url": "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter"
}

GitHub Events

Total
  • Create event: 4
  • Release event: 1
  • Issues event: 2
  • Watch event: 3
  • Delete event: 3
  • Push event: 7
  • Pull request event: 4
  • Fork event: 1
Last Year
  • Create event: 4
  • Release event: 1
  • Issues event: 2
  • Watch event: 3
  • Delete event: 3
  • Push event: 7
  • Pull request event: 4
  • Fork event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 44
  • Total pull requests: 12
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 7 days
  • Total issue authors: 6
  • Total pull request authors: 3
  • Average comments per issue: 0.95
  • Average comments per pull request: 0.08
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 8
  • Pull requests: 9
  • Average time to close issues: 2 days
  • Average time to close pull requests: 2 days
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • apirogov (16)
  • cfgmr (2)
  • daniel-mohr (2)
  • hofmannv (1)
  • broeder-j (1)
  • priya-gitTest (1)
Pull Request Authors
  • mustafasoylu (12)
  • apirogov (1)
  • broeder-j (1)
Top Labels
Issue Labels
enhancement (16) bug (4) idea (3)
Pull Request Labels
bug (2) documentation (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 18 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 3
pypi.org: fair-python-cookiecutter

An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata.

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 18 Last month
Rankings
Dependent packages count: 10.0%
Average: 38.0%
Dependent repos count: 66.0%
Maintainers (3)
Last synced: 6 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/deploy_demo.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • webfactory/ssh-agent v0.7.0 composite
.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pypa/gh-action-pypi-publish release/v1 composite
  • softprops/action-gh-release v1 composite
poetry.lock pypi
  • anybadge 1.14.0
  • arrow 1.3.0
  • attrs 23.1.0
  • babel 2.13.1
  • binaryornot 0.4.4
  • black 23.11.0
  • certifi 2023.7.22
  • cfgv 3.4.0
  • chardet 5.2.0
  • charset-normalizer 3.3.2
  • click 8.1.7
  • colorama 0.4.6
  • cookiecutter 2.4.0
  • distlib 0.3.7
  • exceptiongroup 1.1.3
  • filelock 3.13.1
  • ghp-import 2.1.0
  • griffe 0.38.0
  • identify 2.5.31
  • idna 3.4
  • importlib-metadata 6.8.0
  • importlib-resources 6.1.1
  • iniconfig 2.0.0
  • interrogate 1.5.0
  • jinja2 3.1.2
  • markdown 3.5.1
  • markdown-exec 1.7.0
  • markdown-include 0.8.1
  • markdown-it-py 3.0.0
  • markupsafe 2.1.3
  • mdurl 0.1.2
  • mergedeep 1.3.4
  • mike 2.0.0
  • mkdocs 1.5.3
  • mkdocs-autorefs 0.5.0
  • mkdocs-coverage 1.0.0
  • mkdocs-gen-files 0.5.0
  • mkdocs-literate-nav 0.6.1
  • mkdocs-macros-plugin 0.7.0
  • mkdocs-material 9.4.8
  • mkdocs-material-extensions 1.3
  • mkdocs-section-index 0.3.8
  • mkdocstrings 0.24.0
  • mkdocstrings-python 1.7.4
  • mypy-extensions 1.0.0
  • nodeenv 1.8.0
  • packaging 23.2
  • paginate 0.5.6
  • pastel 0.2.1
  • pathspec 0.11.2
  • platformdirs 3.11.0
  • pluggy 1.3.0
  • poethepoet 0.18.1
  • pre-commit 3.5.0
  • py 1.11.0
  • pygments 2.16.1
  • pygments-ansi-color 0.3.0
  • pymdown-extensions 10.4
  • pyparsing 3.1.1
  • pytest 7.4.3
  • python-dateutil 2.8.2
  • python-slugify 8.0.1
  • pytz 2023.3.post1
  • pyyaml 6.0.1
  • pyyaml-env-tag 0.1
  • regex 2023.10.3
  • requests 2.31.0
  • rich 13.7.0
  • setuptools 68.2.2
  • six 1.16.0
  • tabulate 0.9.0
  • termcolor 2.3.0
  • text-unidecode 1.3
  • toml 0.10.2
  • tomli 2.0.1
  • types-python-dateutil 2.8.19.14
  • typing-extensions 4.8.0
  • urllib3 2.1.0
  • verspec 0.1.0
  • virtualenv 20.24.6
  • watchdog 3.0.0
  • zipp 3.17.0
pyproject.toml pypi
  • cookiecutter ^2.1.1
  • python ^3.8
{{ cookiecutter.__project_slug }}/pyproject.toml pypi