Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PEP 796: Relative Virtual Environments#4476

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
rickeylev wants to merge38 commits intopython:main
base:main
Choose a base branch
Loading
fromrickeylev:relative.venvs

Conversation

@rickeylev
Copy link

@rickeylevrickeylev commentedJun 30, 2025
edited
Loading

Basic requirements (all PEP Types)

  • Read and followedPEP 1 &PEP 12
  • File created from thelatest PEP template
  • PEP has next available number, & set in filename (pep-NNNN.rst), PR title (PEP 123: <Title of PEP>) andPEP header
  • Title clearly, accurately and concisely describes the content in 79 characters or less
  • Core dev/PEP editor listed asAuthor orSponsor, and formally confirmed their approval
  • Author,Status (Draft),Type andCreated headers filled out correctly
  • PEP-Delegate,Topic,Requires andReplaces headers completed if appropriate
  • Required sections included
    • Abstract (first section)
    • Copyright (last section; exact wording from template required)
  • Code is well-formatted (PEP 7/PEP 8) and is incode blocks, with the right lexer names if non-Python
  • PEP builds with no warnings, pre-commit checks pass and content displays as intended in the rendered HTML
  • Authors/sponsor added to.github/CODEOWNERS for the PEP

Standards Track requirements

  • PEP topicdiscussed in a suitable venue with general agreement that a PEP is appropriate
  • Suggested sections included (unless not applicable)
    • Motivation
    • Rationale
    • Specification
    • Backwards Compatibility
    • Security Implications
    • How to Teach This
    • Reference Implementation
    • Rejected Ideas
    • Open Issues
  • Python-Version set to valid (pre-beta) future Python version, if relevant
  • Any project stated in the PEP as supporting/endorsing/benefiting from the PEP formally confirmed such
  • Right before or after initial merging,PEP discussion thread created and linked to inDiscussions-To andPost-History

Work towardspython/cpython#136051


📚 Documentation preview 📚:https://pep-previews--4476.org.readthedocs.build/

jab, aignas, Vigilans, yan12125, vonschultz, groodt, Edward-Knight, and reneleonhardt reacted with heart emoji
@hugovk
Copy link
Member

Hello, before we go any further with this PR, has the idea been discussed on Discourse?

And after that we'll need a sponsor before assigning the PEP number, do you have one yet? Let's unassign 796 for now.

Please see:

@hugovkhugovk changed the titlePEP 796: relative virtual environments, initial draftPEP xxx: relative virtual environments, initial draftJun 30, 2025
@rickeylev
Copy link
Author

Thanks@hugovk and@StanFromIreland for the early review. I used a draft PR to see the CI results to further clean it up -- my apologies for wasting some of your time, but thank you regardless.

discussed on Discourse?

Yes:https://discuss.python.org/t/making-venvs-relocatable-friendly/96177

The criteria of "discussed enough with enough support" is vague, but what gave me enough confidence to begin a PEP and start a (draft) PR at this point was:

Sponsor needed to assign number

Thanks for clarifying that part! Yes, finding a sponsor is my next big step.

@hugovk
Copy link
Member

I used a draft PR to see the CI results to further clean it up

Tip: you can enable GitHub Actions athttps://github.com/rickeylev/peps/actions and run the CI on your fork.

Yes, finding a sponsor is my next big step.

Good luck!

rickeylev reacted with heart emoji

@paveldikov

This comment has been minimized.

@AA-Turner
Copy link
Member

@paveldikov thank you for the comment, please could you re-post it on Discourse? The peps repo / PR discussion is mainly for editorial discussion, rather than substantive comment on the proposal itself.

A

paveldikov reacted with thumbs up emoji

Copy link
Author

@rickeylevrickeylev left a comment

Choose a reason for hiding this comment

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

Thanks for the reviews! I'm out from under $dayJob and vacation backlogs a bit now and addressed comments.

Copy link
Member

@StanFromIrelandStanFromIreland left a comment

Choose a reason for hiding this comment

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

Some little notes

@ncoghlan
Copy link
Contributor

Belatedly removed the DO-NOT-MERGE label (that was added pending the Discourse discussion and sponsorship of the PEP)

Copy link
Member

@AA-TurnerAA-Turner left a comment

Choose a reason for hiding this comment

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

The PEP is currently missing aSecurity Implications section, which I think should be added given that arbitrary directory traversal is permitted -- at the very least explaining why this is fine.

Several editorial notes, I think the Motivation & Rationale sections should be strengthened to focus on the benefits from relative environments, there is currently (I believe) a lot of assumed context.

The PEP also discusses at some length a broader proposal for reloacatable venvs. Is it worth considering making that the proposal here? I don't know the specifics, so it might be that the changes needed for 'relocatable' are too large to tackle in one go.

