Generate beautifully modern Python projects with seamless, GitHub-based CI/CD and loads of integrations.
Project description
Tyrannosaurus
An opinionated, forwards-looking Python template for 2021.
Generate elegant, ready-to-use Python projects that have excellent continuous integration and deployment (CI/CD). Integrated with Docker Hub, the GitHub Container Registry, Azure, Conda-Forge, and an array of linting, static analysis, security testing, documentation, dependency management, and CI/CD tools, including an optional custom tool to keep all duplicate project metadata synchronized to pyproject.toml.
🎨 Design / generating a new project
This is a modern template built with Poetry, GitHub Actions, and no legacy files or tools. See below for a comparison to other tools. Also see Tyrannosaurus’s little sister science-notebook-template 🧪 for scientific publication repos.
Don’t make 55 commits trying to configure CI/CD workflows.
After creating an empty GitHub repo called myproject
:
pip install tyrannosaurus
tyrannosaurus new myproject --track
# if on a GitHub organization, pass --user my-org-name
After initializing your project, Tyrannosaurus will list manual steps like adding API keys.
Just delete files you don’t want. Or pass --extras
to include extra files like
azure-pipelines config and codemeta.json
.
💡 Main behavior / features
Generated projects are integrated with various tools (from PyPi) and external CI/CD/code-quality systems. GitHub Actions are used by default, but config files for Travis and Azure Pipelines are also provided. You can swap out, modify, or disable anything as you see fit. See the docs 📚 for more information.
By default, here’s how your new project will behave:
- Commit ⇒ Files are linted and verified for integrity
- Make a pull request ⇒ Code is built and tested
- Push to the main branch ⇒ Code is built and tested; code quality, coverage, and security badges are updated
- Make a GitHub release ⇒ Artifacts are sent to GitHub, PyPi, Docker Hub, the GitHub Container Registry, and readthedocs
tox
⇒ Tests are run locallytyrannosaurus sync
⇒ Project metadata is synced to pyproject.tomltyrannosaurus update
⇒ New dependency versions from PyPi and/or Conda are listedtyrannosaurus clean
⇒ Remove temp files (--aggressive
for more)
🎁 Full features / integrations
- Packaging and dependency management with Poetry
- Python 3.8, 3.9, and 3.10 (3.6 and 3.7 with a small change)
- Only modern files: no manifest file, setup.py, requirements.txt, setup.cfg, or eggs
- Continuous integration with GitHub Actions, Travis, or Azure Pipelines
- Docker and Vagrant configuration
- Continuous deployment to PyPi and Docker Hub.
- Deployment to the GitHub Container Registry; plus to any other desired container registries with a simple modification. note: temporarily disabled (0.10.x) due to an issue.
- Automatic attachment of sdits and wheels to GitHub Releases
- Good default GitHub settings, synchronized via Probot settings
- Documentation sent to readthedocs
- Nice documentation defaults with Sphinx extensions
- Test automation with Tox
- Commit linting and changelog generation with Commitizen
- Shields with Coveralls, codecov, CodeClimate, and Scrutinizer that reflect the main branch
- Code linting with pre-commit, Black, Prettifier, Dockerfile-lint, and markdown-lint-check
- Security analysis with Bandit, CodeQL, and safety †
- Static type analysis with mypy
- Conda-Forge recipes and environment YML with Grayskull and Tyrannosaurus
- IDE hints via EditorConfig with good defaults for most languages
- Fancy issue labels
- Slack notifications for CI/CD success and failure with action-slack note: temporarily disabled (0.10.x) due to an issue.
- Fancy GitHub-recognized readme, license, contributing guide, issue templates, and pull request templates
- Nice gitignore, dockerignore, ChangeLog, and other misc files
- CodeMeta and CITATION.cff
- Dependency updating with Dependabot
tyrannosaurus clean
to clean temp filestyrannosaurus update
that lists dependency versions to bumptyrannosaurus sync
to synchronize project metadata to pyproject.toml ‡
† Temporary issue in safety
‡ This feature is experimental and does not yet support all intended sync targets.
✏️ Syncing to pyproject.toml
Note: This feature is only partly complete.
Tyrannosaurus has an optional sync
command that synchronizes metadata from pyproject.toml
to other files,
so that all of your metadata is in pyproject.toml.
There are 16 available target files, including docs/conf.py
, tox.ini
, .pre-commit-config.yaml
, readthedocs.yml
,
.travis.yml
, and __init__.py
.
Settings like dev dependencies, project version, license headers, and preferred line length can be listed exactly once,
in pyproject.toml.
Tyrannosaurus itself can be included as a dependency (but is not by default).
Running tyrannosaurus build
will run poetry lock, synchronize project metadata (via sync
), build, run tests,
install, and clean up.
Target files can be disabled in [tool.tyrannosaurus.targets]
.
🔨 Building your project locally
You can test your project locally. Install Poetry
and Tox (pip install tox
).
Then just type tox
to build artifacts and run tests.
You can install locally with poetry install .
or just pip install .
.
To create an initial Anaconda recipe or environment file, run tyrannosaurus recipe
or tyrannosaurus env
.
After that, you can use sync
to keep them up-to-date with pyproject.toml.
🎯 Similar templates and tools
There are various other templates based on cookiecutter and copier. See which best suits your needs and style.
I designed Tyrannosaurus to solve issues with existing tools. Here are features that other tools lack:
- An elegant CI/CD workflow: The workflow gets kicked off only via
git push
and GitHub releases. - Interopability with Conda, including recipes and environment files, by mapping dependencies and metadata.
- Automated publishing to PyPi, Conda-Forge, Docker Hub, the GitHub Container Registry, and readthedocs.
- No duplication between project files. (Not 100%: some duplication remains.)
- Built-in optional support for extra/alternative tools, such as Travis and codemeta.
- Complete absence of legacy tools, files, and Python 2 support.
🏁 Feature table
| Tool | Main techs | CD kickoff | N int.† | modern‡ | Docker | Conda | sync | any-OS | | ---------------------------------------------------------------------------------------- | -------------------------- | -------------- | ------- | ------- | ------ | ----- | ---- | ------ | --- | | Tyranosaurus | Actions, Poetry, Tox | git, GitHub | 30 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | hypermodern-python | Actions, Poetry, Nox | git, Poetry | 20 | ✔️ | | | | ✔️ | | copier-poetry | Actions, Poetry, Make | git, manual | 15 | | ✔️ | | ✔️ | | | python-package-template | Actions, Poetry, Tox, Make | git, Make | 20 | ✔️ | ✔️ | | | | | pyscaffold | setuptools, Tox | Gitlab, manual | 10 | | | | | ✔️ | | wemake-python-package | Actions, Poetry, Make | git, Poetry | 10 | ✔️ | | | | | | best-practices | Actions, pipenv | git, pipenv | 10 | | ✔️ | | | ✔️ | | python-blueprint | Actions, setuptools, Tox | git, manual | 5 | | ✔️ | | | ✔️ | | cookiecutter-pypackage | Travis, setuptools, Tox | git, manual | 10 | | | | | | | cookiecutter-pylibrary | Travis, setuptools, Tox | git, manual | 20 | | | | | | ✔️ | | cookiecutter-django | Actions, setuptools, Tox | git, manual | 15 | | ✔️ | | | ✔️ | | django-init | Actions, setuptools, Make | git, manual | 15 | | ✔️ | | | ✔️ | | docker-science | Make, Docker, setuptools | no CI/CD | 15 | | ✔️ | | | | | science-notebook-template | Conda | no CI/CD | 5 | | ✔️ | | | ✔️ |
† N int.: Approximate number of built-in integrations with tools and standards. What counts is very roughly defined.
‡ Modern: Lacks legacy files and tools. I’m including Make, setuptools, pipenv, and some others.
Note: copier syncs with a remote template. It’s a neat idea that Tyrannosaurus lacks.
Some of the packages in the table above need more explanation:
- hypermodern-python (template), a Poetry-powered Python template. It’s good, but it made a few unusual choices, such as Nox, which has <500 GitHub stars.
- Both cookiecutter-django and django-init have fantastic setups for Django projects.
- Cookiecutter-docker-science is an interesting project that doesn’t quite fit in this list.
✨ Projects made with Tyrannosaurus
These are some example projects that were generated with Tyrannosaurus:
- Tyrannosaurus
- Mandos
- typed-dfs
- Valarpy
- Sauronlab
- SauronX
- suretime
- service-it
- chemserve
- valar-dagger
- pocketutils
- auth_capture_proxy
🍁 Contributing
New issues and pull requests are welcome.
Please refer to the contributing guide
and security policy.
Generated with tyrannosaurus: tyrannosaurus new tyrannosaurus
.++++++++++++.
.++HHHHHHH^^HHH+.
.HHHHHHHHHH++-+-++.
.HHHHHHHHHHH:t~~~~~
.+HHHHHHHHHHjjjjjjjj.
.+NNNNNNNNN/++/:--..
........+NNNNNNNNNN.
.++++BBBBBBBBBBBBBBB.
.tttttttt:.. .++BBBBBBBBBBBBBBBBBBB.
+tt+. `` .+BBBBBBBBBBBBBBBBBBBBB+++cccc.
ttt. .-++BBBBBBBBBBBBBBBBBBBBBB++.ccc.
+ttt++++:::::++++++BBBBBBBBBBBBBBBBBBBBBBB+..++.
.+TTTTTTTTTTTTTBBBBBBBBBBBBBBBBBBBBBBBBB+. .ccc.
.++TTTTTTTTTTBBBBBBBBBBBBBBBBBBBBBBBB+. .cc.
..:++++++++++++++++++BBBBBB++++BBBB.
....... -LLLLL+. -LLLLL.
-LLLL+. -LLLL+.
+LLL+ +LLL+
+LL+ +ff+
+ff++ +++:
++++:
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
Built Distribution
File details
Details for the file tyrannosaurus-0.10.4.tar.gz
.
File metadata
- Download URL: tyrannosaurus-0.10.4.tar.gz
- Upload date:
- Size: 54.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 007f1f0a541d91f08ef9c7bc1b1431b902c88d18b025d6d8645cd35e2a578217 |
|
MD5 | 8d5ceeda8db79f72c9a5788943cc3e33 |
|
BLAKE2b-256 | c0b39f3379cd4095a7fe7bb5ed5b8a20b6805ce6a33ba72051f8e3db1aab2ee7 |
File details
Details for the file tyrannosaurus-0.10.4-py3-none-any.whl
.
File metadata
- Download URL: tyrannosaurus-0.10.4-py3-none-any.whl
- Upload date:
- Size: 69.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91927464fc51390348a4efb929b3d841efd5ea75076135413230cd19bdadba16 |
|
MD5 | 74aa3fb7bd58c9f0061c3b8126b7795a |
|
BLAKE2b-256 | 66d65b8de52c499e57bdc0aea652f28f6c8f3c566659d86ddc460d1cc3f1c288 |