Django management commands used to output useful project information.
Project description
Django Project Check
Django management command for monitoring file diffs.
Background
With a large codebase, and a high velocity team making edits, it can be
difficult to keep track of how the codebase is changing over time. A
classic issue is people creating new modules / classes in unexpected
places, or ending up with a set of functions that should be in the same
place but are spread across multiple locations (often resulting in
import
issues). In order to address this we build a small script to
parse the codebase and dump out a complete listing of all modules,
classes and functions. We commit this to the repo, and then run a CI
check to ensure that it's up to date. The net result is that each PR has
at least one file update which lists which functions have been edited,
and where. It's like a live update to the index.
This pattern - dump a text output and add a CI check to enforce its correctness - turns out to be a really useful pattern for keeping control of the codebase, and so we started adding new checks:
- Python functions
- Django URLs
- GraphQL schema
- FSM interactions
The original function check is a python script (using ast
) and has no
requirement for the Django scaffolding, but the others do, and so they
run as management commands, which are then wrapped with a git diff
script:
- name: Run freeze_django_urls and check for any uncommitted diff
run: |
python manage.py freeze_django_urls
git diff --exit-code 'django_urls.txt'
This project wraps this pattern into a base management command that can be subclassed for any such requirement. All you need to do is provide a function that returns the contents to be written to the file.
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 django-project-checks-0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bed7463aa24e043b542aa9fc35985adeabd6deec6dedda2b1d64c47317b79a44 |
|
MD5 | 5a63f1c32856cef842737c1d97dc240f |
|
BLAKE2b-256 | e50d249a6d3b5b259b5a89ffdb2a1e92c5d6546397bb13bde0ed95a877dcde19 |
Hashes for django_project_checks-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d02b237c3816fbfdbfaa38d692624917da0c8317469d0b0a56d921887c3e3e6 |
|
MD5 | 46d1d59357a13e7ee95a35b128d28392 |
|
BLAKE2b-256 | 003a136e8e3e01b6f45d99d499d9eea7fc3162c0207658725ae7b083c597ded2 |