Skip to content

Release 2.1.0: bug fixes, CLI, and Trusted Publishing with provenance - #3

Merged
johanbeytell1 merged 6 commits into
mainfrom
arena/b2a526eb-localsitemap
Nov 18, 2026
Merged

johanbeytell1 merged 6 commits into
mainfrom
arena/b2a526eb-localsitemap

Conversation

@johanbeytell1

Copy link
Copy Markdown
Member

LocalSiteMap 2.1.0

Prepares the next release: a round of bug fixes, a new CLI, modern packaging, and a
Trusted Publishing release pipeline with verified provenance.

Bug fixes

Area Bug Fix
Exclusions A site checked out below a folder named like an exclusion (e.g. media) had every URL excluded, because matching ran against the absolute path Rules are resolved relative to the site root; the root itself can never be excluded
URLs Names with spaces, #, &, ? or non-ASCII produced invalid, uncrawlable <loc> values Every path segment is percent-encoded (my page.html → my%20page.html)
Extensions PAGE.HTML was silently skipped, allowed_extensions=["txt"] etc. handled inconsistently Case-insensitive matching, leading dot optional, multi-dot names supported
Priority maps Documented keys such as "blog/" never matched, and ".PHP" didn't apply to .php Keys are normalised (trailing slash, Windows separators, extension case)
Validation Missing root_path, base_url="example.com" and max_urls=0 wrote broken/empty sitemaps Clear NotADirectoryError/ValueError; max_urls above 50 000 is clamped; priorities clamped to 0.00–1.00
Reproducibility Output order followed filesystem order; duplicate <loc> possible Entries sorted and de-duplicated
Splitting Shrinking a site left orphaned sitemap_N.xml parts; truncated files on interruption Stale parts removed, output written atomically, missing output dirs created
Performance minidom round-trip rewrote the whole document in memory and emitted blank lines Streaming writer (6 300 URLs in ~0.2 s) with a single XML declaration

New

  • localsitemap CLI / python -m localsitemap (exclusions, extensions, priorities, JSON priority map).
  • Glob exclusions (draft-*, *.bak), plus exclude_hidden, include_homepage, sort_entries.
  • generate_sitemap() returns the files it wrote.
  • 37 tests (up from 7) covering encoding, exclusions, priority mapping, splitting, determinism and the CLI.

Packaging & release pipeline

  • Metadata moved to pyproject.toml (PEP 621, PEP 639 license expression); version read from localsitemap/_version.py; setup.py kept as a shim.
  • Requires Python 3.9+, since the modern build backend (setuptools>=77, needed for the non-deprecated license metadata) requires it. 2.0.0 still serves 3.6–3.8 automatically via pip.
  • build_and_publish.yml now publishes with PyPI Trusted Publishing (id-token: write, no password/token, no environment: key — the PyPI publisher is configured with a blank environment) and signs every file with PEP 740 attestations (attestations: true).
  • A verify-provenance job queries the PyPI Integrity API after upload and fails the release if any published file has no provenance, so the PyPI provenance indicator (and the new README badge) is always accurate.
  • New tests.yml workflow: ruff lint, Python 3.9–3.14 on Linux + Windows, and a build/install smoke test.
  • The workflow file name is unchanged (build_and_publish.yml) so existing tag pushes keep working.

Release checklist for the maintainer

  1. Configure the PyPI trusted publisher for localsitemap: repository Infinitode/LocalSiteMap, workflow build_and_publish.yml, environment left blank.
  2. Merge this PR.
  3. git tag 2.1.0 && git push origin 2.1.0 — the workflow builds, tests, publishes and verifies provenance.

johanbeytell1 and others added 6 commits November 18, 2026 11:46
Fixes:
- resolve exclusions against the site root so a site below a folder that
  matches an exclusion (e.g. 'media') is no longer wiped out
- percent-encode URLs (spaces, '#', '&', non-ASCII) so sitemaps are valid
- match extensions case-insensitively and never treat 'x.html.bak' as HTML
- honour documented priority keys such as 'blog/' and '.PHP'
- validate root_path/base_url/max_urls, clamp priorities to 0.00-1.00
- sort and de-duplicate entries for reproducible output
- drop stale split parts and write output atomically
- replace the minidom round-trip with a fast streaming XML writer

New:
- localsitemap CLI (also 'python -m localsitemap')
- glob exclusions, exclude_hidden, include_homepage, sort_entries options
- generate_sitemap() now returns the list of written files

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Metadata now lives in pyproject.toml (PEP 621 + PEP 639 license
expression) and the version is read from localsitemap/_version.py, so the
release workflow no longer has to sed setup.py. setup.py is kept as a
compatibility shim. Python 3.9+ is required to build; 3.6-3.8 remain
served by 2.0.0.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- build job: run the tests, derive the version from the tag, build and
  twine-check the distributions, then upload them as artifacts
- publish job: no API token and no 'environment:' key, only
  'id-token: write', using pypa/gh-action-pypi-publish with attestations
- new verify-provenance job queries the PyPI Integrity API and fails the
  release if any published file lacks provenance
- add a tests workflow (lint, 3.9-3.14 matrix on Linux plus Windows, and
  a build/install smoke test)

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Manual 'Run workflow' executions now only build and validate the
distributions, so the pipeline can be exercised safely before the PyPI
trusted publisher is configured.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@johanbeytell1
johanbeytell1 merged commit 19c22db into main Nov 18, 2026
9 checks passed
@johanbeytell1
johanbeytell1 deleted the arena/b2a526eb-localsitemap branch November 18, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant