This is a collection of tools extracted from a multi-project django monolith. Because we're new to publishing packages, there are a few gotchas:
- This is a monolithic package/install. Consumers can't just install a part, but must install the entire thing.
- This also means the whole thing is versioned together. If we add a shiny new feature after a totally independent breaking change, consumers can't get the new feature without the breaking change.
- This tool doesn't include external dependencies, you will have to install those yourself. We did this so consumers don't need to install packages they may not use.
Utils are grouped by the following package names. That means you import them as so:
from zeus.vanilla import is_asciiis_asciiare_strings_close_enoughgroup_by
versioning model behaviour has no external dependencies.
Subclassing versioning.core.VersionModel will create a history model that is automatically updated on each save. See the example
changelogs requires many external dependencies: graphene, aiodataloader, graphene-django
creating changelogs currently require a lot of boilerplate code.
TODO: create a function that abstracts away all the graphql and allows querying paginated changelog data for specific models, fields, users and dates.
Depends on django, bleach, mistune and pyyaml
TextMakerCreator(global_keys,text_file_paths)WatchingTextMakerCreator((global_keys,text_file_paths)- if using
runserverandsettings.DEBUG=True, requires watchdog
- if using
requires django, bleach and mistune to be installed
markdownis_md_validsanitize_html
pip install titan-zeusthe entry in requirements.txt should look like this
git+git://github.com/TBS-EACPD/zeus@release-0.1#egg=zeusIf you installed using git and want to update, you'll need to run pip uninstall -y zeus before re-running pip install
# in this project:
python setup.py sdistHow to install this locally without pypi (test this right before deploying a new version)
When refreshing a local package, you'll also need pip uninstall -y zeus in between installs. This is super annoying, fortunately there's an easier way for python to link directly to the sources so this isn't necessary:
pip uninstall zeus
# then replace zeus in requirements.txt with the following
# -e file:///absolute/path/to/zeus/
Once you've got something that work in editable mode, try packaging the app
# in zeus project
python setup.py sdist
# in consumer project
pip uninstall -y zeus
# replace the zeus entry in requirements.txt with
#file:///absolute/path/to/zeus/- Install postgres and configure your
$PATH - Set up the virtual environment
- we run tests against a postgres DB, so you'll need to run
createdb zeus-dev