Skip to content

🐛 Implement get_env_var_option() method - #109

Merged
juftin merged 9 commits into
juftin:mainfrom
valentinoli:patch-6
Aug 20, 2026
Merged

🐛 Implement get_env_var_option() method#109
juftin merged 9 commits into
juftin:mainfrom
valentinoli:patch-6

Conversation

@valentinoli

@valentinoli valentinoli commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Add get_env_var_option method to retrieve environment variable values.

The get_env_var_option() method in Hatch's EnvironmentInterface does not replace dash with underscore in the PLUGIN_NAME. This is problematic as providing options via environment variable for "pip-compile" environments (type: "pip-compile") must be done via HATCH_ENV_TYPE_PIP-COMPILE_<option> (notice the dash).

See pypa/hatch#2397

Add get_env_var_option method to retrieve environment variable values.
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.23%. Comparing base (6f31e5a) to head (dd4f180).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
+ Coverage   92.16%   92.23%   +0.07%     
==========================================
  Files          14       14              
  Lines         893      902       +9     
  Branches       76       76              
==========================================
+ Hits          823      832       +9     
  Misses         40       40              
  Partials       30       30              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Refactor environment variable retrieval to handle different Hatch versions.
Added a test for the `get_env_var_option` method to verify environment variable handling.
Add type ignore comments for PLUGIN_NAME assignments.
Add a comment explaining the workaround for PLUGIN_NAME.
@valentinoli

Copy link
Copy Markdown
Contributor Author

@juftin hey 👋🏽 this PR us ready for review

@valentinoli

valentinoli commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@juftin I would appreciate if this gets fixed soon as variables containing a dash are currently not made available in Hatch

For instance, the below variable is not exposed:

[tool.hatch.envs.default.env-vars]
"HATCH_ENV_TYPE_PIP-COMPILE_UV_PATH" = "{root:real}/scripts/uv"

And I need to use an environment variable here as the uv-path option does not support context formatting.

@juftin
juftin merged commit 5053a34 into juftin:main Aug 20, 2026
21 checks passed
@juftin

juftin commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Merged. Thanks for the patience, I got delayed on vacation in Hawaii due to a hurricane and just got home.

github-actions Bot added a commit that referenced this pull request Aug 20, 2026
# [v1.11.8](v1.11.7...v1.11.8) (2026-08-20)

## 🐛 Bug Fixes
- [`5053a34`](5053a34)  Implement &#x60;get_env_var_option()&#x60; method (#109) (Issues: [`#109`](#109))

[skip ci]
@juftin

juftin commented Aug 20, 2026

Copy link
Copy Markdown
Owner

🎉 This PR is included in version 1.11.8 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@valentinoli
valentinoli deleted the patch-6 branch August 20, 2026 23:42
@valentinoli

Copy link
Copy Markdown
Contributor Author

Merged. Thanks for the patience, I got delayed on vacation in Hawaii due to a hurricane and just got home.

That was quick! Thank you for the release 😍
Good to know you got home !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants