Batu Lab NotesPractical developer guides

Treat a license filename as a signal, not legal advice

By Batu ยท English technical notes

Also published in our Blogger archive.

Direct answer

A filename scan can report that a project root contains a file named LICENSE; it cannot establish what rights the file grants or whether it matches bundled code. Path.is_file() is enough for the narrow observation. The example does not call read_text, which keeps the signal about the name and file type instead of making an unqualified claim about legal content.

The edge case is an empty, outdated, or incompatible file. All of those still satisfy the filename check, so the stdout explicitly says suitability is not evaluated. That wording prevents a green-looking checklist item from being read as legal advice.

This convention does not recognize COPYING, license files in subdirectories, or a symlink policy. A project may choose to support those names, but the report should list the exact names it checks. Seek qualified legal review for licensing decisions; a filesystem observation is not a substitute.

Complete example

from pathlib import Path
from tempfile import TemporaryDirectory

with TemporaryDirectory() as directory:
    root = Path(directory)
    (root / "LICENSE").write_text("example text", encoding="utf-8")
    signal = (root / "LICENSE").is_file()
    assert signal
    assert (root / "LICENSE").name == "LICENSE"
    print("license_file=yes suitability=not-evaluated")

Expected stdout:

license_file=yes suitability=not-evaluated

Sources

- pathlib documentation

Prepared with AI assistance. The example uses synthetic data; its stated limits apply.