Parameter loader turns __pycache__ directories into parameter nodes
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
Línea de trabajo
Read policyengine_core/parameters/parameter_node.py, focusing on the subdirectory branch and the existing EXCLUDED_PARAMETER_CHILD_NAMES checks. Reproduce the issue with a parameter directory containing __pycache__ or a hidden subdirectory, then check the parameter tree excludes both. A linked pull request (#637) is already open.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
ParameterNode(directory_path=...) makes every subdirectory of a parameter directory a child node. EXCLUDED_PARAMETER_CHILD_NAMES in policyengine_core/parameters/parameter_node.py already lists __pycache__, but only the YAML-file branch and the inline-data branch check it. The subdirectory branch does not, so a __pycache__ directory becomes an empty <directory>.__pycache__ node.
Python writes __pycache__ into a parameter directory whenever that directory is also a Python package that gets imported. The loaded parameter tree therefore depends on whether bytecode has been written to disk.
Effect
policyengine-us 2.2.1 has six parameter directories that hold only an __init__.py and CSV files, and US variable modules import them:
gov.hhs.medicaid.geographygov.hud.fmrgov.hud.income_limitsgov.hud.payment_standardsgov.states.fl.doe.sr.rates.reimbursementgov.states.tx.twc.ccs.payment.rates_expanded_age_groups
Without bytecode caches, each of these nodes has no children. With caches, each has one empty __pycache__ child. policyengine.py skips parameter nodes with no children, so its US parameter-node count changes by 6 depending on whether the caches exist: 28,559 without them and 28,565 with them, measured with policyengine-us 2.2.1 and policyengine-core 3.33.3.
The Public API's v2 catalog takes its parameter nodes from policyengine.py. Its exact-count integration test (tests/integration/test_v2_catalog_installed.py) reports 29,361 parameter nodes on macOS with PYTHONDONTWRITEBYTECODE=1 and 29,367 elsewhere. The count follows the files on disk, not the environment variable: once caches have been written, for example by pip install's bytecode compilation or an earlier run, PYTHONDONTWRITEBYTECODE=1 still gives the higher count.
Hidden directories have the same problem. A .ipynb_checkpoints directory inside a parameter directory loads copies of the YAML files next to it as extra parameters, under names that are not valid dotted paths.
Expected
The loaded parameter tree should not depend on bytecode caches or on hidden tool directories. Subdirectories named __pycache__, and hidden subdirectories, should not become parameter nodes.
- Lenguaje dominante
- Python
- Estrellas
- 22
- Forks
- 30
- Merge medio
- 4 d 20 h
- PR fusionados (30 d)
- 26
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PolicyEngine/policyengine-core
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
PolicyEngine/policyengine-core#605 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PolicyEngine/policyengine-core#549 ·
Los mantenedores suelen responder en 2 días
-
`restore_simulation` silently drops memberless group entitiesPosiblemente ocupada @Adelagric la tomó hace 57 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PolicyEngine/policyengine-core#547 ·
Los mantenedores suelen responder en 2 días
-
A reform applied after holders exist leaves them on the old variable, so a variable's default depends on who else is in the simulationPosiblemente ocupada @MaxGhenis la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
PolicyEngine/policyengine-core#644 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
PolicyEngine/policyengine-core#636 ·
Los mantenedores suelen responder en 2 días
Todos los issues de PolicyEngine/policyengine-core
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
strawberry-graphql/strawberry#4794 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dataforgoodfr/cetolog#21 ·
-
security_citations_test fails against ecc 2026.11.6: SECURITY.md quotes ecc v2026.11.2's linesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
btclib-org/btclib#2932 ·
Los mantenedores suelen responder en 1 día
-
metrics priority: medium
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
LearningCircuit/local-deep-research#8336 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100