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

build(python): Do not set environment variable on import #17101

Merged
merged 2 commits into from
Jun 22, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jun 20, 2024

Closes #16609

Not sure if this is an acceptable fix - feedback welcome.

I couldn't think of a good way to test this 🤔

@github-actions github-actions bot added build Changes that affect the build system or external dependencies python Related to Python Polars labels Jun 20, 2024
Copy link

codecov bot commented Jun 21, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.86%. Comparing base (8a6bf4b) to head (b8b079a).
Report is 12 commits behind head on main.

Files Patch % Lines
...ars-core/src/chunked_array/object/extension/mod.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #17101    +/-   ##
========================================
  Coverage   80.86%   80.86%            
========================================
  Files        1456     1456            
  Lines      191141   191313   +172     
  Branches     2728     2737     +9     
========================================
+ Hits       154562   154711   +149     
- Misses      36073    36096    +23     
  Partials      506      506            

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

@stinodego stinodego marked this pull request as ready for review June 21, 2024 07:19
std::env::var(env).unwrap_or_else(|_| {
panic!("env var: {env} must be set to allow extension types to be created",)
});
if !(std::env::var(env).is_ok() || POLARS_ALLOW_EXTENSION.load(Ordering::Relaxed)) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should swap the order of these. Loading the static is likely cheaper and is what we always do in python Polars. Otherwise we must always evaluate the second branch.

@ritchie46
Copy link
Member

1 comment. Other than that good. 👍

@ritchie46 ritchie46 merged commit 55cf111 into main Jun 22, 2024
26 checks passed
@ritchie46 ritchie46 deleted the allow-ext-atomic branch June 22, 2024 07:25
@stinodego stinodego changed the title build(python): Do not change environment on import build(python): Do not set environment variable on import Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Changes that affect the build system or external dependencies python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not change environment variables on import
2 participants