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:
```yaml
- 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
File details
Details for the file django_project_checks-0.3.tar.gz
.
File metadata
- Download URL: django_project_checks-0.3.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.10 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31596cbcf183a5cef0c2b7af03f6ae81dc3cd8a7fa6a636fe41ab52ce1d50a26 |
|
MD5 | b53df90de744e43f42da65b6f2934401 |
|
BLAKE2b-256 | c2f361592f2f9a302bd8e2e7504687cb5a6ef4e6ed355c5b2defa4c66fe3921e |
File details
Details for the file django_project_checks-0.3-py3-none-any.whl
.
File metadata
- Download URL: django_project_checks-0.3-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.10 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcafd2c96e35638fef8675a77b05dc4cb5f73dd8a12d4af40d17789ce33957b3 |
|
MD5 | e21140381675b174bc8e204b083940c7 |
|
BLAKE2b-256 | 4afb211164e0c4f05dccc0dfe1aa8cfa344a176a654a3df5b42e05830808cdbb |