Skip to main content

Specification, schema, and CLI tooling for Django template TagSpecs

Project description

djtagspecs

Structured metadata for Django-style template tags. djtagspecs provides the TagSpecs specification, a reference JSON Schema, and a small CLI so tooling can reason about template syntax without importing Django or executing tag code.

Specification and Schema

djtagspecs ships both the normative specification and a machine-readable schema so producers and tooling vendors can stay aligned.

  • Specificationspec/SPECIFICATION.md is the authoritative contract for TagSpecs. It defines the object model, terminology, validation rules, and forward-compatibility guarantees that implementers MUST follow.
  • Schemaspec/schema.json is generated from the Pydantic models and mirrors the specification. Use it to validate TagSpec documents or integrate with JSON Schema tooling.

Regenerate the schema whenever the models change to keep distribution artifacts in sync:

djts generate-schema -o spec/schema.json

If discrepancies arise, the written specification takes precedence; the schema is an executable companion for tooling convenience.

Library

Features

  • Describe tag libraries, arguments, block structure, and semantics in a declarative format.
  • Publish machine-readable specs that static analysers and editors can ingest.
  • Generate a canonical JSON Schema for validation or documentation tooling.

Requirements

  • Python 3.10, 3.11, 3.12, 3.13

Installation

python -m pip install djtagspecs

# or if you like the new hotness

uv add djtagspecs
uv sync

CLI usage

The package exposes the djts CLI. Use it to emit the reference schema:

djts generate-schema -o spec/schema.json

Omit -o to print the schema to stdout. The command guarantees the emitted schema matches the Pydantic models shipped in this distribution.

Python API

The Pydantic models in djtagspecs.models mirror the specification. Example:

from pathlib import Path

from djtagspecs.models import TagSpec

spec_path = Path("spec/catalog.json")
catalog = TagSpec.model_validate_json(spec_path.read_text())
print(catalog.engine)

The models apply defaults and validate the structure of TagSpec documents. Any unknown keys are preserved so specs can round-trip safely.

License

djtagspecs is licensed under the Apache License, Version 2.0. See the LICENSE file for more information.

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

djtagspecs-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

djtagspecs-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file djtagspecs-0.1.0.tar.gz.

File metadata

  • Download URL: djtagspecs-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.19

File hashes

Hashes for djtagspecs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dd61053380be1ac57c043e20163bc56f1dc50215bcc8dc53ad3f1bce1b0d6376
MD5 fd9b9b9f9bbd4a479bebbaa04f7a2b50
BLAKE2b-256 a1edba37512413821d6e1d8d2ea865b317c8e699e29d327ed4968bb7b8c557f6

See more details on using hashes here.

File details

Details for the file djtagspecs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: djtagspecs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.19

File hashes

Hashes for djtagspecs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d818ff37bb9c3b4a703865a4e5befc5f729bfe88e357e43bb0ee1dda1dc120fe
MD5 efc3dd9991a2b8326742e3f696a2056e
BLAKE2b-256 b845650b44b95902d30d3db2435cc3d12e279a9c62f3b5e85d7ad1e16e0e7ca3

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