Skip to main content

Opinionated Python template and metadata synchronizer for 2021.

Project description

Tyrannosaurus Reqs

Version status License PyPI - Python Version Docker GitHub release (latest SemVer including pre-releases) Latest version on PyPi Documentation status Build & test Travis Maintainability Coverage

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 and COVERALLS_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:

† 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:

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


Download files

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

Source Distribution

tyrannosaurus-0.8.1.tar.gz (33.2 kB view hashes)

Uploaded Source

Built Distribution

tyrannosaurus-0.8.1-py3-none-any.whl (41.6 kB view hashes)

Uploaded Python 3

Supported by

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