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

Import/depend poetry packages #6209

Closed
2 tasks done
keriksson-rosenqvist opened this issue Aug 22, 2022 · 11 comments
Closed
2 tasks done

Import/depend poetry packages #6209

keriksson-rosenqvist opened this issue Aug 22, 2022 · 11 comments
Labels
kind/feature Feature requests/implementations

Comments

@keriksson-rosenqvist
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

I have a number of related packages, all stored locally and with their own individual pyproject.toml files. I would like to be able to set up a new pyproject.toml file in a separate directory and add them as imports or dependencies, pulling in all sub-dependencies etc. with them. I know I could achieve this by building wheels and installing, but I want this in my development environments and without having to build and install.

E.g.
Structure

.
├── package_a/
│   ├── pyproject.toml
│   ├── poetry.lock
│   └── src/
├── package_b/
│   ├── pyproject.toml
│   ├── poetry.lock
│   └── src/
├── pyproject.toml
└── poetry.lock

root pyproject.toml example

[tool.poetry]
# ...
packages = [
    { include = "package_a", from = "pyproject" },
    { include = "package_b", from = "pyproject" },
]

OR

[tool.poetry.dependencies]
# ...
package_a = { poetry = "./package_a" }
package_b = { poetry = "./package_b" }

@keriksson-rosenqvist keriksson-rosenqvist added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Aug 22, 2022
@dimbleby
Copy link
Contributor

dimbleby commented Aug 22, 2022

Did you really search the documentation?

https://python-poetry.org/docs/dependency-specification/#path-dependencies

@keriksson-rosenqvist
Copy link
Author

Did you really search the documentation?

https://python-poetry.org/docs/dependency-specification/#path-dependencies

So that is a path to a built package, I want it to load directly from the pyproject.toml/poetry.lock files and source code folder, without requiring to build the package.

@dimbleby
Copy link
Contributor

So that is a path to a built package

this is not true

@keriksson-rosenqvist
Copy link
Author

So that is a path to a built package

this is not true

I agree that it does not have to be, but in the case it is a directory, will all dependencies from the package pyproject.toml file also be installed? If so, this functionality is not clear from the documentation.

@dimbleby
Copy link
Contributor

why don't you try it?

@neersighted
Copy link
Member

A path dependency is simply a Python project at a given path. Poetry conforms to PEP 517 and will build any project according to the steps there (we should support any pyproject.toml build-system as well as setuptools, with any combination of pyproject.toml/setup.cfg/setup.py). Poetry never supports built distributions as a path dependency for myriad reasons.

I'm not sure the docs are really deficient here as I feel that this is a very obvious set of assumptions common across the ecosystem (that is to say, being 'pip compatible') -- but if you have suggested improvements, please open a PR.

@keriksson-rosenqvist
Copy link
Author

Still having issues getting the sub-package dev-dependencies installed. Can anyone help?

@dimbleby
Copy link
Contributor

if A depends on B and B has dev dependencies, then it's expected that installing A will not install B's dev dependencies.

@keriksson-rosenqvist
Copy link
Author

if A depends on B and B has dev dependencies, then it's expected that installing A will not install B's dev dependencies.

OK but this is exactly what I want to do. Kind of "fuse" my development environments so that I can run things like integration tests in a single environment.

@neersighted
Copy link
Member

neersighted commented Aug 23, 2022

Poetry dependencies do not have any special relationship with their dependees currently. If you're looking for a unified development environment across projects, you're likely looking for workspace/monorepo support as requested in #936.

You could 'fake' this in the mean time by sharing a venv between projects, but obviously that is a bit brittle and you will have to manage your own guarantees vis-a-vis order of operations and compatibility.

@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Sep 18, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue 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 Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

No branches or pull requests

4 participants