Progressive Formalization for Markdown using Pydantic and Pytest
Project description
Typedown: Markdown that scales
Typedown is a Consensus Modeling Language (CML) designed for Literate Modeling. It bridges the gap between the fluidity of human thought (Markdown) and the rigor of engineering (Pydantic + Pytest).
"You don't know it until you model it."
The Trinity
Typedown treats Markdown as a first-class language for Consensus as Code (CaC), built on three pillars:
- Markdown (Interface): Retains natural language expressiveness. It's the habitat for humans and AI.
- Pydantic (Structure): Defines strict data schemas via
modelblocks. - Pytest (Logic): Enforces business rules and constraints via
specblocks.
Why Typedown?
Traditional tools force a binary choice:
- Liquids (Text/Markdown): High fluidity but zero structural integrity. Documentation rots instantly.
- Crystals (Code/JSON/SQL): High integrity but zero flexibility. Hard for humans to browse and for AI to grasp intent.
Typedown is Active Soft Matter. It allows information to "phase transition" from loose notes into solid, validated models within the same document.
Core Features
- Markdown that scales: Manage thousands of interconnected entities with IDE-grade navigation and validation.
- Progressive Formalization: Start with a sketch, end with a verified system.
- Triple Resolution: Resolve references
[[ref]]through Hash (L0), Handle (L1), and Logical ID (L2). - Evolution Semantics: Track time using
former(versioning) to manage history. - Context-Aware Scoping: Implicit hierarchy via
config.tdand directory inheritance. - QC Pipeline: Four-layered validation from syntax (Lint) to external facts (Test).
Quick Start
1. Define a Model
Define your schema directly in Markdown using Python:
```model:UserAccount
class UserAccount(BaseModel):
name: str
age: int = Field(..., ge=18)
role: str = "member"
```
2. Declare an Entity
Instantiate data using YAML with smart reference unboxing:
```entity UserAccount: alice
id: "iam/user/alice-v1"
name: "Alice"
age: 30
role: "admin"
```
3. Write a Specification
Add business logic that targets your data:
```spec id=check_roles
@target(type="UserAccount")
def validate_admin(subject: UserAccount):
if subject.role == "admin":
assert subject.age >= 25, "Admins must be senior"
```
CLI Usage
The td tool is your companion for the development loop:
td lint: (L1) Check Markdown syntax and YAML formatting.td check: (L2) Validate entities against Pydantic models.td validate: (L3) Check references and runspecblocks (Internal Logic).td test: (L4) Run external verification (Oracles/APIs).td run <script>: Execute scripts defined in Front Matter.
Installation
Typedown is designed for the uv ecosystem. We recommend using uv or uvx over standard piping.
🚀 Instant Run (Recommended)
Use uvx to execute Typedown instantly without managing environments:
uvx typedown --help
🛠️ Global Tool
Install it as a standalone tool available everywhere:
uv tool install typedown
📦 Project Dependency
Add it to your Python project:
uv add typedown
⌨️ VS Code Extension
Install Typedown Integration from:
Documentation
- GEMINI.md: AI Agent Guidance (Start here for AI dev).
- English Documentation: Explore more about Typedown.
- Chinese Documentation: 核心中文文档.
- Manifesto: Why we built this.
License
MIT © IndenScale
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typedown-0.2.6.tar.gz.
File metadata
- Download URL: typedown-0.2.6.tar.gz
- Upload date:
- Size: 224.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1377741042a531f90608c3a1f2cf7ba2034f8953845a286fc2d49afde32df7d
|
|
| MD5 |
ff4798ab505d773b88811aeea914028b
|
|
| BLAKE2b-256 |
fc1d1300b17f68f37dfb329938fa244df034df19b2e94b87f350e46743effca7
|
Provenance
The following attestation bundles were made for typedown-0.2.6.tar.gz:
Publisher:
publish-pypi.yml on IndenScale/Typedown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typedown-0.2.6.tar.gz -
Subject digest:
a1377741042a531f90608c3a1f2cf7ba2034f8953845a286fc2d49afde32df7d - Sigstore transparency entry: 788530505
- Sigstore integration time:
-
Permalink:
IndenScale/Typedown@f0bed34e4518e7d2169871fb35ebf6c7cd00097a -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/IndenScale
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f0bed34e4518e7d2169871fb35ebf6c7cd00097a -
Trigger Event:
push
-
Statement type:
File details
Details for the file typedown-0.2.6-py3-none-any.whl.
File metadata
- Download URL: typedown-0.2.6-py3-none-any.whl
- Upload date:
- Size: 75.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd67cea46599cf39cdca74a0770aaf9412191f4a710e7cf956c866b2706aa0b7
|
|
| MD5 |
600b5f96e22278497bc3e89749ad8a69
|
|
| BLAKE2b-256 |
61e162ab8913df78b1822f71c63109936ed50265a105bebbe6b51fbde2877bb5
|
Provenance
The following attestation bundles were made for typedown-0.2.6-py3-none-any.whl:
Publisher:
publish-pypi.yml on IndenScale/Typedown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typedown-0.2.6-py3-none-any.whl -
Subject digest:
dd67cea46599cf39cdca74a0770aaf9412191f4a710e7cf956c866b2706aa0b7 - Sigstore transparency entry: 788530513
- Sigstore integration time:
-
Permalink:
IndenScale/Typedown@f0bed34e4518e7d2169871fb35ebf6c7cd00097a -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/IndenScale
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f0bed34e4518e7d2169871fb35ebf6c7cd00097a -
Trigger Event:
push
-
Statement type: