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 basic poetry support #12

Merged
merged 5 commits into from Apr 20, 2022
Merged

Conversation

nikolaik
Copy link
Contributor

This builds on the Pipfile checking support and adapts it to support poetry dependencies in pyproject.toml.

I manage projects using a mix of different package management tools pip (requirements.txt), pipenv and poetry, so having one tool to support them all would be a time saver for me.

Comment on lines 147 to 154
for key, val in dependencies:
if key == 'python':
continue

if type(val) is str:
if val == "*":
continue
results.append(f"{key}=={val}")
Copy link
Owner

Choose a reason for hiding this comment

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

in a pyproject.toml file, see example

the val can be a string or dict-like object. I think the logic in load_pipfile still applies.

I would remove checking the python as a key since this can be done in the pcufile config.

According to the example aforementioned, we should add the caret in the get_current_version() function so that it can handle splitting the dependency name and version string.

   name, current_version = [token for token in re.split(r"[><=~!]", dep) if token]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @zehengl thanks for looking at my PR so fast. I tried to address your comments. Do they look ok to you? I left in the filtering of python dependency, since it's something all poetry pyproject.tomls have.

Do you want me to add a few tests with actual requirements files too?

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for changes. LGTM 👍

Copy link
Owner

Choose a reason for hiding this comment

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

BTW, feel free to add tests on a different PR. That's also on my todo list but I don't have time to work on it yet. Appreciate your contribution!

@zehengl zehengl merged commit 78f2e3a into zehengl:main Apr 20, 2022
@zehengl
Copy link
Owner

zehengl commented Apr 20, 2022

@all-contributors please add @nikolaik for code

@allcontributors
Copy link
Contributor

@zehengl

I've put up a pull request to add @nikolaik! 🎉

@nikolaik nikolaik deleted the feature/support-poetry branch April 27, 2022 20:21
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