python-poetry / python-poetry/poetry

Allow creation of "pre-install" script

Open
#9,140 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/triage
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
      • production_package_B
        • src
          • <some_code_files_that_use_local_package_B>
        • packages
          • local_package_B

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.