Code Monkey home page Code Monkey logo

scicookie's Introduction

SciCookie

CI Python Versions Package Version License Discord

SciCookie is a template developed by Open Science Labs that creates projects from project templates and is based on Cookiecutter. It serves as an initial structure which can be used by beginners as well as full-fledged developers to simplify the project creation process and save considerable amount of time. SciCookie enables projects with an initial layout that includes recommended tools, workflows, and project structure.

SciCookie also offers other features that can enhance the workflow of the development process. Features such as automatic documentation generation, automated testing, and project-specific configuration are part of this. Overall, SciCookie is an efficient tool that gives users the ability to effortlessly create consistent, high-quality projects.

SciCookie is primarily based on the PyOpenSci recommendations who is actively conducting research to determine the tools, libraries, best practices, and workflows utilized by significant scientific Python groups. As a result, this template offers to authors a starting point for their project that adheres with industry standards and can be adjusted to meet particular project requirements.

Features

  • Allows package slug (use _ instead of -)
  • Licenses supported: MIT, BSD 3 Clause, ISC License, Apache Software License 2.0, and GPL 3
  • Documentation engines: mkdocs, sphinx-rst, sphinx-myst, jupyter-boook, quarto
  • Test library: pytest, hypothesis
  • Auto format code tool: black
  • Initial integration with git
  • Support to conda (as base environment) and poetry as packaging and dependency management
  • Support to pre-commit
  • CI with github actions
  • Release workflow with semantic release and github actions
  • Flexible build system selection: Choose between popular build systems like Poetry, Flit, meson-python, Setuptools, PDM, Hatch, Maturin, scikit-build-core or setuptools + pybind11 based on your preference.
  • The structure of the project can use the src layout or flat layout. The “src layout” moving the code that is intended to be importable into a subdirectory. This subdirectory is typically named src. "Flat layout" refers to organising a project's files in a folder or repository so that the various configuration files and import packages are all in the top-level directory. You can read about their differences at https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/
  • Finding common security problems in Python code using bandit
  • Offers the option to use pydocstyle for checking compliance with Python documentation conventions.
  • Finds unused code in Python programs using vulture.
  • To automatically detect overly complex code based on cyclomatic complexity, the template gives you the option to use the McCabe library, which is included via flake8.
  • Provides the option to add initial files that allow you to run and orchestrate containers using Docker or Podman in your project.

Quickstart

pip install scicookie

Go to a desired folder to create your new project, for example:

cd ~/dev/my-python-projects

Generate a Python package project:

scicookie

You can also select a specific profile, for example:

scicookie --profile osl

You can also use it with pipx:

pipx run scicookie --profile osl

Development

For testing your changes locally, you can run:

makim tests.lint
makim tests.unittest
makim tests.smoke

Maintainers

Acknowledges

Python Software Foundation (PSF)

Open Science Labs has been awarded two grants from the Python Software Foundation (PSF) in April 2023 and January 2024 to enhance SciCookie. The grants were and will be used to implement best practices recommended by pyOpenSci, improve dependencies and configuration settings, and add new features.

We are grateful for the support of the Python Software Foundation. For further details about these grants, you can read more in the blog posts:

scicookie's People

Contributors

anavelyz avatar audreyfeldroy avatar ayeankit avatar breezko avatar cerickson avatar dependabot[bot] avatar eliasdorneles avatar erwinjanssen avatar hugovk avatar jhonjairoroa87 avatar katialira avatar luabida avatar mandeep avatar naman-priyadarshi avatar palmerev avatar psiace avatar purplediane avatar pydanny avatar pyup-bot avatar rwanyoike avatar saransh-cpp avatar satarupa22-sd avatar semantic-release-bot avatar skarbot avatar thejonanshow avatar tony avatar treyhunner avatar westurner avatar xmnlab avatar yurelycamacho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scicookie's Issues

Add `__main__` file

Add __main__ file to the template:

