Skip to content

Commit d1d01ff

Browse files
authored
Merge pull request #94 from Accenture/chore/license-file-name
chore(license): the license file is named LICENSE, and a test holds the package manifest to files that exist
2 parents 986c709 + 20cd7d0 commit d1d01ff

5 files changed

Lines changed: 44 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,17 @@
626626
siblings, a callback the host awaits - the copy in the memory store's sweep, and one false positive on
627627
`dataclasses.replace`. **Upgrade note:** none.
628628

629+
12. **The license file at the project root is named `LICENSE`, as in the other repositories of the Mercury family.**
630+
It was `LICENSE.txt`. `pyproject.toml` names the file in `license-files` and in the source distribution's list,
631+
and the README links to it. Its copyright line names Accenture Technology, the holder that `authors` already
632+
names. The build does not fail when one of the manifest's entries names a file that does not exist: with the
633+
file renamed and the manifest unchanged, it built both distributions without the license text and without a
634+
`License-File` line in their metadata. `tests/test_packaging.py` (two tests) fails in that case: every
635+
`license-files` pattern matches a file, and every entry of the source distribution's list exists.
636+
**Upgrade note:** the source distribution carries `LICENSE` at its root and the wheel
637+
`dist-info/licenses/LICENSE`, where each carried `LICENSE.txt`; a script that reads the license by its file name
638+
reads the new name.
639+
629640
### Documentation
630641

631642
1. **The documentation site gains the REST Automation guide, and the references follow.** `docs/guides/rest-automation.md`
File renamed without changes.

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,4 @@ PyCharm: use interpreter type **uv** pointing at the project `.venv`, and set
361361

362362
## License
363363

364-
Apache 2.0 — see [LICENSE.txt](LICENSE.txt).
364+
Apache 2.0 — see [LICENSE](LICENSE).

‎pyproject.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version = "4.12.30"
88
description = "Lightweight Event-over-HTTP function host and client for Mercury Composable"
99
readme = "README.md"
1010
license = "Apache-2.0"
11-
license-files = ["LICENSE.txt"]
11+
license-files = ["LICENSE"]
1212
authors = [{ name = "Accenture Technology" }]
1313
requires-python = ">=3.11"
1414
dependencies = [
@@ -92,7 +92,7 @@ only-include = [
9292
"extensions",
9393
"README.md",
9494
"CHANGELOG.md",
95-
"LICENSE.txt",
95+
"LICENSE",
9696
]
9797

9898
[tool.ruff]

‎tests/test_packaging.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""The package manifest names files that exist.
2+
3+
The build does not fail when a ``license-files`` pattern or an entry of the source
4+
distribution's list matches no file: it publishes the distributions without that file. A
5+
renamed license file then leaves the package with no license text, and nothing says so.
6+
These tests fail in that case.
7+
"""
8+
9+
import tomllib
10+
from pathlib import Path
11+
from typing import Any
12+
13+
ROOT = Path(__file__).resolve().parent.parent
14+
15+
16+
def _manifest() -> dict[str, Any]:
17+
return tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))
18+
19+
20+
def test_every_license_file_pattern_matches_a_file() -> None:
21+
patterns: list[str] = _manifest()["project"]["license-files"]
22+
assert patterns, "pyproject.toml names no license file"
23+
unmatched = [pattern for pattern in patterns if not any(ROOT.glob(pattern))]
24+
assert unmatched == [], f"license-files patterns that match no file: {unmatched}"
25+
26+
27+
def test_every_entry_of_the_source_distribution_exists() -> None:
28+
entries: list[str] = _manifest()["tool"]["hatch"]["build"]["targets"]["sdist"]["only-include"]
29+
absent = [entry for entry in entries if not (ROOT / entry).exists()]
30+
assert absent == [], f"entries of the source distribution that do not exist: {absent}"

0 commit comments

Comments
 (0)