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

Allow root package non-editable installation #5174

Closed
wants to merge 5 commits into from

Conversation

rszamszur
Copy link

Pull Request Check List

Partially Resolves: #1382 (Implemented --no-editable for install command)

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

If --no-editable flag is present, use SdistBuilder as a builder, build setup.py, then finally run pip_install utility method without deps and without editable mode.

I did some manual tests by trying to install back and forth with and without editable mode, which at first glance seems to work. However, after installing in editable mode again, the package directory (.venv/lib/python3.x/site-packages/package_name) seems still to exists but it's empty:

$ $ poetry run poetry install --no-editable
...
$ tree ../../.venv/lib/python3.9/site-packages/demo/
../../.venv/lib/python3.9/site-packages/demo/
├── cli
│   ├── cli.py
│   ├── commands
│   │   ├── __init__.py
│   │   └── __pycache__
│   │       └── __init__.cpython-39.pyc
│   ├── conftest.py
│   ├── __init__.py
│   └── __pycache__
│       ├── cli.cpython-39.pyc
│       ├── conftest.cpython-39.pyc
│       └── __init__.cpython-39.pyc
├── __init__.py
├── __main__.py
├── __pycache__
│   ├── __init__.cpython-39.pyc
│   ├── __main__.cpython-39.pyc
│   └── version.cpython-39.pyc
└── version.py
$ $ poetry run poetry install
...
$ tree ../../.venv/lib/python3.9/site-packages/demo/
../../.venv/lib/python3.9/site-packages/demo/
├── cli
│   ├── commands
│   │   └── __pycache__
│   └── __pycache__
└── __pycache__

It doesn't break the installation, but I just wanted to point that out. Lastly, the *.pth file is cleaned correctly.

@rszamszur
Copy link
Author

Regarding the poetry update command. It'll probably need some logic to update the project if it was installed with --no-editable.
The first idea that comes to my mind is to detect that automatically. If PACKAGE_NAME.pth file does not exists under VENV_PATH/lib/python3.x/site-packages/ directory then reinstall, else do nothing. What do you think?

Have a good one!

@finswimmer
Copy link
Member

Hello @rszamszur,

thanks a lot for your contribution. We really appreciate it.

I believe what you are trying to implement will be available via https://github.com/python-poetry/poetry-bundle-plugin in the future.

fin swimmer

@abn
Copy link
Member

abn commented Mar 5, 2022

The generation of setup.py is a deprecated feature and is something that will be dropped in future releases. As mentioned above there will be a few different paths which will allow similar use cases. Bundle plugin being one of those options, outside of that there is also a possibility that core will be lock file aware (eg: python-poetry/poetry-core#83) allowing install of locked poetry projects from source via pip (or any PEP-517 front end) in a target environment (particularly useful in container builds).

Alternatively, I could see poetry install [--distribution | --no-editable] or similar enabled via a wheel build followed by a call to the installer instead of the editable install it does today.

Note that any such feature will need to handle the scenario where the current project becomes editable by virtue of the source being in the current directory as this will get added to sys.path. This means, even if a project is installed without being editable, it may still behave as such.

@neersighted
Copy link
Member

Closing this for now because it has a design that is not compatible with the current direction of the rest of the project -- I would suggest checking out the resources linked above and opening an issue to discuss any shortcomings they may have if they don't suffice for your use-case.

@neersighted neersighted closed this Jun 4, 2022
Copy link

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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build and install the root package as a wheel in one invocation
4 participants