Skip to main content

django-nublado-core

Common abstract models, utilities, and a simple dictionary-based app settings system for Django projects.

Overview

I found myself copying and pasting the same "core" app containing common abstract models, utilities, and app settings configuration in my Django projects, so I made it a reusable package.

The goal is to provide simple, reliable core building blocks without introducing unnecessary complexity. The package evolves incrementally as needs arise in my projects, and is shared for others who may find it useful.

What’s included

  • Abstract base models for common Django patterns (e.g., timestamps, UUIDs, language).

  • A small utility for typed, dictionary-based application settings using dataclasses.

Installation

Install the package from PyPI.

pip install django-nublado-core

Add the app to your Django project.

INSTALLED_APPS = [
    ...
    "django_nublado_core",
]

The package provides only abstract models and utilities, and does not create database tables or migrations on its own.

Abstract models

These core abstract models provide common fields and related functionality used across multiple models.

TimestampModel

An abstract model that adds automatic timestamp fields for object creation and updates.

from django.db import models

from django_nublado_core.models import TimestampModel


class Article(TimestampModel):
    title = models.CharField(max_length=200)


# Sample usage
article = Article(title="hello there")
article.save()
article.created_at
article.updated_at # refreshed on each save

Notes

  • Uses timezone-aware datetimes.

Fields:

  • created_at
  • updated_at

UUIDModel

An abstract model that generates a UUID for a subclassed model's primary key.

from django.db import models

from django_nublado_core.models import UUIDModel


class User(UUIDModel):
    username = models.CharField(max_length=200)

# Sample usage
user = User(username="Paco")
user.save()
# Primary key is a generated UUID.
user.pk # UUID('eeb4a289-034c-4e4c-9c54-98100cca1ee7')

Notes

  • The generated UUID field is set as the primary key.

LanguageModel

An abstract model that provides a language choices field populated by the project's language settings.

LanguageModel contains an inner LanguageChoices enum derived from settings.LANGUAGES.

from django.db import models

from django_nublado_core.models import LanguageModel


class Article(LanguageModel):
    title = models.CharField(max_length=200)


# Sample usage
article = Article(title="hello there")
article.save()
article.language # "en"

article.LanguageChoices.EN.value # "en"

Notes

  • The default language value is taken from settings.LANGUAGE_CODE.

  • Language values are validated via full_clean(), but are not enforced at the database level by default. This is intentional. Database-level constraints can be added by developers in subclasses if needed.

Application settings

This package provides a small utility for loading typed, dictionary-based application settings using Django settings and Python dataclasses.

To configure settings for an app, define three things in a module (conf.py or app_settings.py for example):

  • The name of the settings dictionary
  • A dictionary of default values
  • A dataclass defining the exposed settings

Defining app settings

from dataclasses import dataclass

from django_nublado_core.conf.base import AppSettings

# The app's settings dict name (defined in Django settings.py)
SETTINGS_DICT_NAME = "YOUR_APP_SETTINGS"

# Default values for all exposed settings
SETTINGS_DEFAULTS = {
    "SETTING_A": "setting A",
}


@dataclass(frozen=True)
class AppData:
    SETTING_A: str


app_settings = AppSettings(
    settings_dict_name=SETTINGS_DICT_NAME,
    defaults=SETTINGS_DEFAULTS,
    cls=AppData,
)

Overriding settings

In your project's settings.py, define a dictionary matching the configured settings name.

YOUR_APP_SETTINGS = {
    "SETTING_A": "custom value",
}

Only keys explicitly declared on the dataclass are loaded. Unknown keys are ignored and logged as warnings.

Usage

The resulting app_settings object provides typed, read-only access to your application settings.

from .config import app_settings

value = app_settings.SETTING_A

Notes

  • All settings must have defaults defined.
  • Settings are loaded and cached at runtime.
  • Unknown user-defined keys are ignored and logged.

Testing

pytest

Notes:

  • Runs all tests for the app.
  • Requires pytest-django.

Metadata

Release files for django-nublado-core 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-nublado-core 0.4.3
File Size Uploaded Provenance Actions
django_nublado_core-0.4.3.tar.gz 11.0 kB Without provenance Details for django_nublado_core-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-nublado-core 0.4.3
File Interpreter ABI Platform Actions
django_nublado_core-0.4.3-py3-none-any.whl Python 3 none any Details for django_nublado_core-0.4.3-py3-none-any.whl

Total release size: 19.4 kB

Release files / django_nublado_core-0.4.3.tar.gz

Download URL django_nublado_core-0.4.3.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7e011310172c211c860af676fee50fc862dfabbfe711f0604563c5ff126883ad
BLAKE2b-256 checksum
How to use checksums
8e9daabe19926b88a9937e551b5d4d5bb8ef522e0111e61d241d387f8917f7fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / django_nublado_core-0.4.3-py3-none-any.whl

Download URL django_nublado_core-0.4.3-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25e8e3ef0d803f7c8997aa97e59559ebde3ad92929b82fc3ae90b78b16aedb30
BLAKE2b-256 checksum
How to use checksums
a4d510471947108201fcf0a844208f139bbc4183d2f7bb39d6285650906b09a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for django-nublado-core 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page