"""
Entrypoint module, in case you use `python -m{{cookiecutter.package_name}}`.
Why does this file exist, and why __main__? For more info, read:
- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/2/using/cmdline.html#cmdoption-m
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""
{%- if cookiecutter.command_line_interface == 'plain' %}
import sys
{% endif %}
from {{cookiecutter.package_name}}.cli import main

if __name__ == "__main__":
{%- if cookiecutter.command_line_interface == 'plain' %}
    sys.exit(main())
{%- else %}
    main()
{%- endif %}

PS: thanks to @jloehel for all this input

Improve semantic release github action workflow

in the semantic release github action workflow, allow it for push and for pull_request, exemplo:

on:
  workflow_dispatch:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

The current step for semantic release command should be executed just for workflow dispatch:

if: ${{ github.event_name == 'workflow_dispatch' }}

Additionally, before this step, we should add a copy of the semantic release step, but just for non workflow dispatch event:

if: ${{ github.event_name != 'workflow_dispatch' }}

this step should run for --dry instead of --ci

Research Governance standards

Add an option for governance document, called governance_document_based_on, with the following options:

  • NumPy governance document
  • SciML governance document
  • None

Better issue templates

Description

Currently, cookiecutter-python only has a bug report template, which is also the default template. The templates can be updated to include feature requests, documentation issues, and so on. Additionally, we can switch to form-based issues (YAML-based issue templates) for more user-friendliness.

For reference, I really like pyhf's issue templates - https://github.com/scikit-hep/pyhf/tree/main/.github/ISSUE_TEMPLATE

Improve the git workflow for the template

Currently, if there is already any commit on the origin/upstream main branch .. the branch created by the cookiecutter will have conflicts when we want to open a PR.

Additionally maybe it is too verbose to add the info for upstream and origin https urls
we probably should use a different approach

Add options for auto-format tool

currently, we are using black as a auto-format tool.
it would be good to have another option for that: blue

so we could have a variable called auto_format_tool and have 2 options (for now): black and blue

Migrate from `flake8` and `isort` to `ruff`

Description

ruff is extremely fast and is now being adopted widely by scientific packages. With the migration, we will be able to get rid of isort and flake8-pyproject from pre-commit-config.yaml.

Additionally, ruff can also automatically fix the captured errors, which can be an advantage when using pre-commit.ci (see #62 (comment)).

Add semantic release to cookiecutter-python

Add an option for code of conduct to the template

Add an option for code of conduct to the template.
This option should allow 3 answers:

  1. None
  2. Contributor Covenant (Recommended for projects of all sizes)
  3. Citizen Code Of Conduct (Suitable for large communities and events)

Improve tests

Improve tests on CI:

  • test all options when creating a NEW project from template
  • test semantic release for the NEW project from template
  • test semantic release for cookiecutter-python

Add pdm as build-system/dependency manager

Description

Currently, we just use poetry as build-system and dependency manager, we need to have an option on our template ir order to allow poetry (the default) and pdm.

Details

Basically, we need to add a new option to our template, called build-system with 2 options "poetry" and "pdm", the default is the first one (poetry).

for poetry we can use the current configuration.
for pdm it should not use any configuration from poetry and should add the specific configurations for pdm in the pyproject.toml and also add the correspondent dependencies on the conda env file.

NOTE: no changes is necessary in the root of the project (it should keep using poetry), the changes about poetry and pdm is just inside the template

refs:

Create a PR github template

example:

<!-- Describe what this PR aims to resolve. E.g. This PR aims to ...  -->

<!-- Which issue this PR aims to resolve or fix. E.g. This PR resolves #... -->

## How to test these changes

<!-- Example:

* run the command `abc d`
* open the web browser with url localhost
* ...
-->

* ...

## Author's Checklist

- [ ] it includes tests
- [ ] the tests are executed on CI.
- [ ] it includes documentation
- [ ] pre-commit hooks were executed locally
- [ ] Filled the section "How to test these changes" with detailed instructions.

## Additional information

<!-- Add any screenshot that helps to show the changes proposed -->

<!-- Add any other extra information that would help to understand the changes proposed by the PR -->

## Reviewer's Checklist

Copy and paste this template for your review's note:

```
## Reviewer's Checklist

- [ ] I managed to reproduce the problem locally from the `main` branch
- [ ] I managed to test the new changes locally
- [ ] I confirm that the issues mentioned were fixed/resolved .
```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.