Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax constraint on env_prefix when reading from environment #145

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

mougams
Copy link
Contributor

@mougams mougams commented Jul 7, 2022

Reading parameters from environment is a great feature, but user
can sometimes want to not have any prefix when reading environement
variables.
This patch introduces another parameter named empty_env_prefix,
that if set to True, will initialize env_prefix to None, and hence unlock
what has been described above.

Copy link
Member

@mauvilsa mauvilsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please add a v4.11.0 (2022-07-??) section in the changelog with two entries, one in Added describing the new feature and another like

Deprecated
^^^^^^^^^^
- ``logger`` property will no longer accept ``None`` in v5.0.0.

jsonargparse/core.py Outdated Show resolved Hide resolved
jsonargparse/core.py Outdated Show resolved Hide resolved
jsonargparse/core.py Outdated Show resolved Hide resolved
jsonargparse/core.py Outdated Show resolved Hide resolved
jsonargparse_tests/test_actions.py Outdated Show resolved Hide resolved
jsonargparse/deprecated.py Outdated Show resolved Hide resolved
@mauvilsa mauvilsa added the enhancement New feature or request label Jul 8, 2022
@mougams mougams requested a review from mauvilsa July 8, 2022 16:13
jsonargparse/actions.py Outdated Show resolved Hide resolved
jsonargparse_tests/test_core.py Outdated Show resolved Hide resolved
jsonargparse_tests/test_deprecated.py Outdated Show resolved Hide resolved
jsonargparse_tests/test_deprecated.py Outdated Show resolved Hide resolved
jsonargparse_tests/test_deprecated.py Outdated Show resolved Hide resolved
jsonargparse_tests/test_core.py Outdated Show resolved Hide resolved
jsonargparse_tests/test_core.py Show resolved Hide resolved
jsonargparse_tests/test_core.py Outdated Show resolved Hide resolved
Reading parameters from environment is a great feature, but user
can sometimes want to not have any prefix when reading environment
variables.
This patch updates the property env_prefix to accept boolean,
so that if set to True, if won't prefix the read environment variables.
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@mougams
Copy link
Contributor Author

mougams commented Jul 11, 2022

All tests/checks pass. But I'm not sure to understand why Windows 2019 test fail with

ModuleNotFoundError: No module named 'jsonargparse'

Copy link
Member

@mauvilsa mauvilsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now all looks good. The failing tests are due to the changes I did and not related to this pull request.

@mauvilsa mauvilsa merged commit 51fc52b into omni-us:master Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants