Registry / web-framework / django-nine

django-nine

JSON →
library0.2.7pypypi✓ verified 86d ago

django-nine is a lightweight utility library for Django that provides consistent methods for checking Django and Python versions, as well as abstracting user model access for cross-version compatibility. The current version is 0.2.7. Its release cadence is very slow, with the last update in late 2022.

pip install django-nine
INSTALL
IMPORT
SIG · DJANGO-NINE
D
django-nine
web-frameworkpythonv0.2.7
Install
3.6s avg
Import
45ms
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.046s · 67.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.6s · import 0.044s · 68MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

versions
from nine import versions
from django_nine import versions
The installed package is `django-nine` but the top-level import name is `nine`.
user
from nine import user
from django_nine import user
The installed package is `django-nine` but the top-level import name is `nine`.

This quickstart demonstrates how to use `django-nine` to check the Django version and access the user model. The `versions` module provides boolean constants for easy version comparisons.

from nine import versions from nine import user import django print(f"Current Django version: {django.get_version()}") if versions.DJANGO_GTE_1_7: print("Django version is 1.7 or greater.") if versions.DJANGO_GTE_2_0: print("Django version is 2.0 or greater.") # Example of getting user model for cross-version compatibility # (Requires Django to be configured, typically inside a Django project) # from django.conf import settings # settings.configure() # Only for standalone script, not a real Django project # try: # User = user.get_user_model() # print(f"User model: {User._meta.label}") # except Exception as e: # print(f"Could not get user model: {e}")
Debug
Known issues
gotchaThe PyPI package is `django-nine`, but the Python import name is `nine`. Attempting to import `django_nine` will result in a `ModuleNotFoundError`.
fix
Always use `from nine import ...` for imports.
affects: All versions
breakingAs of version 0.2.7, `django-nine` officially dropped support and testing for Python 2.x and older Python 3 versions (3.4, 3.5, 3.6), as well as very old Django versions. While the code might still function on some of these, it's no longer guaranteed.
fix
Ensure your project uses Python 3.7+ and a modern Django version (e.g., Django 2.2+).
affects: 0.2.7 and later
gotcha`Django` is a peer dependency, meaning `django-nine` expects Django to be installed in your environment, but it does not install Django for you. If Django is not installed, the utilities will not function correctly.
fix
Explicitly install Django alongside `django-nine` (e.g., `pip install django django-nine`).
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'django_nine'
Incorrect import statement; the package is installed as `django-nine` but imported as `nine`.
fix
Change your import statement from `import django_nine` or `from django_nine import ...` to `import nine` or `from nine import ...`.
ModuleNotFoundError: No module named 'packaging'
The `packaging` dependency was introduced in `django-nine` 0.2.7. If you installed an older version and upgraded Python/Django without properly reinstalling, or if pip resolution failed, `packaging` might be missing.
fix
Ensure `packaging` is installed: `pip install packaging` or reinstall `django-nine` to pick up its dependencies: `pip install --upgrade django-nine`.
AttributeError: module 'nine.versions' has no attribute 'DJANGO_GTE_X_Y'
You are attempting to access a version constant (e.g., `DJANGO_GTE_3_0`) that is not available in your installed `django-nine` version, or you have a typo in the constant name.
fix
Check the `django-nine` documentation or source code for available constants, and ensure you have an updated version of `django-nine` if looking for newer Django version constants. For example, `DJANGO_GTE_2_0` is available, but `DJANGO_GTE_4_0` might only be present in very recent versions (or not at all if the library hasn't updated).
Upgrade
Version history
0.2.7latest on PyPI · released Dec 5, 2022
Audit
Dependencies
packagingrequiredUsed for robust version comparison, added as a dependency in 0.2.7.
DjangorequiredThis is a peer dependency; django-nine provides utilities for Django projects, but does not install Django itself.
Agent activity
2 hits · last 30 days
node
2
Resources
django-nine — pip install django-nine · libregistry