|
| 1 | +--- |
| 2 | +name: Regression report |
| 3 | +about: Report for something that used to work but doesn't anymore |
| 4 | +title: '' |
| 5 | +labels: bug |
| 6 | +assignees: '' |
| 7 | +--- |
| 8 | + |
| 9 | +<!-- If you like this project, please ⭐ star it https://github.com/omni-us/jsonargparse/ --> |
| 10 | + |
| 11 | +## 🕰️ Regression report |
| 12 | + |
| 13 | +<!-- A clear and concise description of the regression. --> |
| 14 | + |
| 15 | +### To reproduce |
| 16 | + |
| 17 | +<!-- |
| 18 | +Please include a code snippet that reproduces the regression. Make sure that it |
| 19 | +is a script that can be used to run git bisect. This means that when code works |
| 20 | +correctly, the script terminates with zero exit code. When it fails an exception |
| 21 | +is raised. The following snippet templates might help. Replace "..." with actual |
| 22 | +implementation details. |
| 23 | +
|
| 24 | +1. a) Using the auto_cli function |
| 25 | +
|
| 26 | +```python |
| 27 | +#!/usr/bin/env python3 |
| 28 | +
|
| 29 | +from jsonargparse import auto_cli |
| 30 | +
|
| 31 | +# Here define one or more functions or classes |
| 32 | +def func1(param1: int, ...): |
| 33 | + ... |
| 34 | +
|
| 35 | +# Run the CLI providing the components and arguments |
| 36 | +auto_cli( |
| 37 | + [func1, ...], |
| 38 | + args=["--param1=value1", ...], |
| 39 | + exit_on_error=False, |
| 40 | +) |
| 41 | +``` |
| 42 | +
|
| 43 | +1. b) Manually constructing a parser |
| 44 | +
|
| 45 | +```python |
| 46 | +#!/usr/bin/env python3 |
| 47 | +
|
| 48 | +from jsonargparse import ArgumentParser |
| 49 | +
|
| 50 | +parser = ArgumentParser(exit_on_error=False) |
| 51 | +# Here add to the parser only argument(s) relevant to the problem |
| 52 | +
|
| 53 | +# If a config is required, it can be included in the same snippet as follows: |
| 54 | +import json |
| 55 | +
|
| 56 | +parser.add_argument("--config", action="config") |
| 57 | +config = json.dumps( |
| 58 | + { |
| 59 | + "key1": "val1", |
| 60 | + } |
| 61 | +) |
| 62 | +
|
| 63 | +# If the problem is when parsing arguments |
| 64 | +result = parser.parse_args([f"--config={config}", "--key2=val2", ...]) |
| 65 | +
|
| 66 | +# If the problem is in class instantiation |
| 67 | +parser.instantiate_classes(result) |
| 68 | +``` |
| 69 | +
|
| 70 | +2. Preferably, run git bisect and include in the report the git commit hash that |
| 71 | +caused the regression. This would be like: |
| 72 | +
|
| 73 | +``` |
| 74 | +chmod +x regression.py # make script executable |
| 75 | +pip3 install -e . # install as editable |
| 76 | +git bisect start |
| 77 | +git bisect bad <version-tag-latest> |
| 78 | +git bisect good <version-tag-known-good> |
| 79 | +git bisect run ./regression.py |
| 80 | +``` |
| 81 | +--> |
| 82 | + |
| 83 | +### Prior behavior |
| 84 | + |
| 85 | +<!-- Please describe the prior behavior in detail, and contrast it with the behavior you are currently observing. --> |
| 86 | + |
| 87 | +### Environment |
| 88 | + |
| 89 | +<!-- Fill in the list below. --> |
| 90 | + |
| 91 | +- jsonargparse version: |
| 92 | +- Python version: |
| 93 | +- How jsonargparse was installed: |
| 94 | +- OS: |
0 commit comments