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 creation of "pre-install" script #9140

Open
lilian-delouvy opened this issue Mar 11, 2024 · 3 comments
Open

Allow creation of "pre-install" script #9140

lilian-delouvy opened this issue Mar 11, 2024 · 3 comments
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@lilian-delouvy
Copy link

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".

@lilian-delouvy lilian-delouvy added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Mar 11, 2024
@dimbleby
Copy link
Contributor

duplicate #2496

@lilian-delouvy
Copy link
Author

@dimbleby I am not sure it is. If I'm not mistaken, PoeThePoet, and other elements discussed in #2496, describe scripts that would work after running "poetry install" at least once, which resolves dependencies and creates a virtual environment if necessary. I'm talking about a pre-install script, e.g a script that we could run right before the "poetry install" command, when the dependencies have not yet been resolved by Poetry.
In my example, I believe the kind of scripts described in #2496 would not work, as the local packages would not have been processed yet.

@dimbleby
Copy link
Contributor

yes, this is a duplicate.

eg one of the poe-the-poet examples is

tunnel     = { shell = "ssh -N -L 0.0.0.0:8080:$PROD:8080 $PROD &" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants