Skip to main content

1-click Generator of Python Project, from Template with streamlined "DevOps" using a powerful CI/CD Pipeline.

Project description

GitHub Workflow Status (with event) Codecov Read the Docs (version) Maintainability Codacy Code Climate technical debt
Production Version PyPI - Wheel Supported Python versions GitHub commits since tagged version (branch) GitHub commits since latest release (by SemVer)
PyPI - Downloads OpenSSF Ruff Black GitHub

Generate Python Project and enjoy streamlined “DevOps” using a powerful CI/CD Pipeline.

What’s included?

  • Generator of Python Project (see Quickstart), with CLI for Linux, MacOS, and Windows

  • Option to Generate Python Package designed as module, module+cli, or pytest-plugin!

  • Scaffold over 24 files, from Template, to have a ready-to-develop Project equiped with:

    • Fully-featured CI/CD Pipeline, running on Github Actions, defined in .github/

    • Continuous Delivery to PyPI (ie pypi.org, test.pypi.org) and Dockerhub

    • Continuous Integration, with Test Suite running pytest , located in tests dir

    • Continuous Documentation, building with mkdocs or sphinx, and hosting on readthedocs, located in docs dir

    • Static Type Checking, using mypy

    • Lint Check and Apply commands, using the fast Ruff linter, along with standard isort, and black

    • Build Command, using the build python package

What to expect?

You can to be up and running with a new Python Package, and run workflows on Github Actions, such as:

CI Pipeline, running on Github Actions, for a Biskotaki Python Package

Link: https://github.com/boromir674/biskotaki/actions/runs/4157571651

  1. CI Pipeline, running on Github Actions, defined in .github/

    1. Job Matrix, spanning different platform’s and python version’s

      1. Platforms: ubuntu-latest, macos-latest

      2. Python Interpreters: 3.6, 3.7, 3.8, 3.9, 3.10

    2. Parallel Job execution, generated from the matrix, that runs the Test Suite

    3. Artifact store of Source and Wheel Distributions, factoring Platform and Python Version

Auto Generated Sample Package Biskotaki

Check the Biskotaki Python Package Project, for a taste of the project structure and capabilities this Template can generate!

It it entirely generated using this Python Package Template:

Source Code hosted on Github at https://github.com/boromir674/biskotaki
Python Package hosted on pypi.org at https://pypi.org/project/biskotaki/
CI Pipeline hosted on Github Actions at https://github.com/boromir674/biskotaki/actions

Quickstart

To install the latest Generator in your environment, run:

pip install cookiecutter-python

The generate-python CLI should become available in your environment.

Next, create a file, let’s call it gen-config.yml, with the following content:

default_context:
    project_name: Demo Generated Project
    project_type: module+cli
    full_name: John Doe
    email: john.doe@something.org
    github_username: john-doe
    project_short_description: 'Demo Generated Project Description'
    initialize_git_repo: no
    interpreters: {"supported-interpreters": ["3.8", "3.9", "3.10", "3.11"]}

To generate a Python Package Project, run:

mkdir gen-demo-dir
cd gen-demo-dir

generate-python --config-file ../gen-config.yml --no-input

Now, you should have generated a new Project for a Python Package, based on the Template!

The Project should be located in the newly created demo-generated-project directory.

To leverage all out-of-the-box development operations (ie scripts), install tox:

python3 -m pip install --user 'tox<4'

To verify tox available in your environment, run: tox --version

Please, do a cd into the newly created directory, ie cd <my-great-python-package>.

To run the Test Suite, cd into the newly created Project folder, and run:

tox -e dev

All Tests should pass, and you should see a coverage report!

To run Type Checking against the Source Code, run:

tox -e type

All Type Checks should pass!

To setup a Git Repository, run:

git init
git add .
git checkout -b main
git commit -m "Initial commit"

To setup a Remote Repository, run for example:

git remote add origin <remote-repository-url>
git push -u origin main

To trigger the CI/CD Pipeline, run:

git push

Navigate to your github.com/username/your-repo/actions page, to see the CI Pipeline running!

Develop your package’s Source Code (business logic) inside src/my_great_python_package dir :)
Develop your package’s Test Suite (ie unit-tests, integration tests) inside tests dir :-)

Read the Documentation’s Use Cases section for more on how to leverage your generated Python Package features.

Next Steps

To prepare for an Open Source Project Development Lifecycle, you should visit the following websites:

  • PyPI, test.pypi.org, Dockerhub, and Read the Docs, for setting up Release and Documentation Pipelines

  • github.com/your-account to configure Actions, through the web UI

  • Codecov, Codacy, and Codeclimate, for setting up Automated Code Quality, with CI Pipelines

  • https://www.bestpractices.dev/ for registering your Project for OpenSSF Best Practices Badge

Happy Developing!

License

GitHub

Free/Libre and Open Source Software (FLOSS)

OpenSSF

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cookiecutter_python-1.12.3.tar.gz (373.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cookiecutter_python-1.12.3-py3-none-any.whl (200.7 kB view details)

Uploaded Python 3

File details

Details for the file cookiecutter_python-1.12.3.tar.gz.

File metadata

  • Download URL: cookiecutter_python-1.12.3.tar.gz
  • Upload date:
  • Size: 373.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.0 importlib_metadata/7.0.1 packaging/23.2 pkginfo/1.9.6 requests/2.31.0 requests-toolbelt/1.0.0 tqdm/4.66.1 CPython/3.10.12

File hashes

Hashes for cookiecutter_python-1.12.3.tar.gz
Algorithm Hash digest
SHA256 54342198a64e0edc3677399647b4535d41a80694e38a45c276276f9da4a5ec8a
MD5 8813329712f445f22e0e9abc7ccc5e50
BLAKE2b-256 ea0ee7cf07f8185883e41ce4208f85fd4b69d99d3a7d4278f26e6dc1ac8ad19b

See more details on using hashes here.

File details

Details for the file cookiecutter_python-1.12.3-py3-none-any.whl.

File metadata

  • Download URL: cookiecutter_python-1.12.3-py3-none-any.whl
  • Upload date:
  • Size: 200.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.0 importlib_metadata/7.0.1 packaging/23.2 pkginfo/1.9.6 requests/2.31.0 requests-toolbelt/1.0.0 tqdm/4.66.1 CPython/3.10.12

File hashes

Hashes for cookiecutter_python-1.12.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8898aa0c0b29b736a9547bf8cc7fed1c91f4edbbc33ba5dd529eac69da33fb26
MD5 fd083a6721329487fc47f5e2458e4ed3
BLAKE2b-256 191c83fe4c52c62d5abbb93a1180eaa801c8cae2f924d115b9964b85e3391cd0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page