Skip to content

Modernize packaging, tooling and drop Python 2 support#43

Open
jotelha wants to merge 1 commit into
masterfrom
2026-06-12-claude
Open

Modernize packaging, tooling and drop Python 2 support#43
jotelha wants to merge 1 commit into
masterfrom
2026-06-12-claude

Conversation

@jotelha

@jotelha jotelha commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Drops Python 2 / legacy compatibility shims, modernizes packaging metadata, switches linting from flake8 to ruff, and fixes a few latent bugs surfaced along the way. All six CI matrix versions (3.8–3.13) pass tests + lint; this was validated locally with act and a successful python -m build.

Bugs fixed

  • pyproject.toml license referenced a nonexistent LICENSE file (the file is LICENSE.rst), which could break source builds / metadata. Now bundled correctly into built artifacts.
  • write_config_value_to_file set 0o700 permissions (the magic int 33216) despite documenting "600 permissions"; now sets 0o600 via stat constants.
  • Migrated deprecated datetime.utcnow() / datetime.utcfromtimestamp() to timezone-aware equivalents. utils.timestamp() now treats naive datetimes as UTC and accepts timezone-aware datetimes (behavior preserved).

Removals

  • Python 2 import shims (urlparse, importlib_metadata, pkg_resources fallbacks).
  • Runtime dependency on setuptools — version discovery now uses stdlib importlib.metadata, restoring the dependency-free promise.
  • Stale CI configs (.travis.yml, appveyor.yml), redundant requirements.txt and setup.cfg.

Tooling / packaging

  • Added requires-python = ">=3.8"; moved pytest config into pyproject.toml.
  • Replaced flake8 with ruff (config in pyproject.toml, lint optional-deps group, .pre-commit-config.yaml); rewrote 40× raise(Error())raise Error().
  • Updated tox.ini (py38–py313, lint) and the GitHub Actions test workflow (ruff step, .[test,lint] install).
  • Refreshed README supported-versions line, CHANGELOG ([Unreleased]), .gitignore, and CLAUDE.md.

Notes

  • Includes a CLAUDE.md (repo guidance file); happy to drop it if out of scope.
  • Type hints + py.typed were intentionally left for a separate, focused PR.

🤖 Generated with Claude Code

@jotelha jotelha requested a review from tjelvar-olsson June 12, 2026 10:07
Re-applies the PR #43 modernization on top of the current master, which
has since adopted the flit_scm build system (PR #42). Keeps flit; layers
on the source/tooling cleanups that master does not yet have.

Bugs:
- write_config_value_to_file set 0o700 permissions despite documenting
  0o600; now sets 0o600 via stat constants
- migrate deprecated datetime.utcnow()/utcfromtimestamp() (including the
  new freeze_with_manifest code) to timezone-aware equivalents;
  utils.timestamp() treats naive datetimes as UTC and accepts aware ones

Removals:
- Python 2 import shims (urlparse, importlib_metadata fallbacks)
- redundant requirements.txt (tox.ini no longer references it)

Tooling:
- replace flake8 with ruff (config in pyproject, lint extra,
  .pre-commit-config.yaml); rewrite raise(Error()) -> raise Error()
  throughout, including the raise() added by PR #42
- update tox (py39..py314, lint) and the GitHub Actions workflow
  (ruff step, .[test,lint] install)
- super(Cls, self) -> super(); drop (object) base classes
- refresh README supported-versions, CHANGELOG, .gitignore; add CLAUDE.md

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jotelha jotelha force-pushed the 2026-06-12-claude branch from b084b4b to 8cfe782 Compare June 16, 2026 08:29
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