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 constraints.txt support #128

Merged
merged 6 commits into from
Oct 1, 2022
Merged

Conversation

bmw
Copy link
Contributor

@bmw bmw commented Sep 29, 2022

Fixes #125

Copy link
Member

@neersighted neersighted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs a test to make sure that we raise an exception when an editable dependency is exported in constraints.txt mode

src/poetry_plugin_export/exporter.py Show resolved Hide resolved
@Secrus
Copy link
Member

Secrus commented Sep 29, 2022

While we are here, I think it could be a good idea to do a small refactor and extract some base Exporter class which all export formats would inherit from. Without it, we can quickly fall into a hellhole of messy code when we try to add yet another format to the mix. That however could be out of scope and might be better suited as a separate task.

@neersighted
Copy link
Member

While we are here, I think it could be a good idea to do a small refactor and extract some base Exporter class which all export formats would inherit from. Without it, we can quickly fall into a hellhole of messy code when we try to add yet another format to the mix. That however could be out of scope and might be better suited as a separate task.

We used to have something like that -- but for now, this simpler approach with method dispatch looks preferable to me. An ABC exporter that each format extends definitely makes sense if we ever go beyond pip's two 'txt' formats (e.g. a Pipfile.lock or something).

tests/test_exporter.py Outdated Show resolved Hide resolved
@neersighted
Copy link
Member

I've pushed two commits that amend your code to rearrange the exporter more in-line with the prior code, as well as to add a test for editable exports in constraints.txt format properly throwing

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 1, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@neersighted neersighted merged commit 371c334 into python-poetry:main Oct 1, 2022
@bmw
Copy link
Contributor Author

bmw commented Oct 3, 2022

Thanks for helping to see this through!

(Sorry for my lack of editable mode tests. I swear I tested a setup similar to what you did and it didn't work for me but I must have been mistaken.)

@metasyn
Copy link

metasyn commented Oct 15, 2022

Thanks for adding this! I ran into this exact issue today and was very pleased to see this already addressed 🎉

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.

Allow exporting constraints for pip
4 participants