Parameter values shared across Python class instances
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by locating the Python code generator and its tests for generated parameter classes; the issue does not name specific files. Check how the generated Param class declares parameter values and how instances are tested. Done means each new instance starts with independent parameter values, with a test covering that behavior.
Written by the indexing model from the issue text.
Description
I’m trying to create tests to verify the interaction of my software with the generate_parameter_library. I want to save the parameters to a file when they are updated in both Python and C++. The testes for the C++ version worked correctly, but in Python, I noticed an odd behaviour. The parameter values are shared across multiple instances. This resulted in the tests failing due to an inconsistent initial value. I expected a reset to parameter values when a new instance is created.
Looking at the generated code, I noticed the Param class doesn’t have an __init__(self) function and declares the parameters directly in the class body. This causes the parameters to be shared between instances. Is this the desired behaviour?
Adding the __init__(self) function and selfto the variables solved this. As a quick fix, I reloaded the entire module between each test.
If this is not intended, I can provide a pull request to solve this issue.
Auto generated code:
Expected generated code:
- Dominant language
- Python
- Stars
- 385
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PickNikRobotics/generate_parameter_library
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
PickNikRobotics/generate_parameter_library#392 · 2 comments ·
-
GCC 15 emits -Wfree-nonheap-object for generated string one_of validationPossibly taken @tylerjw claimed this 17 days ago. Open
PickNikRobotics/generate_parameter_library#389 · 1 comment · 1 assignee ·
-
Feature request: math in the yamlPossibly taken @tylerjw claimed this 17 days ago. Open
PickNikRobotics/generate_parameter_library#381 · 2 comments · 1 reaction · 1 assignee ·
-
Validator reference (bounds<>/element_bounds<> etc.) is hard to find inside the READMEPossibly taken @tylerjw claimed this 17 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
PickNikRobotics/generate_parameter_library#377 · 1 comment ·
All issues in PickNikRobotics/generate_parameter_library
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
aws-samples/sample-per-model-bedrock#243 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
FuRongJun-1999/dsh-memory#404 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
PennyLaneAI/catalyst#3337 ·
Maintainers usually reply within 1 day
-
Workflow.schedule stops when a cron deadline passes before sleepPossibly taken @HuaTNA claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day