A

ncoghlan reacted with thumbs up emoji
@AA-TurnerAA-Turner changed the titlePEP 796: relative virtual environments, initial draftPEP 796: Relative Virtual Environments [initial draft]Aug 18, 2025
rickeylevand others added2 commitsAugust 20, 2025 22:12
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Copy link
Author

@rickeylevrickeylev left a comment

Choose a reason for hiding this comment

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

Applied suggestions and addressed a few comments; didn't have time to address everything, though.

Copy link
Author

@rickeylevrickeylev left a comment

Choose a reason for hiding this comment

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

Ok, all pending comments addressed (I think. The Github UI frequently tricks me 😂 )

PTAL

re: security section: added. At least, insofar as I understand your concern correctly.

re: motivation and rationale strengthening: Thanks! Yeah, honestly, a big issue I've had writing this that "Motivation" and "Rationale" are, to me at least, practically synonyms. I did my best to better separate "Why do this change at all?" (motivation) and "Implementation decision and why that decision" (rationale).

re: proposing relocatable venv in this pep: I added a section about why this pep limits its scope to just the core interpreter.

@AA-TurnerAA-Turner added the new-pepA new draft PEP submitted for initial review labelSep 29, 2025
Copy link
Contributor

@ncoghlanncoghlan left a comment
edited
Loading

Choose a reason for hiding this comment

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

A few editorial comments inline, but I think this is essentially ready for publication.

During interpreter startup (i.e.:file:`getpath.py`), the relative path is joined to the
directory containing ``pyvenv.cfg`` to form an absolute path.
Parent-directory references (``../``) and current
directory references (``./``) are resolved syntactically (i.e. not resolving
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
directory references (``./``) are resolvedsyntactically (i.e. not resolving
directory references (``./``) are resolvedlexically (i.e. not resolving

(I don't mind if this isn't accepted, I've just always referred to this style of resolution as lexical rather than as syntactic:python/cpython#124825


This PEP does not specify how to create a ``pyvenv.cfg`` with a relative path,
nor how downstream tools (e.g. installers) should identify them or process
them. These questions are best addressed separately by tool owners.
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't an open issue, but rather than intentional omission. Perhaps just include a variant of this paragraph in the rationale subsection about not fully specifying portable virtual environments?

@hugovkhugovk changed the titlePEP 796: Relative Virtual Environments [initial draft]PEP 796: Relative Virtual EnvironmentsSep 30, 2025
machines do so either by relying on undocumented interpreter behaviour
(Bazel, omitting the ``home`` key entirely to trigger an implementation
dependent fallback to resolving via a symlinked interpreter binary on
non-Windows systems, see `gh-135773`) or by requiring a post-installation script to be executed
Copy link
Member

@hugovkhugovkSep 30, 2025
edited
Loading

Choose a reason for hiding this comment

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

Lint fix:

Alyssa's suggestion below is better.

Comment on lines +210 to +216
How to Teach This
=================

Teaching this should be straightforward: if you use a relative path in
``pyvenv.cfg``, then it's relative to the directory containing the
``pyvenv.cfg`` file. This is simple to explain and easy to understand for
anyone that is already familiar with handling relative filesystem paths.
Copy link
Member

Choose a reason for hiding this comment

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

It might be useful to saywhere you will teach this. What docs will you update?

paths.

A proof-of-concept of this is implemented in the author's branch,
`rickeylev/feat.relative.pyvenv.home<https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`rickeylev/feat.relative.pyvenv.home<https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__.
`rickeylev/feat.relative.pyvenv.home
<https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__.

Please could you also wrap some of the other long lines to 79 chars?

https://peps.python.org/pep-0012/#general

Copy link
Contributor

@ncoghlanncoghlan left a comment

Choose a reason for hiding this comment

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

I think these are the two items the PEP linter is picking up.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@ncoghlan
Copy link
Contributor

@rickeylev I went ahead and applied the straightforward markup & grammar fixes inae5a67f, so the remaining comments are the ones that aren't as simple to address.

@AA-Turner This will need a re-review from you at some point for the "Changes requested" flag.

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

Reviewers

@ncoghlanncoghlanncoghlan approved these changes

@hugovkhugovkhugovk left review comments

@zaniebzaniebzanieb left review comments

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

@AA-TurnerAA-TurnerAA-Turner requested changes

Assignees

No one assigned

Labels

new-pepA new draft PEP submitted for initial review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@rickeylev@hugovk@ncoghlan@paveldikov@AA-Turner@zanieb@StanFromIreland

[8]ページ先頭

©2009-2025 Movatter.jp