Persistent project context for Python — parse, validate, and score `.faf` files. The foundation other Python FAF tools (gemini-faf-mcp, custom MCP servers, CI validators) build on. IANA-registered application/vnd.faf+yaml.
Project description
faf-python-sdk
Persistent project context for Python. Parse, validate, and score .faf files — the foundation other Python FAF tools build on.
If you're building MCP servers, CI validators, or any Python tool that needs to understand project context, start here.
Media Type: application/vnd.faf+yaml (IANA registered)
What's New in v1.1.0
Mk4 Championship Scoring Engine — the same 33-slot scoring algorithm used by the Rust compiler and TypeScript CLI, now in Python. Same slots, same formula, same scores. Every FAF tool in every language now agrees on what 100% means.
score_faf()— Mk4 scoring with 21-slot Base or 33-slot Enterprise tiers- 100% parity with
faf-wasm-sdk(Rust) andfaf-cli(TypeScript) - 3 crash bugs fixed (malformed YAML, null project fields)
- 175 tests including 88 WJTTC championship-grade tests (concurrency, adversarial input, security)
Why this matters: If you're building on FAF in Python — MCP servers, Gemini extensions, CI pipelines — your scores now match every other FAF tool exactly. No more "it scored 85% in the CLI but 60% in Python." One engine, one truth.
v1.1.2 is a patch release — package description aligned with the canonical "Persistent project context for Python" framing. CHANGELOG.md added. No code changes.
Installation
pip install faf-python-sdk
Quick Start
from faf_sdk import parse_file, score_faf
# Parse a .faf file
faf = parse_file("project.faf")
print(f"Project: {faf.project_name}")
# Score it with the Mk4 engine
with open("project.faf") as f:
result = score_faf(f.read())
print(f"Score: {result.score}% {result.tier}")
print(f"Slots: {result.populated}/{result.total} populated")
FAF defines. MD instructs. AI codes.
Mk4 Scoring
The Mk4 engine scores .faf files by checking 21 universal slots (project metadata, human context, tech stack). Each slot is Populated, Empty, or Slotignored. The score is the percentage of active slots that are populated.
from faf_sdk import score_faf, LicenseTier
# Base scoring (21 slots)
result = score_faf(yaml_content)
print(result.score) # 0-100
print(result.tier) # Trophy/Gold/Silver/Bronze/Green/Yellow/Red
print(result.populated) # slots with real data
print(result.active) # total minus slotignored
print(result.slots) # per-slot breakdown
# Enterprise scoring (33 slots — adds monorepo/infra)
result = score_faf(yaml_content, LicenseTier.ENTERPRISE)
Placeholder rejection: Values like "null", "unknown", "n/a", "Describe your project goal" are detected and scored as Empty — not Populated.
Slotignored: Set any slot to slotignored to exclude it from scoring. A backend-only project can mark frontend: slotignored and still reach 100%.
Parsing
from faf_sdk import parse, parse_file, stringify
# Parse from string or file
faf = parse(yaml_content)
faf = parse_file("project.faf")
# Typed access
print(faf.data.project.name)
print(faf.data.project.goal)
print(faf.data.stack.backend)
print(faf.data.human_context.who)
# Raw dict access
print(faf.raw["project"]["goal"])
# Convert back to YAML
yaml_str = stringify(faf)
Validation
from faf_sdk import validate
result = validate(faf)
if result.valid:
print(f"Valid! Score: {result.score}%")
else:
print("Errors:", result.errors)
print("Warnings:", result.warnings)
File Discovery
from faf_sdk import find_faf_file, find_project_root
# Find project.faf (walks up directory tree)
path = find_faf_file("/path/to/src")
# Find project root by markers (package.json, pyproject.toml, .git, etc.)
root = find_project_root()
API Reference
| Function | Returns | Description |
|---|---|---|
score_faf(yaml, tier?) |
Mk4Result |
Mk4 score (21 or 33 slots) |
parse(content) |
FafFile |
Parse YAML string |
parse_file(path) |
FafFile |
Parse from file path |
validate(faf) |
ValidationResult |
Structure validation + warnings |
stringify(data) |
str |
Convert back to YAML |
find_faf_file(dir?) |
str | None |
Find project.faf in tree |
find_project_root(dir?) |
str | None |
Find project root |
FAF Ecosystem
| Package | Platform | Registry |
|---|---|---|
| faf-python-sdk | Python foundation | PyPI |
| gemini-faf-mcp | Google Gemini | PyPI |
| claude-faf-mcp | Anthropic | npm + MCP #2759 |
| grok-faf-mcp | xAI | npm |
| faf-cli | CLI | npm |
Links
- Site: faf.one
- IANA Registration: application/vnd.faf+yaml
- Gemini MCP: gemini-faf-mcp
License
MIT
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
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 faf_python_sdk-1.1.2.tar.gz.
File metadata
- Download URL: faf_python_sdk-1.1.2.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04144992e430beb953ea8baa922af8be7e67c8431a6e9218704e8b94010b60be
|
|
| MD5 |
cf61bf4c3e885e092ae73d67bd04b4dd
|
|
| BLAKE2b-256 |
2532b95e7b538e46bf450961010cf0cead827a28d586ff4034847c0ed7272d88
|
Provenance
The following attestation bundles were made for faf_python_sdk-1.1.2.tar.gz:
Publisher:
pypi.yml on Wolfe-Jam/faf-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
faf_python_sdk-1.1.2.tar.gz -
Subject digest:
04144992e430beb953ea8baa922af8be7e67c8431a6e9218704e8b94010b60be - Sigstore transparency entry: 1387383227
- Sigstore integration time:
-
Permalink:
Wolfe-Jam/faf-python-sdk@b20ec2ac05bdc47fab37c604f161d116f7dcd31d -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/Wolfe-Jam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b20ec2ac05bdc47fab37c604f161d116f7dcd31d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file faf_python_sdk-1.1.2-py3-none-any.whl.
File metadata
- Download URL: faf_python_sdk-1.1.2-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c532a3c53511be665935c934dba9568c8fd64a16ebb2db0d0210a3ec45015d15
|
|
| MD5 |
70469a11f7fb98299f44e3f606714d66
|
|
| BLAKE2b-256 |
56b6a72384366d6cfc80019562a14f0383d5e302229317f02a9c211d5965e87d
|
Provenance
The following attestation bundles were made for faf_python_sdk-1.1.2-py3-none-any.whl:
Publisher:
pypi.yml on Wolfe-Jam/faf-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
faf_python_sdk-1.1.2-py3-none-any.whl -
Subject digest:
c532a3c53511be665935c934dba9568c8fd64a16ebb2db0d0210a3ec45015d15 - Sigstore transparency entry: 1387383371
- Sigstore integration time:
-
Permalink:
Wolfe-Jam/faf-python-sdk@b20ec2ac05bdc47fab37c604f161d116f7dcd31d -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/Wolfe-Jam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b20ec2ac05bdc47fab37c604f161d116f7dcd31d -
Trigger Event:
workflow_dispatch
-
Statement type: