Cyclic imports between app/desktop/server/core flagged by pylint (R0401)

Aperta
#42 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Run pylint src/profiles to list the cyclic-import warnings. Read AGENTS.md for the boundary rule, then inspect app.py and profiles/__init__.py as hubs. Extract server bootstrap from app.py and keep core/config/models.py free of imports. Done means pylint src/profiles reports zero R0401 without new lazy-import workarounds.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

code-quality tech-debt

pylint src/profiles reports 16 cyclic-import warnings rooted in profiles.app reaching into every layer while those layers (or their shared models) are also imported transitively from it. Representative chain:

profiles -> profiles.app -> profiles.desktop.lifecycle -> profiles.server.app
         -> profiles.server.routes.scan -> profiles.core.processing.scanner
         -> profiles.core.config.service -> profiles.core.config.matcher
         -> profiles.core.config.models

It works today because the cycles close on import-order luck (module-level imports at the bottom of app.py, lazy imports elsewhere), but it violates the AGENTS.md boundary rule ("Aucune dépendance circulaire entre modules") and makes refactoring fragile.

Likely levers:

  • app.py is the hub: extract the server bootstrap wiring (routes needing server_state, static mount, port discovery) into a dedicated bootstrap module so app.py only calls it, instead of importing route modules transitively.
  • core.config.models is imported by everything including app — keep it dependency-free (the cycle enters through service/matcher chains).
  • Consider making profiles/__init__ (which resolves __version__) not import subpackages.

Acceptance: pylint src/profiles reports zero R0401 without new import-outside-toplevel workarounds beyond the documented lazy imports.

Lingua principale
Python
Stelle
1
Fork
1
Merge medio
4h 46m
PR unite (30g)
55

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di falbany/ProFiles

Tutte le issue di falbany/ProFiles

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.