Skip to main content

Reusable Django app to track release versions and notify users when a new version is published.

Project description

django-i3version

Reusable Django app to track release versions / changelogs of an application, notify users when a new version is published, and accept release publications from external systems (CI, scripts, Claude, …) via a hashed API key.

pip install django-i3version

Quick start

1. Install + add to INSTALLED_APPS

INSTALLED_APPS = [
    ...,
    "rest_framework",
    "simple_history",        # required dependency, used for history tracking
    "django_i3version",
]

Note on app label. The package module is django_i3version but the Django app label is intentionally set to i3version, so DB tables stay as i3version_*. This makes it possible to drop in this package as a replacement for a project that previously had a local i3version/ Django app — no DB rename, no --fake-initial, no FK-string rewrite.

2. Include URLs

# urls.py
from django.urls import path, include

urlpatterns = [
    ...,
    path("api/i3version/", include("django_i3version.urls")),
]

This mounts two viewsets under your prefix:

  • api/i3version/UserVersionViewSet (per-user notification feed, login-based)
  • api/i3version/publisher/PublisherVersionViewSet (machine-to-machine, API-key)

3. Run migrations

python manage.py migrate i3version

Models

  • Version — a release row. Fields: numeric_version, str_version, uuid_version, name, tier (local/stage/prod), short_description, description, markdown, microservice_commits (JSON), and the user-group filters user_group_filter / user_group_exclude used at creation time to fan out VersionUserNotified rows.
  • VersionAttachment — files attached to a version.
  • VersionUserNotified — per-user notification record (is_notified, is_read). Created automatically on Version.save() for every user matching the version's filter. Marked read via the user API.
  • VersionPublisher — holds a SHA-256-hashed API key. Authenticates machine-to-machine requests against the publisher endpoint.

Settings

Setting Type Default Effect
TIER str None If set, the user-version viewset filters only versions of this tier.

End-user API

Mounted at the prefix you chose in urls.py. Authentication uses the host project's session/login.

Method Path Effect
GET / List versions visible to the authenticated user
GET /{id}/ Retrieve a single version
POST /{id}/mark_as_read/ Mark this version as read for the user
POST /mark_all_as_read/ Mark all versions as read for the user

Publisher API (API-key)

Mounted at <prefix>/publisher/. Auth header:

Authorization: Bearer i3v_pk_<random>

Provision a key via the Django admin: open Version publishers, create a row, then run the "(Re)generate API key" admin action. The raw key is shown once in the admin success message — the database only stores its SHA-256 hash. Set is_active=False to revoke without deleting.

Method Path Effect
GET /publisher/ List versions
GET /publisher/{id}/ Retrieve a version
POST /publisher/ Publish a new version (creates a Version row and fans out VersionUserNotified)

POST body example:

{
  "numeric_version": "1.4.0",
  "str_version": "1.4.0",
  "name": "Spring rollout",
  "tier": "prod",
  "short_description": "...",
  "markdown": "...",
  "microservice_commits": {"backend": "abc123", "frontend": "def456"},
  "user_group_filter": {"is_active": true},
  "user_group_exclude": {"is_staff": true}
}

curl:

curl -X POST https://yourhost/api/i3version/publisher/ \
  -H 'Authorization: Bearer i3v_pk_xxx' \
  -H 'Content-Type: application/json' \
  -d '{"numeric_version":"1.4.0","str_version":"1.4.0","tier":"prod"}'

Security. user_group_filter and user_group_exclude are passed verbatim as ORM **kwargs to User.objects.filter()/exclude() inside Version.save(). Treat publisher API keys as trusted — never expose the publisher endpoint to end users.

OpenAPI schema

A pre-generated schema is checked into the repo at the project root for client-codegen convenience:

The same files are also bundled inside the sdist on PyPI. Consumers can feed either directly into openapi-generator-cli without booting Django.

If you want the schema rendered live by your host project, install the optional extra and mount drf-spectacular's URLs:

pip install "django-i3version[openapi]"
# settings.py
INSTALLED_APPS += ["drf_spectacular"]
REST_FRAMEWORK = {"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema"}

To regenerate the committed files after a change:

make schema

Roadmap

  • Webhooks on new release.
  • Pluggable notification backends (Slack, email, Pub/Sub).
  • Per-publisher tier scoping.
  • Dedicated I3VERSION_* settings (key prefix override, fan-out toggle, …).

Development

make virtualenv_create
source venv/bin/activate
make install_dev
make test            # runs unit tests against in-memory sqlite
make schema          # regenerate openapi.yaml + openapi.json
make package_build   # build sdist + wheel
make package_upload  # twine upload

License: GNU GPL v3.0.
Repo: https://github.com/sajlx/django-i3version

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

django_i3version-0.0.2.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

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

django_i3version-0.0.2-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_i3version-0.0.2.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for django_i3version-0.0.2.tar.gz
Algorithm Hash digest
SHA256 497acbfce9189378cd5ab0a968693489f931bcae2ea2c7745bea4c3e3f0c124d
MD5 9ef639d426f448c395c6a1df070ada06
BLAKE2b-256 02716aba3a849579067df0ce887fdcc0c607a4c873b1968447aed264a8bf72c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_i3version-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a82672aa2000aca0d22838024dc4a7919316f1301f5c0c72e57152cd9ea71ee5
MD5 aacc4509660b7998e3265f63627276be
BLAKE2b-256 999d623705a281b1d4e2e16214ab45e53a1200ff89d029613f1fa017fc13ed30

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