Skip to content
/ python-repo-template Public template

Template repo for Python projects, especially those focusing on machine learning and/or deep learning.

License

Notifications You must be signed in to change notification settings

fkodom/python-repo-template

Repository files navigation

{{REPO_NAME}}

A simple template for Python projects, with CI/CD configured through GitHub Actions. Compatible with any virtual environment manager (e.g. venv, pyenv, poetry, conda).

Usage

  1. Create a new repository, using this one as a template.

  2. Run the templatize script:

    ./templatize

    This updates placeholders like {{REPO_NAME}}, so everything is configured with your username, repo name, email, etc.

  3. Commit and push the changes.

    git add .
    git commit -m "Templatize"
    git push
  4. (Probably) delete this section of the README.

Install

pip install "{{REPO_NAME}} @ git+ssh://git@github.com/{{REPO_OWNER}}/{{REPO_NAME}}.git"

# Install all dev dependencies (tests etc.)
pip install "{{REPO_NAME}}[test] @ git+ssh://git@github.com/{{REPO_OWNER}}/{{REPO_NAME}}.git"

# Setup pre-commit hooks
pre-commit install

Tooling

Tool Description Runs on
black Code formatter - git commit (through pre-commit)
- git push
- pull requests
ruff Code linter - git commit (through pre-commit)
- git push
- pull requests
pytest Unit testing framework - git push
- pull requests
mypy Static type checker - git push
- pull requests
pre-commit Pre-commit hooks - git commit
twine $\dagger$ PyPI package uploader - New release (git tag)

$\dagger$ Requires enabling the publish.yaml workflow. To activate, move the file from .github/disabled-workflows/publish.yaml.disabled to .github/workflows/publish.yaml, and set a valid PyPI token as PYPI_API_TOKEN in the repo secrets.

Then tag a new release of this repo, and GHA will automatically build and publish a Python wheel (.whl) to PyPI.

About

Template repo for Python projects, especially those focusing on machine learning and/or deep learning.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages