Package: tyrannosaurus
TyrannosaurusAn 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 projectThis is a modern template built withPoetry,GitHub Actions, andno legacy filesor tools.
See below for acomparison to other tools.
Also see Tyrannosaurus’s little sisterscience-notebook-template 🧪for scientific publication repos.Don’t make 55 commits trying to configure CI/CD workflows.After creating an empty GitHub repo calledmyproject:pipinstalltyrannosaurus
tyrannosaurusnewmyproject--track# if on a GitHub organization, pass --user my-org-nameAfter initializing your project, Tyrannosaurus will list manual steps like adding API keys.
Just delete files you don’t want. Or pass--extrasto include extra files like
azure-pipelines config andcodemeta.json.💡 Main behavior / featuresGenerated 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 integrityMake a pull request⇒ Code is built and testedPush to the main branch⇒ Code is built and tested; code quality, coverage, and security badges are updatedMake a GitHub release⇒ Artifacts are sent to GitHub, PyPi, Docker Hub, the GitHub Container Registry, and readthedocstox⇒ 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 (--aggressivefor more)🎁 Full features / integrationsPackaging and dependency management withPoetryPython 3.8, 3.9, and 3.10 (3.6 and 3.7 with a small change)Only modern files:nomanifest file, setup.py, requirements.txt, setup.cfg, or eggsContinuous integration withGitHub Actions,Travis, orAzure PipelinesDocker and Vagrant configurationContinuous deployment toPyPiandDocker Hub.Deployment to theGitHub 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 ofsditsandwheelstoGitHub ReleasesGood default GitHub settings, synchronized viaProbot settingsDocumentation sent toreadthedocsNice documentation defaults withSphinx extensionsTest automation withToxCommit linting and changelog generation withCommitizenShieldswithCoveralls,codecov,CodeClimate,
andScrutinizerthat reflect the main branchCode linting withpre-commit,Black,Prettifier,Dockerfile-lint,
andmarkdown-lint-checkSecurity analysis withBandit,CodeQL,
andsafety†Static type analysis withmypyConda-Forgerecipesandenvironment YMLwithGrayskullandTyrannosaurusIDE hints viaEditorConfigwith good defaults for most languagesFancyissue labelsSlack notifications for CI/CD success and failure withaction-slacknote:temporarily disabled (0.10.x) due to an issue.Fancy GitHub-recognized readme, license,contributing guide,issue templates, andpull request templatesNice gitignore, dockerignore,ChangeLog, and other misc filesCodeMetaandCITATION.cffDependency updating withDependabottyrannosaurus cleanto clean temp filestyrannosaurus updatethat lists dependency versions to bumptyrannosaurus syncto synchronize project metadata to pyproject.toml ‡†Temporary issue in safety‡ This feature is experimental and does not yet support allintended sync targets.✏️ Syncing to pyproject.tomlNote: This feature is only partly complete.Tyrannosaurus has an optionalsynccommand that synchronizes metadata frompyproject.tomlto other files,
so thatall of your metadata is in pyproject.toml.
There are 16 available target files, includingdocs/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).
Runningtyrannosaurus buildwill run poetry lock, synchronize project metadata (viasync), build, run tests,
install, and clean up.
Target files can be disabled in[tool.tyrannosaurus.targets].🔨 Building your project locallyYou can test your project locally. InstallPoetryandTox(pip install tox).
Then just typetoxto build artifacts and run tests.
You can install locally withpoetry install .or justpip install ..
To create an initial Anaconda recipe or environment file, runtyrannosaurus recipeortyrannosaurus env.
After that, you can usesyncto keep them up-to-date with pyproject.toml.🎯 Similar templates and toolsThere are various other templates based oncookiecutterandcopier. See which best suits your needs and style.I designed Tyrannosaurus to solve issues with existing tools.
Here are features that other tools lack:Anelegant CI/CD workflow: The workflow gets kicked off only viagit pushand GitHub releases.Interopability with Conda, including recipes and environment files, by mapping dependencies and metadata.Automated publishingto PyPi, Conda-Forge, Docker Hub, the GitHub Container Registry, and readthedocs.No duplicationbetween project files. (Not 100%: some duplication remains.)Built-in optional support forextra/alternative tools, such as Travis and codemeta.Completeabsence 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:copiersyncs 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 asNox, which has <500 GitHub stars.Bothcookiecutter-djangoanddjango-inithave fantastic setups for Django projects.Cookiecutter-docker-scienceis an interesting project
that doesn’t quite fit in this list.✨ Projects made with TyrannosaurusThese are some example projects that were generated with Tyrannosaurus:TyrannosaurusMandostyped-dfsValarpySauronlabSauronXsuretimeservice-itchemservevalar-daggerpocketutilsauth_capture_proxy🍁 ContributingNew issuesand pull requests are welcome.
Please refer to thecontributing guideandsecurity 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++         +++:
                        ++++: