python-poetry / python-poetry/poetry
Allow creation of "pre-install" script
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
It would be great for Poetry to allow developers to implement a "pre-install" script. As of now, the scripts of Poetry are available after running "poetry install" once. Sometimes, users will need to run a script before running "poetry install", as the example below shows.
Impact
In our company, we use local packages references like the following in a pyproject.toml:
my_local_package = { path = "./packages/my_local_package", develop = true }
But our local package is not actually in the given path : we have to copy it beforehand. We did this so that production packages are decoupled from other parts of the code and only code that is being actively used by our production packages are on our docker images.
So we have something that looks like this:
- root_of_our_project
- packages
- local_package_A
- local_package_B
- local_package_C
- production
- production_package_A
- src
- <some_code_files_that_use_local_packages_A_and_C>
- packages
- local_package_A
- local_package_C
- src
- production_package_B
- src
- <some_code_files_that_use_local_package_B>
- packages
- local_package_B
- src
- production_package_A
- packages
Therefore, a step that we have to do before doing "poetry install" on our production packages is to copy our local packages in the related "packages" folders via bash scripts.
It would be great to add a "pre-install" script implementation system so that we could just run "poetry install" and the copy of packages would be done under the hood before actually installing.
Workarounds
We currently run a bash file that will do the copy before doing "poetry install".
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
The issue body describes a proposed pre-install script capability and the current bash workaround for copying local packages. Start by reviewing Poetry's existing install and script behavior, then define how a pre-install script would be configured and invoked; done should allow the package-copy step to run before dependency installation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100