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

bpo-44388: Update venv EnvBuilder.ensure_directories() docs. #26663

Merged
merged 3 commits into from
Jul 2, 2021
Merged

bpo-44388: Update venv EnvBuilder.ensure_directories() docs. #26663

merged 3 commits into from
Jul 2, 2021

Conversation

itsayellow
Copy link
Contributor

@itsayellow itsayellow commented Jun 11, 2021

Ref: https://bugs.python.org/issue44388

This changes the documentation for EnvBuilder.ensure_directories(env_dir) to match the actual behavior of that API call.

In particular, ensure_directories() is not affected by the state of the upgrade attribute, and will not cause an error to have existing directories whether or not the clear attribute is set.

This documentation change I believe should be valid to all python versions back to 3.6.

https://bugs.python.org/issue44388

Automerge-Triggered-By: GH:vsajip

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@itsayellow

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir labels Jun 11, 2021
Creates the environment directory and all necessary subdirectories that
don't already exist, and returns a context object. This is just a
holder for attributes (such as paths), for use by the other methods.
Any existing environment directories will remain unaffected as long as
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest changing the sentence to:

If the :class:EnvBuilder is created with the arg clear=True, contents of the environment directory will be cleared and then all necessary subdirectories will be recreated.

-- this describes the effect of the method more fully and given the description, there is no reason for the reader to think that existing env dir and subdirs will be affected in any way.

Copy link
Contributor Author

@itsayellow itsayellow Jun 15, 2021

Choose a reason for hiding this comment

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

I can do that. 👍

I was erring on the side of explicitness, because this function looks like it has ability to write to the directory structure, and the thought of that worried me. If it were a purely information-gathering API function I think I would've left that part of the sentence out.

exist already, as long as either ``clear`` or ``upgrade`` were
specified to allow operating on an existing environment directory.
Creates the environment directory and all necessary subdirectories that
don't already exist, and returns a context object. This is just a
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're updating this paragraph, another minor improvement to clarity may be as follows, because otherwise it's not very clear what 'this' refers to (e.g. the method, the instance, ..?). To me it's easier to understand if it's rephrased:

Suggested change
don't already exist, and returns a context object. This is just a
don't already exist, and returns a context object, which is just a

Copy link
Contributor Author

@itsayellow itsayellow Jun 19, 2021

Choose a reason for hiding this comment

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

The only hesitation I have with this change is that the sentence gets pretty long with a bunch of commas / clauses.

Another simple fix which fix would just be to change This is just to This context object is just. A little explicit, but I like the fact that it results in two sentences with 2 comma-separated clauses instead of one long sentence with 4 comma-separated clauses.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, that was another option I've thought about. Both sound fine to me so if you prefer to keep 2 sentences, go ahead with that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did the two-sentence version and removed a comma after the parenthetical phrase that seemed superfluous to me.

@akulakov
Copy link
Contributor

I've added one other small comment. With that change, the patch looks good to me.

@vsajip can you also take a look?

@miss-islington
Copy link
Contributor

Sorry, I can't merge this PR. Reason: 3 of 5 required status checks are expected..

@miss-islington
Copy link
Contributor

@itsayellow: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 4bcef2b into python:main Jul 2, 2021
@itsayellow itsayellow deleted the venv-docs branch July 17, 2021 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants