Skip to main content

A collection of classes built on Django to make it easier to build web applications.

Project description

DjangoFoundry

DjangoFoundry is a Python library which intends to expedite the development process by creating a few classes your code can inherit from.

Do I need another framework?

No. You don't. This is entirely unnecessary for your project, but it includes tools that help me bootstrap my work, so I'm releasing it. Feel free to modify it to your needs, or ignore this project altogether.

Installation

To install DjangoFoundry, use pip:

pip install djangofoundry

Features

DjangoFoundry includes classes to manage aspects of a Django application, such as:

  • Generic controllers to inherit from including JSON and memory monitoring.
  • A library of exceptions.
  • Progress tracking with the ProgressStates, ProgressBar, and ChildProgressBar classes.
  • Hook and waypoint management.
  • Template rendering for specific use-cases, such as creating db models.
  • Matching engine for handling tasks like OCR.
  • Utility mixins for dealing with dirty fields, hookable objects, and param handling.
  • Simplified JSON encoding with the JSONEncoder class.
  • Model, queryset, and serializer management for data handling.
  • Readthedocs documentation
  • Finish pylint / prospector cleanup
  • Github actions
  • Easy access to various apis

Sample Cases

Consider a scenario where you are processing a set of items, and you want to display a progress bar to indicate the progress of the task.

    total_items = items_to_process.count()
    processed_items = 0
    for item in items_to_process:
        processed_items += 1
        progress = (processed_items / total_items) * 100
        # Now you have to manually handle this progress information

With DjangoFoundry, we can remove some of the boilerplate:

    progress_bar = ProgressBar(total=items_to_process.count())
    for item in items_to_process:
        progress_bar.advance()
        # DjangoFoundry handles the progress tracking for you.

We can use querysets to calculate statistics like the median:

median_value = Model.objects.values_list('field_name', flat=True).median()
filtered = Model.objects.filter(field_name__gte=median_value - deviation, field_name__lte=median_value + deviation)

With DjangoFoundry, most of that goes away:

filtered = Model.objects.filter_median('field_name', deviation)

We can find correlations in the data as well:

correlated_fields = Model.objects.find_correlated_fields('field_name', threshold)

Scripts are included to start up, monitor, and manage various processes, including django and a postgres db.

python scripts/db.py start

It also includes an alpha version of a "GPT-4 linter", which scans your python files, sends them to the openai api to ask for feedback, and saves that feedback to a diff file. No embeddings are passed, so this will only be of so much help. An openai api key is needed: a sample-settings.yaml is provided to copy

python scripts/lint.py --help

About the Author

DjangoFoundry is developed by Jess Mann. For any queries, suggestions, or feedback, feel free to reach out.

Contributing

Contributions to DjangoFoundry are always welcome. If you find a bug or have a suggestion for improvement, please open an issue. Pull requests are also welcome.

Testing

The unit tests work in my environment, but haven't been adapted to work without django. This will be done when I have a moment.

TODO

  • Script to bootstrap django/angular project with a single command.
  • Unit tests should work independent of django env
  • Expand app startup script to check for common env problems
  • requirements.txt and other setup
  • Opinionated dependencies fail gracefully
  • Script to create new controller/url/angular components with a single command
  • Standard pages (memory management, etc)
  • Standard way to tie in jinja generated code into admin ui

License

DjangoFoundry is released under the BSD 3-Clause License.

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

djangofoundry-0.0.2.tar.gz (80.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djangofoundry-0.0.2-py3-none-any.whl (108.2 kB view details)

Uploaded Python 3

File details

Details for the file djangofoundry-0.0.2.tar.gz.

File metadata

  • Download URL: djangofoundry-0.0.2.tar.gz
  • Upload date:
  • Size: 80.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for djangofoundry-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bee917de6e6fcf8166d155c461e5a3bd5daa87353f6e29320e0cd35a3f97854b
MD5 a6888326de6bc4068b63e30e862643d0
BLAKE2b-256 4ddc1aa164a2f22a561413e04a2d4317e0cc06df44197f97580d1b76ace894ba

See more details on using hashes here.

File details

Details for the file djangofoundry-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: djangofoundry-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 108.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for djangofoundry-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 23160238ab784dbb3cf5be76f3f193a4c17721ca2282f8bafb2b0702e90fbf94
MD5 27c894f52b23a6747466b697d8f769b5
BLAKE2b-256 a1ba6c8641f334a8be9bf8eec64cb0b311464235799a12b2c1eb6ea123d08579

See more details on using hashes here.

Supported by

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