Skip to content

Refactor: remplacement d'imports relatifs#5441

Merged
vincentporte merged 4 commits into
masterfrom
vp/fix_import
Jan 22, 2025
Merged

Refactor: remplacement d'imports relatifs#5441
vincentporte merged 4 commits into
masterfrom
vp/fix_import

Conversation

@vincentporte
Copy link
Copy Markdown

@vincentporte vincentporte commented Jan 21, 2025

🤔 Pourquoi ?

  • uniformisation des imports avec leur chemin absolu
  • mise à jour des règles de ruff dans pyproject.toml

🚨 À vérifier

Mettre à jour le CHANGELOG_breaking_changes.md > NON

Copy link
Copy Markdown
Contributor

@tonial tonial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a plusieurs from ..utils qui pourraient être remplacés aussi en from itou.utils

@vincentporte
Copy link
Copy Markdown
Author

ok pour faire une PR pour toutes.
108 résultats en recherchant from . ^^

@tonial
Copy link
Copy Markdown
Contributor

tonial commented Jan 21, 2025

Je pense pas que les from . qui tapent dans le même module soient problématiques, et les from .. autres que from ..utils de sont des imports dans le module itou.openid_connect donc c'est bon pour moi

@xavfernandez
Copy link
Copy Markdown
Contributor

Si on veut faire cela. ruff le fait très bien avec:

diff --git a/pyproject.toml b/pyproject.toml
index f64382c1f..8aa971abd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,6 +12,7 @@ select = [
     "W",  # pycodestyle warnings
     "I",  # isort
     "UP",  # pyupgrade
+    "TID",  # flake8-tidy-imports
 ]
 
 [tool.ruff.lint.isort]
@@ -19,6 +20,9 @@ combine-as-imports = true
 known-first-party = ["itou"]
 lines-after-imports = 2
 
+[tool.ruff.lint.flake8-tidy-imports]
+ban-relative-imports = "all"
+
 [tool.djlint]
 profile="django"
 ignore="H006,H014,H017,H023,H030,H031,T002,T003"

a priori.
(et ruff check --fix --unsafe-fixes pour qu'il tente de faire les modifs comme un grand)

@vincentporte vincentporte requested a review from tonial January 22, 2025 09:14
@vincentporte vincentporte added this pull request to the merge queue Jan 22, 2025
Merged via the queue into master with commit 95624d3 Jan 22, 2025
@vincentporte vincentporte deleted the vp/fix_import branch January 22, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants