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

remove circular dependency on export plugin #5980

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dimbleby
Copy link
Contributor

@dimbleby dimbleby commented Jul 9, 2022

The circular dependency has been bothering me for a while, but #6441 was the nudge to do something about it.

poetry should not depend on the plugin: the plugin should depend on poetry.

This means that docs that talk about poetry export arguably don't belong here at all: but mostly they already say "this is actually provided by poetry-plugin-export" so I've just beefed that up slightly.

I'm about to find out what I've broken in the github workflows by removing this dependency...

@finswimmer
Copy link
Member

I'm courious how this should work. IIRC removing the plugin essentially means removing the export command from the default installation. This is something we really like to do in the future, but for now this would be a breaking change.

@dimbleby
Copy link
Contributor Author

dimbleby commented Jul 9, 2022

Sure, people who want poetry export will need to install the plugin themselves.

If we want poetry export to be a default command: then move it back in-tree in this repository. But if we want it to be a plugin, then let's treat it as a plugin.

@dimbleby
Copy link
Contributor Author

I can see we're going to need consensus here... somehow.

While we're thinking about disentangling these two projects, here are some more thoughts.

I'd be inclined to transfer the bits of export-specific code that linger in this repository over to the plugin entirely. That is: get_project_dependency_packages(), and its children in the call graph.

That would allow deleting the horrid cross-repository github workflow, making it much easier to make fixes to the export function.

It would also make it easier to add enhancements if the export plugin was more involved in walking the dependency tree eg python-poetry/poetry-plugin-export#91 would like access to information that is known inside that code.

To be clear, I don't intend to do any of that any time soon. But this seems as good a place as any to dump some notes.

@radoering
Copy link
Member

Is this PR still a possibility?

Short-term: no. Mid-term: maybe. See #8562

@johnthagen
Copy link
Contributor

Would it be possible to remove the circular dependency but still install the plugin by default? Being able to have Poetry interact with pip through requirements.txt files is still a really nice default feature to have. For example, tools like nox-poetry depend on this:

Not having to install a plugin for this kind of functionality (especially since it's a different workflow based on if you are using pipx or not, warnings about Windows, etc) would be convenient if at all possible.

@johnthagen
Copy link
Contributor

Idea: Could the export plugin be an extras? So that a user could install it with pipx in a single convenient command with:

pipx install poetry[export-plugin]

@radoering
Copy link
Member

I don't think an extra changes much. We still have a circular dependency (only if the extra is used but nevertheless...). I think a general solution for plugins that are required for a specific project as demanded in #5729 might make more sense. It looks like there is already a POC for project plugins: #5740. Maybe, someone picks this up.

@johnthagen
Copy link
Contributor

Okay, wow yes #5729 / #5740 would be a really great way to solve this issue! The specific challenge that this PR will introduce for us is a bootstrapping problem. Whenever we share a Poetry project with another developer, they already need to:

  1. Install pipx
  2. Install Poetry
  3. Use the project (Poetry/nox etc.)

Now we'd need to inform them that they need to:

  1. Install pipx
  2. Install Poetry
  3. Install the export plugin
  4. Use the project (Poetry/nox etc)

We've found that these bootstrapping type steps are fraught with developers making small mistakes and thus, we actually avoid Poetry plugins more than we otherwise would because getting them installed everywhere correctly is tricky to document and get everyone to manually install.

Hope this feedback is useful!

@xylar
Copy link

xylar commented Apr 16, 2024

I'm still in favor of eliminating this circular dependency but I just wanted to point to my comment here:
#6441 (comment)
It seems we can handle circular dependencies in conda packages, it's just a little awkward.

@dimbleby dimbleby force-pushed the no-export-plugin branch 2 times, most recently from 9d05cb2 to 0e974c9 Compare May 25, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/needs-consensus Consensus among maintainers required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet