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

Add '--exclude' option #255

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ownik
Copy link

@ownik ownik commented Jan 20, 2024

In my project I need to exclude a list of specified packages with their dependencies when exporting.
Then I use exported requirements.txt to install all exported deps and install a list of specified packages from whl files which were built locally in the same job.

Adding the exclude option solves my issue.

I hope it can be useful in other cases and will be integrated into the official release.

@ownik ownik force-pushed the exclude_opt branch 2 times, most recently from 7399348 to 0cdd5db Compare January 20, 2024 16:42
Copy link

sonarcloud bot commented Jan 20, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@dimbleby
Copy link
Contributor

sounds like you should be making use of either groups or extras, depending on what your use case is. I doubt that poetry export should introduce a third mechanism.

@ownik
Copy link
Author

ownik commented Jan 20, 2024

@dimbleby Thanks for your reply!

No, I can't use extras or groups.
Packages that I need to exclude have to be required by default when building whl of my project.

If dependency groups could be required, it also would help with my case.

@ownik
Copy link
Author

ownik commented Jan 20, 2024

Apparently PR also could solve this issue #40

poetry export -f requirements.txt --exclude black --exclude flake8 --output requirements.txt

@dimbleby
Copy link
Contributor

dimbleby commented Jan 20, 2024

#40 seems already to be solved by using groups

I cannot understand your use case. If you have dependencies that are definitely always required by your project, then an export that does not mention those dependencies does not make sense to me: it seems plainly to be a faulty export

Probably you would be better served by post-processing the exported requirements.txt, rather than trying to make poetry export the wrong thing.

@ownik
Copy link
Author

ownik commented Jan 23, 2024

@dimbleby

I have two Python packages: packageA and packageB. packageB is declared as a required dependency for packageA.

For local development of packageA, I use the latest version of packageB from a PyPI repository.

The poetry.lock file contains a link to the PyPI repository for packageB.

For building as a part of monorepo project, I need to exclude packageB with its dependencies during export and install packageB from previosly built whl.

I could use poetry remove packageB before poetry export, but the poetry remove command requires internet access and modifies files in the repository - neither of which is allowed there.

I solve this by processing poetry.lock in the temporally folder and after use poetry export on it.

Could you possibly provide me some suggestions for this case or post-processing only true way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants