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

Implement support for markers specified for package dependencies in p… #188

Merged
merged 6 commits into from
Sep 21, 2021

Conversation

frenzymadness
Copy link
Collaborator

Fixes: #186

This introduces a breaking change

  • Yes
  • No

Needs to implement a test.

@sesheta sesheta requested a review from KPostOffice August 25, 2021 12:12
@frenzymadness frenzymadness marked this pull request as draft August 25, 2021 12:12
@sesheta sesheta added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 25, 2021
@sesheta sesheta added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 26, 2021
@frenzymadness
Copy link
Collaborator Author

The basic implementation is ready including some tests. I'd also like implement one more test with a combination of default and devel packages. Also, I have to check mypy issues.

@abompard
Copy link
Contributor

abompard commented Sep 13, 2021

Now I'm getting this traceback:

Traceback (most recent call last):
  File "/home/abompard/tmp/test-poetry/micropipenv.py", line 780, in install_poetry
    pipfile_lock = _poetry2pipfile_lock()
  File "/home/abompard/tmp/test-poetry/micropipenv.py", line 732, in _poetry2pipfile_lock
    if category[dependency_name].get("markers", None):
KeyError: 'twisted-iocpsupport'

I suppose it happens when the dependency appears in the lockfile after the package that depends on it.
I'm attaching my poetry.lock file (renamed to txt for github upload compatibility).

@sesheta sesheta added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 14, 2021
@frenzymadness
Copy link
Collaborator Author

I suppose it happens when the dependency appears in the lockfile after the package that depends on it.
I'm attaching my poetry.lock file (renamed to txt for github upload compatibility).

Thank you. I've fixed that and used that example as a new test. I've also tested that the micropipenv does not try to install the windows-only package.

Also, I've managed to fix mypy errors so unless we find more cases when this implementation does not work this should be ready for a review and merge.

@frenzymadness
Copy link
Collaborator Author

There is some problem on Windows, but it does not seem to be related to this change. It seems to be an issue with TemporaryDirectory in pytest_configure but I don't know any details.

@abompard
Copy link
Contributor

Yep, it works on my local machine too :-)

Copy link
Collaborator

@fridex fridex left a comment

Choose a reason for hiding this comment

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

Did a brief review - changes look good to me. I did not test them though (I do not use poetry that much). @frenzymadness if you think this is ready to be merged, I'm also in favour of giving green to this PR - the feedback is reasonable and the implementation looks well tested. The current release does not work properly, as reported.

@frenzymadness thanks for the great work 👍🏻
@abompard thanks for the support and feedback 👍🏻

@frenzymadness frenzymadness force-pushed the poetry_markers branch 2 times, most recently from 85a3f1a to bb2a400 Compare September 17, 2021 06:28
@frenzymadness frenzymadness marked this pull request as ready for review September 17, 2021 06:55
@sesheta sesheta removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 17, 2021
@frenzymadness
Copy link
Collaborator Author

In the last iteration, I've implemented parentheses so the final combined markers look for example like this: "(python_version < \"3.8\") or (python_version <= \"3.7\")".

@frenzymadness
Copy link
Collaborator Author

The link to the pre-commit test does not work 😞

@fridex
Copy link
Collaborator

fridex commented Sep 20, 2021

/test pre-commit

@harshad16
Copy link
Member

harshad16 commented Sep 20, 2021

Our ci is currently unable to show the error on the display, the error are the following:

Fix End of Files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/data/install/pipenv_env_vars_default/Pipfile.lock
Fixing tests/data/install/pipenv_vcs_editable/Pipfile.lock
Fixing tests/data/install/pipenv_env_vars/Pipfile.lock
Fixing tests/data/install/pipenv_iter_index/Pipfile.lock
Fixing tests/data/install/pipenv_editable/Pipfile.lock
Fixing tests/data/install/pipenv_file/Pipfile.lock
Fixing tests/data/install/pipenv_vcs/Pipfile.lock
Fixing tests/data/install/pipenv/Pipfile.lock

pydocstyle...............................................................Failed
- hook id: pydocstyle
- exit code: 1

micropipenv.py:169 in public function `normalize_package_name`:
        D400: First line should end with a period (not '3')
micropipenv.py:169 in public function `normalize_package_name`:
        D401: First line should be in imperative mood; try rephrasing (found 'Implementation')
tests/test_micropipenv.py:936 in public function `test_normalize_package_name`:
        D103: Missing docstring in public function

First error can be easily solved by running: pre-commit run --all-files
second error is from doc_string, please update the docstring for provided errors.

How to reproduce:
execute following command in the branch: pre-commit run --all-files

@frenzymadness
Copy link
Collaborator Author

Thanks for your help @harshad16! pre-commit is now happy at least on my machine.

Copy link
Collaborator

@fridex fridex left a comment

Choose a reason for hiding this comment

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

Changes look good to me. The addition seems to be well tested and already helped users. @frenzymadness happy to have this in, thanks for the great work 👍🏻

@sesheta
Copy link
Member

sesheta commented Sep 21, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fridex

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sesheta sesheta added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 21, 2021
@sesheta sesheta merged commit 4bde2d8 into thoth-station:master Sep 21, 2021
@fridex fridex mentioned this pull request Sep 21, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

poetry.lock [package.dependencies] markers not being respected
5 participants