textgraph-kg 3.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- textgraph_kg-3.2.0/.gitattributes +15 -0
- textgraph_kg-3.2.0/.github/workflows/benchmark.yml +30 -0
- textgraph_kg-3.2.0/.github/workflows/determinism.yml +38 -0
- textgraph_kg-3.2.0/.github/workflows/lint-and-typecheck.yml +29 -0
- textgraph_kg-3.2.0/.github/workflows/pages.yml +55 -0
- textgraph_kg-3.2.0/.github/workflows/pre-commit.yml +21 -0
- textgraph_kg-3.2.0/.github/workflows/publish-pypi.yml +41 -0
- textgraph_kg-3.2.0/.github/workflows/release.yml +45 -0
- textgraph_kg-3.2.0/.github/workflows/test.yml +29 -0
- textgraph_kg-3.2.0/.gitignore +27 -0
- textgraph_kg-3.2.0/.pre-commit-config.yaml +33 -0
- textgraph_kg-3.2.0/ARCHITECTURE.md +353 -0
- textgraph_kg-3.2.0/BENCHMARKS.md +108 -0
- textgraph_kg-3.2.0/CHANGELOG.md +766 -0
- textgraph_kg-3.2.0/PKG-INFO +362 -0
- textgraph_kg-3.2.0/PLAN.md +243 -0
- textgraph_kg-3.2.0/README.md +291 -0
- textgraph_kg-3.2.0/SECURITY.md +28 -0
- textgraph_kg-3.2.0/TextGraph Architecture Gap Analysis.docx +0 -0
- textgraph_kg-3.2.0/TextGraph_Engineering_Blueprint.pdf +0 -0
- textgraph_kg-3.2.0/benchmarks/__init__.py +6 -0
- textgraph_kg-3.2.0/benchmarks/quality.py +155 -0
- textgraph_kg-3.2.0/benchmarks/reasoning.py +89 -0
- textgraph_kg-3.2.0/benchmarks/retrieval.py +255 -0
- textgraph_kg-3.2.0/benchmarks/run.py +135 -0
- textgraph_kg-3.2.0/benchmarks/security.py +131 -0
- textgraph_kg-3.2.0/docs/COMPARISON_SEMANTICA.md +64 -0
- textgraph_kg-3.2.0/docs/RUNNING.md +204 -0
- textgraph_kg-3.2.0/docs/SKILL.md +47 -0
- textgraph_kg-3.2.0/docs/how-it-works.md +46 -0
- textgraph_kg-3.2.0/docs/plans/chat-console.md +191 -0
- textgraph_kg-3.2.0/docs/plans/neo4j-backend.md +92 -0
- textgraph_kg-3.2.0/docs/retrieval-routing.md +52 -0
- textgraph_kg-3.2.0/docs/site/index.html +84 -0
- textgraph_kg-3.2.0/pyproject.toml +152 -0
- textgraph_kg-3.2.0/requirements-dev.txt +13 -0
- textgraph_kg-3.2.0/requirements-full.txt +38 -0
- textgraph_kg-3.2.0/requirements.txt +13 -0
- textgraph_kg-3.2.0/schema/graph.schema.json +81 -0
- textgraph_kg-3.2.0/schema/manifest.schema.json +34 -0
- textgraph_kg-3.2.0/schema/schema.yaml +30 -0
- textgraph_kg-3.2.0/schema/validate.py +43 -0
- textgraph_kg-3.2.0/tests/__init__.py +0 -0
- textgraph_kg-3.2.0/tests/determinism/test_byte_identical.py +30 -0
- textgraph_kg-3.2.0/tests/fixtures/README.md +1 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/adr/adr-0007-case-linking.md +16 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/adr/adr-0008-retention.md +12 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/chat/case-4471.chat +5 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/conflict/filing-a.md +5 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/conflict/filing-b.md +5 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/contradiction/filing.md +7 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/decision_chain/adr-0001-retention.md +4 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/decision_chain/adr-0002-citations.md +4 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/decision_chain/adr-0003-tooling.md +4 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/docs/aml-overview.md +15 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/docs/shell-company.md +6 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/docs/wire-transfers.md +10 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/secure/public.md +3 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/secure/secret.md +3 -0
- textgraph_kg-3.2.0/tests/fixtures/corpora/temporal/correction.md +5 -0
- textgraph_kg-3.2.0/tests/fixtures/corpus_docs/adr-0001.md +14 -0
- textgraph_kg-3.2.0/tests/fixtures/corpus_docs/mixed-encoding.log +3 -0
- textgraph_kg-3.2.0/tests/fixtures/corpus_docs/notes.txt +4 -0
- textgraph_kg-3.2.0/tests/fixtures/er/aliases.md +9 -0
- textgraph_kg-3.2.0/tests/integration/test_agent_session.py +71 -0
- textgraph_kg-3.2.0/tests/integration/test_artifacts.py +84 -0
- textgraph_kg-3.2.0/tests/integration/test_duckdb_store.py +42 -0
- textgraph_kg-3.2.0/tests/integration/test_edge_provenance.py +33 -0
- textgraph_kg-3.2.0/tests/integration/test_er_pipeline.py +135 -0
- textgraph_kg-3.2.0/tests/integration/test_ie_pipeline.py +54 -0
- textgraph_kg-3.2.0/tests/integration/test_incremental.py +114 -0
- textgraph_kg-3.2.0/tests/integration/test_incremental_stress.py +84 -0
- textgraph_kg-3.2.0/tests/integration/test_provenance_integrity.py +36 -0
- textgraph_kg-3.2.0/tests/integration/test_quality_benchmark.py +17 -0
- textgraph_kg-3.2.0/tests/integration/test_report_corpora.py +60 -0
- textgraph_kg-3.2.0/tests/integration/test_security_redteam.py +136 -0
- textgraph_kg-3.2.0/tests/unit/test_canonical_doc.py +86 -0
- textgraph_kg-3.2.0/tests/unit/test_canonical_json.py +38 -0
- textgraph_kg-3.2.0/tests/unit/test_chat.py +116 -0
- textgraph_kg-3.2.0/tests/unit/test_chat_decisions.py +86 -0
- textgraph_kg-3.2.0/tests/unit/test_cli.py +125 -0
- textgraph_kg-3.2.0/tests/unit/test_config.py +22 -0
- textgraph_kg-3.2.0/tests/unit/test_conflicts.py +265 -0
- textgraph_kg-3.2.0/tests/unit/test_console.py +140 -0
- textgraph_kg-3.2.0/tests/unit/test_content_address.py +43 -0
- textgraph_kg-3.2.0/tests/unit/test_decision_chain.py +115 -0
- textgraph_kg-3.2.0/tests/unit/test_decisions.py +171 -0
- textgraph_kg-3.2.0/tests/unit/test_dense.py +78 -0
- textgraph_kg-3.2.0/tests/unit/test_doctor.py +92 -0
- textgraph_kg-3.2.0/tests/unit/test_gliner_backend.py +40 -0
- textgraph_kg-3.2.0/tests/unit/test_got.py +146 -0
- textgraph_kg-3.2.0/tests/unit/test_gql.py +236 -0
- textgraph_kg-3.2.0/tests/unit/test_ingest.py +68 -0
- textgraph_kg-3.2.0/tests/unit/test_integrations.py +61 -0
- textgraph_kg-3.2.0/tests/unit/test_l0_ingest.py +116 -0
- textgraph_kg-3.2.0/tests/unit/test_l1_structure.py +82 -0
- textgraph_kg-3.2.0/tests/unit/test_l2_linguistic.py +44 -0
- textgraph_kg-3.2.0/tests/unit/test_l3_encoder_ie.py +116 -0
- textgraph_kg-3.2.0/tests/unit/test_l4_llm.py +112 -0
- textgraph_kg-3.2.0/tests/unit/test_l5_resolution.py +127 -0
- textgraph_kg-3.2.0/tests/unit/test_l6_claims.py +115 -0
- textgraph_kg-3.2.0/tests/unit/test_l7_analytics.py +103 -0
- textgraph_kg-3.2.0/tests/unit/test_l7_layout.py +41 -0
- textgraph_kg-3.2.0/tests/unit/test_l8_retrieval.py +141 -0
- textgraph_kg-3.2.0/tests/unit/test_llm_augment.py +124 -0
- textgraph_kg-3.2.0/tests/unit/test_mcp_tools.py +56 -0
- textgraph_kg-3.2.0/tests/unit/test_offsets.py +53 -0
- textgraph_kg-3.2.0/tests/unit/test_richdocs.py +119 -0
- textgraph_kg-3.2.0/tests/unit/test_routing.py +45 -0
- textgraph_kg-3.2.0/tests/unit/test_security.py +137 -0
- textgraph_kg-3.2.0/tests/unit/test_vision.py +89 -0
- textgraph_kg-3.2.0/textgraph/__init__.py +6 -0
- textgraph_kg-3.2.0/textgraph/cli.py +923 -0
- textgraph_kg-3.2.0/textgraph/console/__init__.py +10 -0
- textgraph_kg-3.2.0/textgraph/console/api.py +101 -0
- textgraph_kg-3.2.0/textgraph/console/chat.py +512 -0
- textgraph_kg-3.2.0/textgraph/console/ingest.py +124 -0
- textgraph_kg-3.2.0/textgraph/console/page.py +49 -0
- textgraph_kg-3.2.0/textgraph/console/renderer.py +592 -0
- textgraph_kg-3.2.0/textgraph/console/server.py +212 -0
- textgraph_kg-3.2.0/textgraph/core/__init__.py +27 -0
- textgraph_kg-3.2.0/textgraph/core/canonical_doc.py +131 -0
- textgraph_kg-3.2.0/textgraph/core/canonical_json.py +38 -0
- textgraph_kg-3.2.0/textgraph/core/config.py +120 -0
- textgraph_kg-3.2.0/textgraph/core/content_address.py +52 -0
- textgraph_kg-3.2.0/textgraph/core/incremental.py +122 -0
- textgraph_kg-3.2.0/textgraph/core/layout.py +109 -0
- textgraph_kg-3.2.0/textgraph/core/offsets.py +154 -0
- textgraph_kg-3.2.0/textgraph/doctor.py +201 -0
- textgraph_kg-3.2.0/textgraph/got/__init__.py +15 -0
- textgraph_kg-3.2.0/textgraph/got/reason.py +386 -0
- textgraph_kg-3.2.0/textgraph/got/thought.py +123 -0
- textgraph_kg-3.2.0/textgraph/gql/__init__.py +14 -0
- textgraph_kg-3.2.0/textgraph/gql/ast.py +96 -0
- textgraph_kg-3.2.0/textgraph/gql/engine.py +399 -0
- textgraph_kg-3.2.0/textgraph/gql/errors.py +16 -0
- textgraph_kg-3.2.0/textgraph/gql/parser.py +345 -0
- textgraph_kg-3.2.0/textgraph/gql/tokenizer.py +123 -0
- textgraph_kg-3.2.0/textgraph/integrations/__init__.py +22 -0
- textgraph_kg-3.2.0/textgraph/integrations/adapters.py +120 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/__init__.py +10 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/base.py +180 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/dispatch.py +38 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/logs.py +61 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/markdown.py +109 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/plaintext.py +48 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/richdocs.py +231 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/structured.py +98 -0
- textgraph_kg-3.2.0/textgraph/l0_ingest/transcript.py +52 -0
- textgraph_kg-3.2.0/textgraph/l1_structure/__init__.py +11 -0
- textgraph_kg-3.2.0/textgraph/l1_structure/decisions.py +149 -0
- textgraph_kg-3.2.0/textgraph/l1_structure/emit.py +81 -0
- textgraph_kg-3.2.0/textgraph/l1_structure/structure.py +276 -0
- textgraph_kg-3.2.0/textgraph/l2_linguistic/__init__.py +12 -0
- textgraph_kg-3.2.0/textgraph/l2_linguistic/negation.py +31 -0
- textgraph_kg-3.2.0/textgraph/l2_linguistic/sentences.py +65 -0
- textgraph_kg-3.2.0/textgraph/l3_encoder_ie/__init__.py +32 -0
- textgraph_kg-3.2.0/textgraph/l3_encoder_ie/canonicalize.py +100 -0
- textgraph_kg-3.2.0/textgraph/l3_encoder_ie/emit_ie.py +80 -0
- textgraph_kg-3.2.0/textgraph/l3_encoder_ie/extract.py +339 -0
- textgraph_kg-3.2.0/textgraph/l3_encoder_ie/gliner_backend.py +109 -0
- textgraph_kg-3.2.0/textgraph/l3_encoder_ie/model.py +72 -0
- textgraph_kg-3.2.0/textgraph/l3_encoder_ie/rules.py +181 -0
- textgraph_kg-3.2.0/textgraph/l4_llm_optional/__init__.py +12 -0
- textgraph_kg-3.2.0/textgraph/l4_llm_optional/cache.py +41 -0
- textgraph_kg-3.2.0/textgraph/l4_llm_optional/client.py +108 -0
- textgraph_kg-3.2.0/textgraph/l4_llm_optional/extract.py +113 -0
- textgraph_kg-3.2.0/textgraph/l4_llm_optional/synthesize.py +120 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/__init__.py +25 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/audit.py +38 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/blocking.py +43 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/clustering.py +52 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/emit_er.py +47 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/metrics.py +63 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/model.py +53 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/resolve.py +102 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/scoring.py +57 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/similarity.py +74 -0
- textgraph_kg-3.2.0/textgraph/l5_entity_resolution/splink_backend.py +33 -0
- textgraph_kg-3.2.0/textgraph/l6_graph_model/__init__.py +11 -0
- textgraph_kg-3.2.0/textgraph/l6_graph_model/claims.py +164 -0
- textgraph_kg-3.2.0/textgraph/l6_graph_model/conflicts.py +339 -0
- textgraph_kg-3.2.0/textgraph/l6_graph_model/temporal.py +99 -0
- textgraph_kg-3.2.0/textgraph/l7_analytics/__init__.py +10 -0
- textgraph_kg-3.2.0/textgraph/l7_analytics/algorithms.py +157 -0
- textgraph_kg-3.2.0/textgraph/l7_analytics/analyze.py +169 -0
- textgraph_kg-3.2.0/textgraph/l7_analytics/communities.py +194 -0
- textgraph_kg-3.2.0/textgraph/l7_analytics/enrich.py +80 -0
- textgraph_kg-3.2.0/textgraph/l7_analytics/layout.py +152 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/__init__.py +11 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/bm25.py +70 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/dense.py +212 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/emit_chunks.py +143 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/engine.py +1138 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/grounding.py +49 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/model.py +446 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/narrate.py +63 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/rerank.py +72 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/routing.py +145 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/vision/__init__.py +20 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/vision/embed.py +80 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/vision/maxsim.py +45 -0
- textgraph_kg-3.2.0/textgraph/l8_retrieval/vision/retriever.py +59 -0
- textgraph_kg-3.2.0/textgraph/l9_artifacts/__init__.py +9 -0
- textgraph_kg-3.2.0/textgraph/l9_artifacts/analytics_lite.py +50 -0
- textgraph_kg-3.2.0/textgraph/l9_artifacts/artifacts.py +217 -0
- textgraph_kg-3.2.0/textgraph/l9_artifacts/graph_html.py +95 -0
- textgraph_kg-3.2.0/textgraph/l9_artifacts/graph_json.py +92 -0
- textgraph_kg-3.2.0/textgraph/l9_artifacts/prov.py +115 -0
- textgraph_kg-3.2.0/textgraph/l9_artifacts/report.py +249 -0
- textgraph_kg-3.2.0/textgraph/mcp/__init__.py +9 -0
- textgraph_kg-3.2.0/textgraph/mcp/server.py +99 -0
- textgraph_kg-3.2.0/textgraph/mcp/tools.py +132 -0
- textgraph_kg-3.2.0/textgraph/pipeline.py +465 -0
- textgraph_kg-3.2.0/textgraph/security/__init__.py +32 -0
- textgraph_kg-3.2.0/textgraph/security/abac.py +84 -0
- textgraph_kg-3.2.0/textgraph/security/context.py +42 -0
- textgraph_kg-3.2.0/textgraph/security/policy.py +119 -0
- textgraph_kg-3.2.0/textgraph/security/rebac.py +107 -0
- textgraph_kg-3.2.0/textgraph/store/__init__.py +10 -0
- textgraph_kg-3.2.0/textgraph/store/base.py +90 -0
- textgraph_kg-3.2.0/textgraph/store/duckdb_store.py +175 -0
- textgraph_kg-3.2.0/textgraph/store/memory.py +40 -0
- textgraph_kg-3.2.0/textgraph/watch.py +80 -0
- textgraph_kg-3.2.0/textgraph-engineering-research.md +573 -0
- textgraph_kg-3.2.0/ui/graph_html/README.md +3 -0
- textgraph_kg-3.2.0/ui/pipeline_console/README.md +3 -0
- textgraph_kg-3.2.0/uv.lock +6515 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Normalize all text to LF in the repo for cross-platform determinism.
|
|
2
|
+
* text=auto eol=lf
|
|
3
|
+
|
|
4
|
+
# Binary research artifacts — never touch line endings.
|
|
5
|
+
*.pdf binary
|
|
6
|
+
*.docx binary
|
|
7
|
+
*.png binary
|
|
8
|
+
*.parquet binary
|
|
9
|
+
|
|
10
|
+
# Fixtures with intentionally invalid/non-UTF-8 bytes must be preserved exactly
|
|
11
|
+
# (their doc_id is blake3(raw bytes) and must match on every platform / CI runner).
|
|
12
|
+
tests/fixtures/corpus_docs/mixed-encoding.log binary
|
|
13
|
+
|
|
14
|
+
# Lockfile is generated; collapse diffs in review.
|
|
15
|
+
uv.lock -diff linguist-generated=true
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: benchmark
|
|
2
|
+
|
|
3
|
+
# Manual / nightly only — NOT a required PR check. Runs the evaluation harness
|
|
4
|
+
# against pinned fixture corpora and publishes a diffable report so extraction /
|
|
5
|
+
# retrieval regressions are caught before release. Real benchmarks land in Phase 4.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: "0 5 * * *" # 05:00 UTC nightly
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
benchmark:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.11"
|
|
21
|
+
enable-cache: true
|
|
22
|
+
- name: Sync (core + dev)
|
|
23
|
+
run: uv sync --extra dev
|
|
24
|
+
- name: Run benchmark harness
|
|
25
|
+
run: uv run python -m benchmarks.run --report benchmarks/latest-report.md
|
|
26
|
+
- name: Upload report
|
|
27
|
+
uses: actions/upload-artifact@v4
|
|
28
|
+
with:
|
|
29
|
+
name: benchmark-report
|
|
30
|
+
path: benchmarks/latest-report.md
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: determinism
|
|
2
|
+
|
|
3
|
+
# The single most important CI gate (G1): the built graph.json must be
|
|
4
|
+
# byte-identical across rebuilds. Runs on every PR that touches the pipeline.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: determinism-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
determinism:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.11"
|
|
24
|
+
enable-cache: true
|
|
25
|
+
- name: Sync (core + dev)
|
|
26
|
+
run: uv sync --extra dev
|
|
27
|
+
- name: Determinism test (byte-identical graph.json)
|
|
28
|
+
run: uv run pytest tests/determinism -q
|
|
29
|
+
- name: Cross-process byte-identity check
|
|
30
|
+
shell: bash
|
|
31
|
+
run: |
|
|
32
|
+
uv run textgraph build tests/fixtures/corpus_docs --json-only /tmp/graph-a.json
|
|
33
|
+
uv run textgraph build tests/fixtures/corpus_docs --json-only /tmp/graph-b.json
|
|
34
|
+
if ! cmp -s /tmp/graph-a.json /tmp/graph-b.json; then
|
|
35
|
+
echo "::error::graph.json is not byte-identical across builds (G1 violated)"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
echo "graph.json is byte-identical across builds."
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: lint-and-typecheck
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: lint-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
lint-and-typecheck:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.11"
|
|
21
|
+
enable-cache: true
|
|
22
|
+
- name: Sync (core + dev)
|
|
23
|
+
run: uv sync --extra dev
|
|
24
|
+
- name: Ruff lint
|
|
25
|
+
run: uv run ruff check .
|
|
26
|
+
- name: Ruff format check
|
|
27
|
+
run: uv run ruff format --check .
|
|
28
|
+
- name: Mypy (strict on core/store/mcp)
|
|
29
|
+
run: uv run mypy
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: pages
|
|
2
|
+
|
|
3
|
+
# Builds a small demo graph with `textgraph build` and deploys a static site to
|
|
4
|
+
# GitHub Pages: a landing page plus the fully-offline interactive graph.html viewer.
|
|
5
|
+
# Enable in repo Settings → Pages → Source: "GitHub Actions".
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
# One concurrent Pages deploy; don't cancel an in-flight publish.
|
|
18
|
+
concurrency:
|
|
19
|
+
group: pages
|
|
20
|
+
cancel-in-progress: false
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- name: Install uv
|
|
28
|
+
uses: astral-sh/setup-uv@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: "3.11"
|
|
31
|
+
enable-cache: true
|
|
32
|
+
- name: Sync (core)
|
|
33
|
+
run: uv sync
|
|
34
|
+
- name: Build the demo graph (self-contained graph.html)
|
|
35
|
+
run: uv run textgraph build tests/fixtures/corpora/docs -o _demo
|
|
36
|
+
- name: Assemble the site
|
|
37
|
+
run: |
|
|
38
|
+
mkdir -p site
|
|
39
|
+
cp docs/site/index.html site/index.html
|
|
40
|
+
cp _demo/graph.html site/graph.html
|
|
41
|
+
- name: Upload Pages artifact
|
|
42
|
+
uses: actions/upload-pages-artifact@v3
|
|
43
|
+
with:
|
|
44
|
+
path: site
|
|
45
|
+
|
|
46
|
+
deploy:
|
|
47
|
+
needs: build
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
environment:
|
|
50
|
+
name: github-pages
|
|
51
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
52
|
+
steps:
|
|
53
|
+
- name: Deploy to GitHub Pages
|
|
54
|
+
id: deployment
|
|
55
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: pre-commit
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pre-commit:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Install uv
|
|
14
|
+
uses: astral-sh/setup-uv@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.11"
|
|
17
|
+
enable-cache: true
|
|
18
|
+
- name: Sync (core + dev)
|
|
19
|
+
run: uv sync --extra dev
|
|
20
|
+
- name: Run pre-commit hooks
|
|
21
|
+
run: uv run pre-commit run --all-files --show-diff-on-failure
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: publish-pypi
|
|
2
|
+
|
|
3
|
+
# Publishes the built sdist + wheel to PyPI on a version tag, using PyPI Trusted
|
|
4
|
+
# Publishing (OpenID Connect) — no API token or password is stored anywhere. The
|
|
5
|
+
# `pypi` environment below must match the one configured on the PyPI project's
|
|
6
|
+
# Trusted Publisher. The artifact is re-verified byte-deterministic before publish (G1).
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags:
|
|
11
|
+
- "v*"
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
id-token: write # required for OIDC / trusted publishing
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
publish:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
environment:
|
|
22
|
+
name: pypi
|
|
23
|
+
url: https://pypi.org/p/textgraph-kg
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.11"
|
|
30
|
+
enable-cache: true
|
|
31
|
+
- name: Build sdist + wheel
|
|
32
|
+
run: uv build
|
|
33
|
+
- name: Verify the built wheel is importable and deterministic (G1)
|
|
34
|
+
shell: bash
|
|
35
|
+
run: |
|
|
36
|
+
uv run --no-project --with dist/*.whl textgraph build tests/fixtures/corpus_docs --json-only /tmp/pub-a.json
|
|
37
|
+
uv run --no-project --with dist/*.whl textgraph build tests/fixtures/corpus_docs --json-only /tmp/pub-b.json
|
|
38
|
+
cmp -s /tmp/pub-a.json /tmp/pub-b.json || { echo "::error::released artifact is non-deterministic"; exit 1; }
|
|
39
|
+
- name: Publish to PyPI (Trusted Publishing)
|
|
40
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
41
|
+
# No `password:` — authentication is via OIDC against the Trusted Publisher.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Builds and publishes on tag. Critically, re-runs the determinism test against
|
|
4
|
+
# the exact released artifact before publishing (G1).
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags:
|
|
9
|
+
- "v*"
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
release:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.11"
|
|
23
|
+
enable-cache: true
|
|
24
|
+
- name: Sync (core + dev)
|
|
25
|
+
run: uv sync --extra dev
|
|
26
|
+
- name: Full test suite
|
|
27
|
+
run: uv run pytest -q
|
|
28
|
+
- name: Determinism gate on released state
|
|
29
|
+
run: uv run pytest tests/determinism -q
|
|
30
|
+
- name: Build distribution
|
|
31
|
+
run: uv build
|
|
32
|
+
- name: Verify built wheel is importable and deterministic
|
|
33
|
+
shell: bash
|
|
34
|
+
run: |
|
|
35
|
+
uv run --no-project --with dist/*.whl textgraph build tests/fixtures/corpus_docs --json-only /tmp/rel-a.json
|
|
36
|
+
uv run --no-project --with dist/*.whl textgraph build tests/fixtures/corpus_docs --json-only /tmp/rel-b.json
|
|
37
|
+
cmp -s /tmp/rel-a.json /tmp/rel-b.json || { echo "::error::released artifact is non-deterministic"; exit 1; }
|
|
38
|
+
- name: Create GitHub release
|
|
39
|
+
uses: softprops/action-gh-release@v2
|
|
40
|
+
with:
|
|
41
|
+
# Only the distributables — not uv's auto-generated dist/.gitignore.
|
|
42
|
+
files: |
|
|
43
|
+
dist/*.whl
|
|
44
|
+
dist/*.tar.gz
|
|
45
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: test-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.11", "3.12"]
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- name: Install uv
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
enable-cache: true
|
|
26
|
+
- name: Sync (core + dev)
|
|
27
|
+
run: uv sync --extra dev
|
|
28
|
+
- name: Pytest with whole-package coverage gate (>= 88%)
|
|
29
|
+
run: uv run pytest -q --cov --cov-report=term-missing
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.venv/
|
|
6
|
+
venv/
|
|
7
|
+
.eggs/
|
|
8
|
+
build/
|
|
9
|
+
dist/
|
|
10
|
+
|
|
11
|
+
# Tooling
|
|
12
|
+
.mypy_cache/
|
|
13
|
+
.ruff_cache/
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.coverage
|
|
16
|
+
htmlcov/
|
|
17
|
+
|
|
18
|
+
# TextGraph build artifacts / caches
|
|
19
|
+
.cache/
|
|
20
|
+
*.parquet
|
|
21
|
+
graph.json
|
|
22
|
+
graph.html
|
|
23
|
+
|
|
24
|
+
# OS / editor
|
|
25
|
+
.DS_Store
|
|
26
|
+
.idea/
|
|
27
|
+
.vscode/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Local pre-commit hooks, mirrored by .github/workflows/pre-commit.yml.
|
|
2
|
+
# Install once with: uv run pre-commit install
|
|
3
|
+
minimum_pre_commit_version: "3.8.0"
|
|
4
|
+
|
|
5
|
+
repos:
|
|
6
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
7
|
+
rev: v5.0.0
|
|
8
|
+
hooks:
|
|
9
|
+
- id: trailing-whitespace
|
|
10
|
+
- id: end-of-file-fixer
|
|
11
|
+
- id: check-yaml
|
|
12
|
+
- id: check-json
|
|
13
|
+
- id: check-toml
|
|
14
|
+
- id: check-merge-conflict
|
|
15
|
+
- id: check-added-large-files
|
|
16
|
+
args: ["--maxkb=25000"] # research PDF/DOCX are large but committed intentionally
|
|
17
|
+
- id: detect-private-key # basic secret scanning
|
|
18
|
+
|
|
19
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
20
|
+
rev: v0.16.1
|
|
21
|
+
hooks:
|
|
22
|
+
- id: ruff
|
|
23
|
+
args: ["--fix"]
|
|
24
|
+
- id: ruff-format
|
|
25
|
+
|
|
26
|
+
- repo: local
|
|
27
|
+
hooks:
|
|
28
|
+
- id: schema-validate
|
|
29
|
+
name: validate schema/manifest fixtures against JSON Schema
|
|
30
|
+
entry: uv run python schema/validate.py
|
|
31
|
+
language: system
|
|
32
|
+
pass_filenames: false
|
|
33
|
+
files: ^(schema/|tests/fixtures/).*\.(json|ya?ml)$
|