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

Improve editable installs #2360

Merged
merged 3 commits into from
Apr 29, 2020
Merged

Improve editable installs #2360

merged 3 commits into from
Apr 29, 2020

Conversation

sdispater
Copy link
Member

@sdispater sdispater commented Apr 27, 2020

Pull Request Check List

Resolves: #730
Resolves: #2079
Resolves: #2126
Resolves: #2225
Resolves: #2324

  • Added tests for changed code.
  • Updated documentation for changed code.

This PR improves and makes proper use of the EditableBuilder.

This change affects the install command in two ways:

  • The root project will now be installed much faster by no longer relying on generating a setup.py file.
  • The Poetry packages that needs to be installed in editable mode, via Poetry, will also skip the setup.py step.

For the details of how it's done:

  • It creates a .pth file in the site-packages (purelib) directory of the current environment which points to the absolute path of the current project.
  • It creates a .dist-info directory with the INSTALLER, METADATA, RECORD and entry_points.txt files.
  • It creates the appropriate console scripts (entry points).

I took this opportunity to improve the installed packages detection by improving the detection of the purelib directory which was not so trivial after all.

@sdispater sdispater added kind/bug Something isn't working as expected area/installer Related to the dependency installer area/venv Related to virtualenv management labels Apr 27, 2020
@sdispater sdispater added this to the 1.1 milestone Apr 27, 2020
@sdispater sdispater requested a review from a team April 27, 2020 19:03
@PetterS
Copy link
Contributor

PetterS commented May 5, 2020

@sdispater @abn

The latest Poetry on develop now fails (when running poetry install) on my code base for my editable install with the following message:

  AttributeError

  'Package' object has no attribute 'build_script'

  at /usr/local/lib/python3.6/dist-packages/poetry/packages/dependency_package.py:18 in __getattr__
      14|     def clone(self):  # type: () -> DependencyPackage
      15|         return self.__class__(self._dependency, self._package.clone())
      16|
      17|     def __getattr__(self, name):
    > 18|         return getattr(self._package, name)
      19|
      20|     def __setattr__(self, key, value):
      21|         if key in {"_dependency", "_package"}:
      22|             return super(DependencyPackage, self).__setattr__(key, value)

Perhaps related to this PR?

Poetry does not print the full stack trace so I don't have more information than this.

@sdispater
Copy link
Member Author

@PetterS Thanks for pointing this out.

I stumbled upon this issue this week-end myself and I already have a fix for it that I need to test before making a pull request.

I'll let you know when it's ready.

@PetterS
Copy link
Contributor

PetterS commented May 5, 2020

Cheers! 👍

Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/installer Related to the dependency installer area/venv Related to virtualenv management kind/bug Something isn't working as expected
Projects
None yet
3 participants