Skip to content

Do not shadow Python standard-library modules (#246) - #415

Open
Sriram-Nambiar wants to merge 1 commit into
openzim:mainfrom
Sriram-Nambiar:issue-246-do-not-shadow-stdlib
Open

Sriram-Nambiar wants to merge 1 commit into
openzim:mainfrom
Sriram-Nambiar:issue-246-do-not-shadow-stdlib

Conversation

@Sriram-Nambiar

Copy link
Copy Markdown
Contributor

Closes #246

Overview

Renames internal modules that shadowed Python standard-library module names (html, types, typing, logging, rewriting/html), and re-enables Ruff rule A005 in pyproject.toml.

As Per the plan outlined in #246, this is a breaking change intended for the next major release, so no backward-compatibility shims or re-exports are provided.


Renamed Modules

All files were renamed with git mv to preserve git commit history:

Old Path New Path Rationale
zimscraperlib/html.py zimscraperlib/html_parsing.py Contains HTML parsing helpers (find_title_in, find_language_in)
zimscraperlib/types.py zimscraperlib/content_types.py MIME-type definitions and mappings
zimscraperlib/typing.py zimscraperlib/custom_types.py Protocols and custom type definitions
zimscraperlib/logging.py zimscraperlib/log_setup.py Logger setup and configuration (getLogger)
zimscraperlib/rewriting/html.py zimscraperlib/rewriting/html_rewriting.py HTML URL rewriting (avoids shadowing stdlib html)
zimscraperlib/rewriting/js.py zimscraperlib/rewriting/js_rewriting.py Renamed for consistency with html_rewriting
zimscraperlib/rewriting/css.py zimscraperlib/rewriting/css_rewriting.py Renamed for consistency with html_rewriting

Key Changes

  1. Source & Imports:
    • Updated internal imports across src/zimscraperlib/ (including zimscraperlib/__init__.py).
  2. Tests:
    • Renamed corresponding test modules and directories (tests/html_parsing/, tests/content_types/, tests/custom_types/, tests/log_setup/, tests/rewriting/) and updated test imports.
  3. Configuration:
    • Removed "A005" from [tool.ruff.lint] ignore in pyproject.toml.
  4. Changelog:

Verification

  • Type Checker: hatch -e qa run check-type (pyright) ➔ Passed (0 errors, 0 warnings)

This branch has not been deployed

No deployments
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.

[next major] Do not shadow Python standard-library module

1 participant