ag14774 / poetry-monoranger-plugin

A Poetry plugin to support monorepo setups for Python, enabling shared lockfiles and directory dependency pinning.
https://pypi.org/project/poetry-monoranger-plugin/
Apache License 2.0
20 stars 0 forks source link

Does not modify export command #28

Open jcassee opened 6 hours ago

jcassee commented 6 hours ago

When running poetry export, this is the output:

The lock file does not exist. Locking.
Running command from monorepo root directory
Updating dependencies
Resolving dependencies... (7.9s)

[Errno 2] No such file or directory: 'project_root/subproject/poetry.lock'

Does it make sense to also modify the export command?

ag14774 commented 6 hours ago

Currently it doesn't support the export command because I didn't personally have a use case for it but it would definitely make sense.

What behavior would you expect from poetry export? Export the root lockfile (so all dependencies of the repo) or select just the ones relevant for the current subproject in the repo?

jcassee commented 5 hours ago

Good question!

My use-case is the combination with nx.dev, and the nx-python plugin. It generates per-subproject lockfiles, even when using a shared virtual environment.

Selecting only the relevant dependencies would be purest, of course, but I'm already happy with just exporting the whole root lockfile.

ag14774 commented 5 hours ago

In that case, I think poetry export at the root of the repo should still work with no changes for exporting the whole root lockfile. I can try to get the exporting of relevant dependencies only in the near future

jcassee commented 4 hours ago

Indeed, that works, but the nx-python plugin runs it with in the subproject root and expects a lockfile there. (See the output in my first message.)

I do understand this is a pretty particular case. If you have pointers, I might also take a stab at it myself. I did look at the code, but could not understand it with just a casual glance.