Skip to content

Conversation

@abravalheri
Copy link
Contributor

(Another PR of the PEP 660 series)

Summary of changes

  • Test symlinks in the target directory instead of temp dir
  • Update development mode docs
  • Allow users to specify SETUPTOOLS_ENABLE_FEATURE=legacy-editable

Closes

Pull Request Checklist

@abravalheri abravalheri marked this pull request as ready for review June 25, 2022 21:40
Copy link
Contributor

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

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

I found this document well-written and useful 🥰
Thank you

Editable installs are **not a perfect replacement for regular installs**
in a test environment. When in doubt, please test your projects as
installed via a regular wheel. There are tools in the Python ecosystem,
like :pypi:`tox` or :pypi:`nox`, that can help you with that.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a minor point, but doesn't tox use sdist by default and rely on a plugin for wheel?

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 think you don't exactly need a plugin to achieve that with tox...

It seems that the default behaviour is to build an sdist file and then use pip install... If that is the case, pip install will internally build a wheel in the final step before installing anyway. (The sdist creation can be forced to follow PEP 517 with the isolated_build config).

Additionally, a developer could use:

Maybe it would be good to confirm this behaviour with the tox developers.

Do you have any suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just complementing some words like tox (with appropriate configuration) and nox would fine for me.

BTW, what is an effective way to understand the difference between editable/wheel install, after I tried pip install . in my testing virtualenv?

Copy link
Contributor Author

@abravalheri abravalheri Jun 27, 2022

Choose a reason for hiding this comment

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

Thank you very much for the suggestions @kngwyu! I will add those in a follow up review.

BTW, what is an effective way to understand the difference between editable/wheel install, after I tried pip install . in my testing virtualenv?

Let's say your are creating a mypkg with a __main__.py module like the following:

# mypkg/__main__.py
print("hello world")

When you do pip install ., pip will create a wheel that will correspond to a "snapshot in time" of your package. So if later you change the print statement to print("hello universe") in your project folder, your package will still display the old message:

$ cd /tmp  # let's change the directory to avoid messing with PYTHONPATH
$ python -m mypkg
hello world

If you did an editable install instead pip install -e ., then it would display the updated message:

$ cd /tmp
$ python -m mypkg
hello universe

If you feel like the docs could improve, please feel free to add suggestions, they are always welcome!

@abravalheri
Copy link
Contributor Author

I found this document well-written and useful 🥰

Thank you very much for the kind words @kngwyu. Please feel free to add any suggestions.

(Also note that this PR is valid for the feature/pep660 branch. I plan to release this as beta for tests soon).

@abravalheri abravalheri merged commit e7f351b into pypa:feature/pep660 Jun 27, 2022
@abravalheri abravalheri deleted the editable-improvements branch June 27, 2022 19:53
@abravalheri
Copy link
Contributor Author

@kngwyu (and other members of the community), please feel free to add more suggestions. I am more then happy to address them in follow-up PRs.

edmorley added a commit to edmorley/setuptools that referenced this pull request Aug 17, 2022
PR pypa#3414 added support for disabling the new PEP660 editable install
hooks. However the documentation and changelog mentions didn't
match the implementation.

Before:
- The implementation used: `SETUPTOOLS_ENABLE_FEATURES`
- The changelog said to use: `SETUPTOOLS_ENABLE_FEATURE`
  (notice the missing "S")
- The docs said to use: `SETUPTOOLS_USE_FEATURE`

This caused confusion in pypa#3535, since the testcase there used the form
mentioned in the changelog, which doesn't do anything.

Now, the changelog and docs both say to use `SETUPTOOLS_ENABLE_FEATURES`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants