lexifina/portugal-law
About
Portugal: law history, one commit per law taking effect (sources so far) · Part of global law
Developer ToolsMeasured star growth
- in 24h
- +1
- in 7 days
- +2
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.en.md
OriginalPortugal: law history in git
English · Ou leia em português
The law of Portugal as a git history: one file per article, one commit per version on the day it took effect, and the act that made each change as the commit's author. git blame names the act behind every line; git log lists every change to an article; picking a date gives the text in force that day.
Part of lexifina/global-law, one git history for every country's law: this is Portugal's national law, which global-law reads at portugal/national/acts/.
What is in it now: the Constitution with its seven revisions (constituicao/); 34 codes (codigos/); the Diário da República 1.ª série from 1976 and the Diário do Governo from 1910, by kind of act (legislacao/), with 18,650 of the 23,350 Leis and Decretos-Leis in force; regulatory acts of the 2.ª série (serie-2/); more than 330,000 court decisions (jurisprudencia/); the Assembleia da República's records (parlamento/); ANACOM's decisions and the Banco de Portugal's avisos (reguladores/); and Madeira's official journal, the JORAM, from 1977 (regioes/joram/). Each record names the page it was read from, and data/ gives the detail.
Each act is in legislacao/<kind>/<year>/<number>/ (legislacao/lei/2014/35/ is the Lei Geral do Trabalho em Funções Públicas, Lei n.º 35/2014, with its annex in anexo/; a number with a letter is a folder like legislacao/decreto-lei/1981/110-a/), one file per article; the Constitution is in constituicao/, and the Civil Code and the Labour Code (Código do Trabalho, approved by Lei n.º 7/2009) in codigos/codigo-civil/ and codigos/codigo-do-trabalho/. Until 10 November 2026 each folder was named by the act's id (codigo-do-trabalho/), and until 17 November 2026 the kind folders were at the top (lei/, code/): git log --follow and git blame follow the moves, data/paths.json maps each id to its folder, and the last two commands below name the old folders.
The text is in Portuguese, as the Diário da República's consolidated legislation prints it. An English translation is not part of this record.
Questions as git commands
| Question | Command |
|---|---|
| Every change to Article 238 of the Labour Code (length of annual leave) | git log -p --follow --word-diff -- codigos/codigo-do-trabalho/artigo-238.md |
| Which act wrote each line of Article 238? | git blame codigos/codigo-do-trabalho/artigo-238.md |
| Every version of the Labour Code, with the day each took effect | git log --format="%h %(trailers:key=In-force,valueonly,separator=) %an" -- codigos/codigo-do-trabalho code/codigo-do-trabalho codigo-do-trabalho |
| Article 238 as in force on 1 January 2012 | python tools/em_vigor.py 2012-01-01 codigo-do-trabalho 238 |
Outside git, we also host this record publicly, for free:
- Ask Claude about Portuguese law: opens Claude with a first question ready.
- Ask ChatGPT: the same question in ChatGPT.
- Search Portuguese law on our site: a search for "férias" (annual leave), with each provision's text and its versions, no account needed.
- Developer REST API: the same search as JSON, with no key. See the documentation here.
Both assistants read the record through the free Global law connector (MCP, https://global-law.lexifina.com/mcp); the first time, the chat gives you the link that adds it. Ask in Portuguese or in English.
Host it yourself easily. All it takes is git and Python, and the tools run on your machine:
git clone --depth 1 https://github.com/lexifina/global-law && cd global-law
python3 tools/countries.py add portugal/national/acts
python3 tools/law.py show 2026-01-01 portugal/national/acts/codigos/codigo-do-trabalho/artigo-238.md
Opened in Claude Code, Cursor, VS Code or Codex, the clone also starts a local MCP server with the same tools (MCP.md).
Dates
Each commit is dated at noon, Europe/Lisbon, on the day the version took effect, and carries it in its In-force: trailer, beside Published::
- for the Constitution and the two codes, the day the Diário da República gives each provision version (
DataEntradaVigor); where it gives none, the commit says so and how it was dated; - for each other act, its current text is dated the latest day one of its provisions took effect, and each earlier version is a
Kind: correctioncommit whoseCorrects:line gives the days it covers; they were added after the current text, so they come after it in git whatever their dates; - git cannot store dates before 1970, so the four earlier commits (the Civil Code's first text, in force on 1 June 1967, and three acts of 1960, 1965 and 1968) are dated 1970-01-01, seconds apart, with the real day in
In-force:. Ask for a date withtools/em_vigor.py, notgit log --before.
Each change is credited to the act the Diário da República's amendment timeline names for it (Lei n.º 23/2012), declarations of rectification included; a change it names no act for is credited by date only when exactly one act has changes in force that day (Evidence: date only), otherwise to Diário da República (INCM), labelled. The current text of each other act is credited to the Diário da República (INCM) as publisher.
How it is checked
tools/check_repo.pyreads the Constitution and the two codes back from git on every day a version took effect and compares them with the Diário da República's consolidated text for that day, file by file and word for word against its raw text: 111 days, 196,180 files and 16,587,703 words, 0 mismatches.- A second build from the same data gave the same hash for every one of the 148 law commits and 249 tags;
data/versoes.jsonlists every text read, with its sha256. tools/test_repo.pychecks that blame names an act, that the text changes across an amendment and thatgit log --followworks. The results are inREPRODUCE.md, which describes the build of the first three acts only.- vulnerabilities/: possible drafting mistakes in Portuguese law, found by global-law's detectors and checked by hand.
What it does not show
- Other kinds of act. 2.ª série acts that can name persons (appointments, staff notices, most despachos and avisos) are left out, and its portarias, acórdãos, pareceres and resoluções are metadata records without text; the regional acts of the Azores and EU law are not included.
- Earlier versions of most other acts. 1,698 of the 2,098 have only their current text. For the other 400, history starts at the first dated change, as the Diário da República gives no in-force day for the original text; plain
git blameon them names the publisher, while global-law's tools read the corrections. - Commencement the Diário da República does not model. Some articles of the Labour Code were deferred to later legislation (Lei n.º 7/2009, artigo 14.º), and the Civil Code's artigos 1841.º to 1850.º took effect on 1 January 1968; both are shown from the act's first day.
- The Civil Code from 1967 to 1975. The amendment timeline starts in 1975, so earlier changes appear in its first later version, credited to the publisher. The Constitution's first text, as consolidated, ends at artigo 295.º and has no signatures until 1982.
Sources
| Source | Kind | Past versions | Notes |
|---|---|---|---|
| Diário da República (INCM), Legislação Consolidada | Official journal: consolidated legislation | yes, every provision version with the day it took effect | The text in force on each day and the amendment timeline naming each amending act, read through the calls its own pages make; the consolidated texts have no legal value, only the Diário da República as published is authoritative |
| Diário da República (INCM), acts as published | Official journal: 1.ª and 2.ª série, Diário do Governo | no | legislacao/, serie-2/, the Banco de Portugal's avisos and the acórdãos and assentos it published; many are metadata records with a link to the official PDF |
| Bases Jurídico-Documentais (IGFEJ, Ministério da Justiça) | Case law: Supremo Tribunal de Justiça, Supremo Tribunal Administrativo, the Relações, the central administrative courts, Tribunal dos Conflitos, Julgados de Paz | no | Texts as published, anonymised by the publisher |
| Tribunal Constitucional | Case law: acórdãos and decisões sumárias | no | Texts as published, anonymised by the publisher; not authentic |
| Tribunal de Contas | Case law | no | Summaries as published |
| CAAD | Tax arbitration decisions | no | As published, anonymised by the publisher |
| Assembleia da República | Open data, Diário da Assembleia da República, Debates Parlamentares | no | The debates' text is the publisher's OCR; petitioners' names are left out |
| ANACOM | Regulator's decisions | no | As published |
| JORAM | Madeira's official journal | no | Read from the official PDFs |
Licence
See LICENSE. Lexifina's own work (the history, commit messages, tables, tools and documentation) is CC0 1.0. The legal texts and records are their publishers', listed above and in the LICENSE with each one's terms, and stay under those terms. Under the Portuguese Copyright Code (Código do Direito de Autor e dos Direitos Conexos, artigo 8.º, n.º 1), compilations of the texts of laws, regulations and decisions of the State are not protected. None of the texts here has legal value: only the act as published, or the decision as given by its court, is authentic.
No AI model wrote or changed legal text, and none is called when the history is built or checked; the scripts were written by an AI model (see REPRODUCE.md).
Visualisations
visualisations/: Portuguese law in 20 charts, drawn from this repository.
Including:
- the official gazette year by year, laws and decree-laws, the overseas empire in the summaries
- the spelling reform, rectifications and the dates of the State Budget
- the Assembleia da República, the revisions of the Constitution and the Constitutional Court
More
From lexifina/global-law:
- FEATURES.md: every feature, and what every corpus must support (
git blame,law.py, the MCP tools) - FAQ.md: questions and answers · CONTRIBUTING.md: proposing changes · MCP.md: the MCP server · REPRODUCE.md: how it was built · CHANGELOG.md
- FRESHNESS.md: how current each corpus is · Monitoring: whether updates are running · WATCHING.md: how each official source is watched for changes
- performance/: how fast the tools are, measured
- visualisations/: charts and bridges across the world's law
- Vulnerabilities: mistakes in legislation as published
Explore related projects
Loading…