Skip to main content

Project template for Django app, using Poetry.

Project description

Poetry Template

Django app template, using poetry-python as dependency manager.

This project is a template that can be cloned and re-used for redistributable apps.

It includes the following:

  • poetry for dependency management
  • isort, black, pyupgrade and flake8 linting
  • pre-commit to run linting
  • mypy for type checking
  • tox and Github Actions for builds and CI

There are default config files for the linting and mypy.

Principles

The motivation for this project is to provide a consistent set of standards across all YunoJuno public Python/Django projects. The principles we want to encourage are:

  • Simple for developers to get up-and-running
  • Consistent style (black, isort, flake8)
  • Future-proof (pyupgrade)
  • Full type hinting (mypy)

Versioning

We currently support Python 3.7+, and Django 3.2+. We will aggressively upgrade Django versions, and we won't introduce hacks to support breaking changes - if Django 4 introduces something that 2.2 doesn't support we'll drop it.

Coding style

We use pre-commit to run code quality tools. Install pre-commit however you like (e.g. pip install pre-commit with your system python) then set up pre-commit to run every time you commit with:

> pre-commit install

You can then run all tools:

> pre-commit run --all-files

For more info, see the docs, or the code quality chapters in Boost Your Django DX.

Tests

Tests package

The package tests themselves are outside of the main library code, in a package that is itself a Django app (it contains models, settings, and any other artifacts required to run the tests (e.g. urls).) Where appropriate, this test app may be runnable as a Django project - so that developers can spin up the test app and see what admin screens look like, test migrations, etc.

Running tests

The tests themselves use pytest as the test runner. If you have installed the poetry evironment, you can run them thus:

$ poetry run pytest

or

$ poetry shell
(djhubspot) $ pytest

The full suite is controlled by tox, which contains a set of environments that will format, lint, and test against all support Python + Django version combinations.

$ tox
...
______________________ summary __________________________
  fmt: commands succeeded
  lint: commands succeeded
  mypy: commands succeeded
  py37-django22: commands succeeded
  py37-django32: commands succeeded
  py37-djangomain: commands succeeded
  py38-django22: commands succeeded
  py38-django32: commands succeeded
  py38-djangomain: commands succeeded
  py39-django22: commands succeeded
  py39-django32: commands succeeded
  py39-djangomain: commands succeeded

CI

There is a .github/workflows/tox.yml file that can be used as a baseline to run all of the tests on Github. This file runs the oldest (2.2), newest (3.2), and head of the main Django branch.

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

dj-hubspot-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

dj_hubspot-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file dj-hubspot-0.1.0.tar.gz.

File metadata

  • Download URL: dj-hubspot-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.5 Darwin/21.6.0

File hashes

Hashes for dj-hubspot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 421527d22d78de4332429326d8f67ddc53344faf0d581344a11c0b8d59982e50
MD5 61f423770afb0d88a12de023e40f19c1
BLAKE2b-256 fb5acba770768617799d810ae1475b34bdd63b4631fecb84e82fc5994c11c51d

See more details on using hashes here.

File details

Details for the file dj_hubspot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dj_hubspot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.5 Darwin/21.6.0

File hashes

Hashes for dj_hubspot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61ae7a0d74c22abc2cbe47bb967b0bb54035f31dccc61c5121fa2a7624b156b6
MD5 be0dd82742ceb12367b63995987e1066
BLAKE2b-256 7627548833a71e0084e6f6ffb0e9e69a2e910fb07b2342cb4cbd11857baa449d

See more details on using hashes here.

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