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

Support configuring -X frozen_modules=on|off using an environment variable. #111374

Closed
yilei opened this issue Oct 27, 2023 · 3 comments
Closed
Assignees
Labels
3.13 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@yilei
Copy link
Contributor

yilei commented Oct 27, 2023

Feature or enhancement

Proposal:

Most of the -X options (https://docs.python.org/3/using/cmdline.html#cmdoption-X) can be configured via an environment variable, but not -X frozen_modules.

This makes it harder for environments that you don't have the control over the flags passed to the Python interpreter.

#98697 also includes a use case for crossenv, but the issue was closed because it was not in time for Python 3.11.

I'm proposing a PYTHONFROZENMODULES PYTHON_FROZEN_MODULES environment variable to be added for Python 3.13, which has the equivalent meaning of using -X frozen_modules.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

#98697 is the same request, but closed due to not in time for Python 3.11.

Linked PRs

@yilei yilei added the type-feature A feature request or enhancement label Oct 27, 2023
@yilei yilei changed the title Support configuring frozen_module=on|off using an environment variable. Support configuring -X frozen_modules=on|off using an environment variable. Oct 27, 2023
@yilei
Copy link
Contributor Author

yilei commented Oct 27, 2023

Btw, I'll also send a PR, assuming this will be accepted.

@hugovk
Copy link
Member

hugovk commented Oct 28, 2023

I'm proposing a PYTHONFROZENMODULES environment variable to be added for Python 3.13, which has the equivalent meaning of using -X frozen_modules.

I'll let others review the PR, but if we do this, let's add underscores to the name:

  • PYTHON_FROZEN_MODULES

See https://discuss.python.org/t/change-environment-variable-style/35180?u=hugovk

@gpshead gpshead self-assigned this Oct 28, 2023
@gpshead gpshead added 3.13 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Nov 1, 2023
gpshead pushed a commit that referenced this issue Nov 1, 2023
… frozen_modules`. (#111411)

Adds a new PYTHON_FROZEN_MODULES env var to correspond with -X frozen_modules.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
FullteaR pushed a commit to FullteaR/cpython that referenced this issue Nov 3, 2023
…of `-X frozen_modules`. (python#111411)

Adds a new PYTHON_FROZEN_MODULES env var to correspond with -X frozen_modules.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@hugovk
Copy link
Member

hugovk commented Nov 9, 2023

Thank you for your contribution!

@hugovk hugovk closed this as completed Nov 9, 2023
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…of `-X frozen_modules`. (python#111411)

Adds a new PYTHON_FROZEN_MODULES env var to correspond with -X frozen_modules.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants