Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gts-spec-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.14.3
29 changes: 23 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $(error PYTHON must be set for local package targets (examples: venv: PYTHON=.ve
endif
endif

.PHONY: help py-env install build install-local uninstall-local clean dev-fmt all check fmt lint clippy mypy test security update-spec e2e coverage gts-server
.PHONY: help py-env install build install-local uninstall-local clean dev-fmt all check fmt lint clippy mypy test security update-spec verify-spec-version e2e coverage gts-server

# Default target - show help
.DEFAULT_GOAL := help
Expand Down Expand Up @@ -125,8 +125,8 @@ PORT ?= 8000
gts-server: install
$(PYTHON) -m gts server --host 127.0.0.1 --port $(PORT)

# Run end-to-end tests against gts-spec
e2e: install
# Run end-to-end tests against gts-spec (pinned via .gts-spec-version)
e2e: install verify-spec-version
@echo "Starting server in background..."
@$(PYTHON) -m gts server --port 8000 & echo $$! > .server.pid
@sleep 2
Expand All @@ -144,12 +144,29 @@ security: py-env
$(PYTHON) -m pip install pip-audit
$(PYTHON) -m pip_audit

# Update gts-spec submodule to latest
# Spec conformance suite is pinned in .gts-spec-version (format vMAJOR.MINOR.PATCH)
# so every checkout reproduces the same e2e run, mirroring the Rust reference.
GTS_SPEC_VERSION ?= $(shell cat .gts-spec-version 2>/dev/null)

# Check out the gts-spec submodule at the pinned .gts-spec-version tag
update-spec:
git submodule update --remote .gts-spec
git submodule update --init .gts-spec
git -C .gts-spec fetch --tags --quiet origin
git -C .gts-spec checkout --quiet "$(GTS_SPEC_VERSION)"
@echo "gts-spec pinned to $(GTS_SPEC_VERSION)"

# Fail if the checked-out gts-spec submodule does not match the pinned version
verify-spec-version:
@current="$$(git -C .gts-spec describe --tags 2>/dev/null)"; \
if [ "$$current" != "$(GTS_SPEC_VERSION)" ]; then \
echo "gts-spec is at '$$current' but .gts-spec-version pins '$(GTS_SPEC_VERSION)'"; \
echo "run 'make update-spec' to sync"; \
exit 1; \
fi; \
echo "gts-spec matches pinned $(GTS_SPEC_VERSION)"

# Run all checks and build
all: check build

# Run all quality checks
check: fmt lint test e2e
check: fmt lint mypy test e2e
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A minimal, idiomatic Python library for working with **GTS** ([Global Type System](https://github.com/gts-spec/gts-spec)) identifiers and JSON/JSON Schema artifacts.

Current supported GTS spec version: `0.14.0`
Current supported GTS spec version: `0.14.3`

## Roadmap

Expand Down
6 changes: 3 additions & 3 deletions gts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Python helpers and a reference HTTP service for the [Global Type System (GTS)](https://github.com/globaltypesystem/gts-spec). The package supports GTS identifier parsing, JSON Schema-backed validation, schema compatibility and derivation checks, traits, casting, queries, file loading, a CLI, and a FastAPI application.

The package targets GTS specification v0.14.0 and requires Python 3.9 or later.
The package targets GTS specification v0.14.3 and requires Python 3.9 or later.

## Installation

Expand Down Expand Up @@ -185,7 +185,7 @@ ops.reload_from_path("replacement-directory")

ops.add_entity(content, validate=False)
ops.add_entities([content_a, content_b])
ops.add_schema(type_id, schema)
ops.add_schemas([schema_a, schema_b])
ops.extract_id(content)
ops.validate_id(gts_id)
ops.parse_id(gts_id)
Expand Down Expand Up @@ -268,7 +268,7 @@ app = GtsHttpServer(ops=GtsOps()).app
| `/entities/{gts_id}` | `GET` | Retrieves one entity. |
| `/entities` | `POST` | Entity/schema body; optional `validate=true` runs full validation. Failed registration returns 422 and is rolled back. |
| `/entities/bulk` | `POST` | JSON array of entity/schema objects. |
| `/type-schemas` | `POST` | `{"type_id": "...~", "type_schema": {...}}`. |
| `/type-schemas` | `POST` | JSON array of GTS Type Schema objects (batch); each entry's `type_id` is derived from its embedded `$id`. Returns `{"ok": ..., "results": [{"ok": ..., "type_id": ..., "error": ...}]}`. |
| `/validate-id` | `GET` | `gts_id` query parameter. |
| `/extract-id` | `POST` | JSON entity/schema object. |
| `/parse-id` | `GET` | `gts_id` query parameter. |
Expand Down
Loading
Loading