Opinionated Python template and metadata synchronizer for 2021.
Project description
Tyrannosaurus Reqs
An opinionated, forwards-looking Python template for 2021.
This is a massively upgraded, trimmed-down, modern alternative to cookiecutter built with Poetry, Tox, and Github Actions. No setup.py, requirements.txt, or eggs. If you’re curious why that infrastructure is problematic, see this post
I wrote this after making nearly 50 commits to configure readthedocs, PyPi, Poetry, Tox, Docker, Travis, and Github actions. This avoids that struggle for 99% of projects. It’s technically in an alpha state, but it’s pretty solid.
Basic usage:
To generate a new project, run:
pip install tyrannosaurus
tyrannosaurus new projectname --user gituserororg --track
It’ll give you a link with some steps to follow (such as adding API keys). Of course, you can modify the generated files however you see fit.
Main behavior / features:
Here’s how your new project will behave, by default:
- When you commit, your code is linted and files are checked.
- When you push or make a pull request, your code is tested, security checks are run, and artifacts are built.
- When you push to main, badges are updated and documentation is sent
- When you release on Github, your code is published to PyPi and DockerHub,
and artifacts are attached to the Github release
(Add
PYPI_TOKEN
andCOVERALLS_REPO_TOKEN
as Github repo secrets.) - If you run
tyrannosaurus sync
, your project metadata is synchronized to pyproject.toml
Tox, Git Pre-Commit, and Github Actions provide these behaviors.
You can modify them via pyproject.toml
, tox.ini
, pre-commit-config.yml
and .github/workflows
.
Extras / nice-to-haves:
You’ll also have nice Github labels, templates for issues and pull requests, and a changelog template.
These can be modified by editing .github/labels.json
, .github/ISSUE_TEMPLATE
, and CHANGELOG.md
.
Integration is also provided for Travis, Azure, Anaconda/Conda, and a few other tools.
See the docs 📚 for more information.
Full features / integrations:
- Packaging and dependency management with Poetry
- Python 3.8, 3.9, and 3.8 (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 †
- Continuous deployment to PyPi and Dockerhub
- Automatic attachment of sdits and wheels to Github Releases
- Documentation sent to readthedocs
- Nice documentation defaults with Sphinx extensions
- Test automation with Tox
- Code quality and coverage badges with Coveralls, codecov, and CodeClimate that reflect the main branch
- Code linting with pre-commit, Black, and Prettifier
- Security analysis with Bandit, CodeQL, and safety (issue)
- Static type analysis with mypy
- Auto-generation and synchronization of Conda-Forge recipes and environment YML files
- IDE hints via EditorConfig with good defaults for most languages
- Nice gitignore, dockerignore; issue labels; and Github-recognized issue templates, pull request templates, ChangeLog, readme, license, and contributing guide
- CodeMeta and CITATION.cff
- Dependency updating with Dependabot (disabled by default)
- Synchronization of project metadata with Tyrannosaurus, so that only pyproject.toml needs to be updated
† The Azure workflow currently only builds the Docker image.
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:
To run locally, install Poetry
and Tox (pip install tox
).
Then just type tox
to build artifacts and run tests.
To create an initial Anaconda recipe or environment file, run tyrannosaurus recipe
or tyrannosaurus env
.
Similar tools:
- hypermodern-python, a Python template that is similarly modern. It looks solid but has fewer integrations. A few choices were different, such as the use of Nox. As of 2020-12, the last update was in 2020-04.
- cookiecutter-hypermodern-python
- cookiecutter, which still uses setup.py
- python-blueprint, which is useful to look through but still uses setup.py
Contributing:
New issues and pull requests are welcome.
Please refer to the contributing guide.
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
Hashes for tyrannosaurus-0.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8e594a2c5bd63f92ccfa8b62271e1f16a15802097b0812aeafc47947888e6b9 |
|
MD5 | c6ffb44890aa8f41678358143ad31e9f |
|
BLAKE2b-256 | 5a0bc5c192a36afcedaacbe7b792a951beff0b831f13ad76a8d6be2dcb880401 |