python-poetry / python-poetry/poetry
poetry sync (editable mode) doesn't handle/allow custom *.pth files
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
Issue Kind
Brand new capability
Description
The wheel build via poetry build includes custom *.pth files, but they are not installed in editable mode, and there doesn't seem to be an option to enforce this (also couldn't find anything in the source that might do it).
Code references for editable wheel build (which is later installed to the virtualenv):
- https://github.com/python-poetry/poetry-core/blob/eee84d755cf3ac4573efa552cec283d4e7f8758e/src/poetry/core/masonry/builders/wheel.py#L127-L146
- it creates a
$PROJECT.pth-file linking the "editable" packages (actually their base directory, i.e. the "src" folder from the source) into the virtualenv (this works for finding*.pyfiles, but not*.pth) - _build() doesn't do anything with the wheel in editable mode
- _copy_file_scripts() only installs script files into a data/scripts subfolder.
- dist-info / metadata is a subfolder too
- it creates a
Impact
I use *.pth-files to initialize the environment; this is an application and is always installed in its own virtualenv, so there is no downside, but it makes life much easier.
Workarounds
With hatch instead of poetry I can install *.pth-files using [tool.hatch.build.targets.wheel.force-include].
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in poetry-core's src/poetry/core/masonry/builders/wheel.py, especially the editable wheel build references in _build() and _copy_file_scripts(). Compare how custom *.pth files are included by poetry build with the editable path, then determine how editable installation should preserve those files. Done means custom *.pth files are installed in editable mode as well as in the regular wheel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100