Skip to main content

scjn

Client for the SCJN's SCOW JSON API (https://legislacion.scjn.gob.mx) and reader for the scjn-leyes GitHub release: a Mexican federal law's reform-dated snapshots, each tagged with a fuente: scjn provenance header. The SCJN is not an official source of legal text — the Diario Oficial de la Federación (DOF), read through dofjson, remains that; this package's crawl is a convenience corpus SCJN's own consolidated view makes possible, never a replacement for it.

This package was extracted out of a downstream package's own modules (issue #206). Fase 1 (issue #207) moved the transport (scjn.api), the catalogue's own algebra (scjn.catalog), per-instrument crawl state (scjn.state), and the provenance header's reader (scjn.header) — no behaviour change, no release-format change. Fase 3 (issue #209) moved the scjn-leyes release's own readers here too (scjn.release: download_scjn_leyes_corpus, download_scjn_leyes_index, download_scjn_leyes_catalog, iter_current_federal_laws, markdown_de_snapshot, download_scjn_leyes_assets, local_slugs), now in the package's own public scjn.__all__, disk-first and with their own cache directory (scjn.cache, $SCJN_CACHE_DIR — a separate lifecycle from the downstream package's cache, migrated once automatically from wherever it used to live). codNota linking — matching a snapshot to the DOF codNota that produced it — stays one layer up: a codNota is a DOF concept, and this package's dependency direction is one way (see tests/test_boundary.py).

Since issue #215 every law also carries the SCJN's own materia (subject classification), vigencia (whether it is still in force — seven values, not a boolean) and resumen (a one-paragraph abstract). They are per law, not per reform, so they live in each law's own estado.json and in the release index, and download_scjn_leyes_catalog/iter_current_federal_laws return them with no extra request — which makes scjn-leyes a classified corpus. scripts/fetch_federal_law_metadata.py is what fills them in, one SCJN search per law, matched by idOrdenamiento so a wrong document can never be described as the right one (issue #115, Hallazgo C).

scjn download [--slug SLUG] [--cache-dir DIR] [--refrescar]

puts the release on disk; every reader in scjn.release then reads off it with no network request at all, raising scjn.release.AssetNotCached for whatever is not there yet.

Changelog

  • 0.5.0 — the fourth id-keyed collection, scjn-tratados (issue #277): every international treaty the SCJN serves (~1,456 instruments, members by the SCJN's ámbito TRATADOS INTERNACIONALES, any category). download_scjn_tratados_index / _corpus / _assets, local_tratados_ids and iter_current_tratados are the same thin wrappers over the generic core the reglamentos/lineamientos ones are (same AssetNotCached/SinTextoEnSCJN raise order), scjn.cache.TRATADOS joins COLECCIONES_POR_ID, scjn download --coleccion tratados fetches it, and scjn.release.construye_indice_global_tratados is its index builder. The release is a numbered series of tags (scjn-tratados, scjn-tratados-2, ...). scjn.discovery gains an ambito keyword (discover/discover_by_category, default "FEDERAL", existing calls unchanged), a by-ámbito mode (categoria="": no reform-category rescue and no coverage audit) and report_outside_ambito.

  • 0.4.0 — articulos_a_markdown recovers table rows from a blank-line-separated block of an article's contenido that carries a tab (issue #253): the SCJN's plain text uses a run of tabs as its only column separator, and a wrapped multi-line cell used to come back as one Markdown paragraph per source line instead of one per row. A block with no tab is unaffected, byte for byte. Measured on the cached scjn-leyes release: 35 of 315 laws, 567 of 3,707 snapshots — a snapshot already on disk only picks up the fix via scripts/fetch_scjn_legislacion.py --reintenta <slug>, never automatically.

  • 0.3.0 — iter_current_reglamentos / iter_current_lineamientos (issue #227, Fase 2): iter_current_federal_laws' id-keyed siblings, the current text of every instrument of either collection, one tarball open at a time. No codNota and no abrev (neither collection is DOF-linked), the newest snapshot chosen from the file names since an id-keyed tarball ships no indice.json, and an instrument the index lists with no consolidated text at all is skipped rather than raising SinTextoEnSCJN.

  • 0.2.0 — the package's first release: the SCOW transport (scjn.api), the catalogue algebra, the crawl state, the provenance header and the disk-first readers of the scjn-leyes/scjn-reglamentos/ scjn-lineamientos releases (issues #206-#212, #220, #222).

Development

pip install -e "packages/scjn[test]"
pytest packages/scjn

License

Apache License 2.0. See LICENSE.

Metadata

Release files for scjn 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scjn 0.5.0
File Size Uploaded Provenance
scjn-0.5.0.tar.gz 100.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scjn 0.5.0
File Interpreter ABI Platform
scjn-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 164.2 kB

Release files / scjn-0.5.0.tar.gz

Download URL scjn-0.5.0.tar.gz
Size 100.6 kB
Tags Source
SHA-256 checksum
How to use checksums
92a023a316af7b892eae1b3d36f6822798b8cf9e80e8d4d070202db45a67df72
BLAKE2b-256 checksum
How to use checksums
644da3a706fca1aceadd8378438f670f7fa996a2fe6b342d7ab3df11078613da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / scjn-0.5.0-py3-none-any.whl

Download URL scjn-0.5.0-py3-none-any.whl
Size 63.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fdc543bc0516c9d7c1f278119a28711201084b247c5e51ad3f9b59cce9bcafb
BLAKE2b-256 checksum
How to use checksums
7fd1d54b5c94a02a6b4d2603b0772506cb44fdb4b4941db660b4a7b1905c3d95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for scjn 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page