skillfed

django-nine

Version checking library.

django-nine v0.2.7 174.2K downloads/30d#10,286 on PyPI3
Copyleft license GPL-2.0-only OR LGPL-2.1-or-later Active released

What it is and what it does

django-nine is a compatibility library that exposes boolean constants for each Django version, letting you write version-aware code without manual version parsing. It provides constants like `DJANGO_1_7`, `DJANGO_GTE_1_8`, and `DJANGO_LTE_2_0` that evaluate to True or False based on the installed Django version, and can be used in Python code or injected into Django templates via a context processor.

The library is designed for projects that need to support multiple Django versions simultaneously—a common requirement during Django upgrades. Instead of checking `django.VERSION` manually, you import pre-defined version flags and use them in conditional logic. It depends only on Django and packaging, making it a lightweight addition to any Django project.

Use it for:

  • Support multiple Django versions in a single codebase during a gradual Django upgrade
  • Conditionally import or use different APIs depending on the installed Django version
  • Expose Django version information to templates for version-specific template logic
  • Simplify version-gated feature flags in reusable Django packages

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides version checking utilities for Django, allowing code to detect which Django version is installed and conditionally execute logic based on version comparisons.

Yes, if you maintain Django code that must support multiple Django versions. It eliminates boilerplate version checking and is lightweight. No, if you target a single Django version or have already moved to modern Django—the library's last release was December 2022 and it does not yet declare support for Django versions beyond 4.1, so verify compatibility with your target version first.

Install

django-nine on PyPI

pip

pip install django-nine

uv

uv add django-nine

poetry

poetry add django-nine

Installing django-nine

Before you install

Low friction install with only Django and packaging as dependencies. Actively maintained as of April 2026, though last release was December 2022.

License in practice

Dual-licensed under GPL-2.0-only or LGPL-2.1-or-later (copyleft). Use requires compliance with one of these licenses; derivative works must be released under compatible terms.

Quickstart

pip install django-nine

from django_nine import versions

if versions.DJANGO_GTE_2_0:
    # Use Django 2.0+ API
    pass

Requires Django 1.5 or later; Python 3.7 or later.

Verify before relying

  • Whether version constants are automatically generated or manually maintained as Django releases new versions
  • Performance impact of importing the library in hot code paths
  • Whether the package works with Django versions beyond 4.1

Package facts

License GPL-2.0-only OR LGPL-2.1-or-later (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — Django, packaging
Maintenance actively maintained — 1,348 days since the last release
Last repo commit
First released
Downloads 174,191/month — #10,286 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_nine-0.2.7-py2.py3-none-any.whl

Keywords: django, compatibility

Development Status :: 4 - BetaEnvironment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: GNU General Public License v2 (GPLv2)License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)Operating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

django version checkingdjango compatibility detectiondjango version constantsconditional django logic by versiondjango version comparisondjango compatibility utilities
django-compatibilityversion-detection

More Application Frameworks packages