Parameter loader turns __pycache__ directories into parameter nodes
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 22
- Fork
- 30
- Merge trung bình
- 4 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PolicyEngine/policyengine-core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PolicyEngine/policyengine-core#605 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PolicyEngine/policyengine-core#549 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
`restore_simulation` silently drops memberless group entitiesCó thể đã có người làm @Adelagric đã nhận 56 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PolicyEngine/policyengine-core#547 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
A reform applied after holders exist leaves them on the old variable, so a variable's default depends on who else is in the simulationCó thể đã có người làm @MaxGhenis đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
PolicyEngine/policyengine-core#644 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
PolicyEngine/policyengine-core#636 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của PolicyEngine/policyengine-core
Issue tương tự
-
community enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Hochfrequenz/sapgui.mcp#1039 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
didi/helixharness#18 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
API /search : typer la réponseĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
dataforgoodfr/democracy-watch#46 · 1 reaction ·