openzim / openzim/python-scraperlib

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

Ouverte
#246 2 commentaires 0 réactions 1 personne assignée Voir sur GitHub

@benoit74 y travaille déjà.

Depuis le 20/1/2025.

enhancement
Langage dominant
Python
Étoiles
31
Forks
27
Merge moyen
3 j 7 h
PR mergées (30 j)
2

Description

Ruff / Flake8 has a new rule A005: https://docs.astral.sh/ruff/rules/stdlib-module-shadowing/

It is recommended to not shadow Python standard-library modules.

Currently, we have 5 issues:

src/zimscraperlib/html.py:1:1: A005 Module `html` shadows a Python standard-library module
src/zimscraperlib/logging.py:1:1: A005 Module `logging` shadows a Python standard-library module
src/zimscraperlib/rewriting/html.py:1:1: A005 Module `html` shadows a Python standard-library module
src/zimscraperlib/types.py:1:1: A005 Module `types` shadows a Python standard-library module
src/zimscraperlib/typing.py:1:1: A005 Module `typing` shadows a Python standard-library module

For now, I've disabled the rule A005 in https://github.com/openzim/python-scraperlib/pull/245 but we need to make a finer decision.

I think that logging module is shadowing "on-purpose" and might be allowed. Others could be considered for renaming. But I don't have very good suggestions of names, so I'm not 100% convinced, if we end-up with bad names, I'm not sure it really ease maintenance at all.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.