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

Requirements Refactor (ready to merge, after conflict resolution) #1962

Merged
merged 17 commits into from May 24, 2018

Conversation

@techalchemy
Copy link
Member

@techalchemy techalchemy commented Apr 12, 2018

Full refactor of requirements parsing

  • See commits
@@ -108,7 +109,7 @@ def test_convert_from_pip(expected, requirement):
),
])
def test_convert_from_pip_vcs_with_extra(expected, requirement):
assert pipenv.utils.convert_deps_from_pip(requirement) == expected
assert pipenv.requirements.PipenvRequirement.from_line(requirement).as_pipfile() == expected

This comment has been minimized.

@uranusjr

uranusjr Apr 12, 2018
Member

You can merge this feature into DEP_PIP_PAIRS to make sure the new parser can catch the extra part.

This comment has been minimized.

@techalchemy

techalchemy Apr 12, 2018
Author Member

Not sure I'm following -- all tests are passing

This comment has been minimized.

@uranusjr

uranusjr Apr 12, 2018
Member

nvm I’ll just push the change here.

@techalchemy techalchemy force-pushed the techalchemy:feature/requirements-refactor branch from 8fd9501 to 4aa5a49 Apr 20, 2018
@techalchemy techalchemy force-pushed the techalchemy:feature/requirements-refactor branch 4 times, most recently from 693242f to 1467f50 Apr 23, 2018
@altendky
Copy link
Contributor

@altendky altendky commented Apr 23, 2018

@techalchemy, thanks for the help on IRC. This seems to be working to solve my issue (local -e . install causing remote vcs link in Pipfile.lock causing a request that failed due to being a private repo and pip not being able to get the password from me... phew). Now I can get started writing my tests. :] maybe...

@techalchemy
Copy link
Member Author

@techalchemy techalchemy commented Apr 25, 2018

@ncoghlan I've been sitting on this refactor for awhile, to summarize it essentially provides a compatibility layer between pipenv/pipfile style requirements and pip-style requirements. I wrote it in frustration when I had to fix a bug with the current codebase which breaks anytime someone touches it.

I've been contemplating breaking this into a library of its own, which I did with the last thing I had an idea like this for (https://github.com/techalchemy/pythonfinder) to allow for potential expansion independent of pipenv -- the API looks something like this:

>>> req = PipenvRequirement.from_line(requirement)
>>> req.as_pipfile()
{'req': {'key': 'value'}}

>>> req = PipenvRequirement.from_pipfile(name, index, {'key': 'value', 'key2': 'value2'})
>>> req.as_line()
-e asdf.whatever#egg=name

The object itself offers access to hashes, index, name, vcs, etc just depending on what type of requirement you pass. Check out requirements.py if you want, review if you have time, but general thoughts always appreciated

Will be around on synchronous communication for another hour or two => slack/irc/fb if you have anything general

@ncoghlan
Copy link
Member

@ncoghlan ncoghlan commented Apr 25, 2018

@techalchemy Breaking out low level building blocks to make them easier to compose independently seems like a good idea to me. (As one example: it would be cool if pip-compile could accept Pipfile as input directly, and this would be a useful stepping stone towards enabling that)

@techalchemy techalchemy force-pushed the techalchemy:feature/requirements-refactor branch 4 times, most recently from 00e932a to cb156b9 May 10, 2018
@kennethreitz42
Copy link
Contributor

@kennethreitz42 kennethreitz42 commented May 20, 2018

@techalchemy you have the authority to merge your own PRs

@kennethreitz42
Copy link
Contributor

@kennethreitz42 kennethreitz42 commented May 23, 2018

Please resolve merge conflicts.

@kennethreitz42 kennethreitz42 changed the title Requirements Refactor Requirements Refactor (ready to merge, after conflict resolution) May 23, 2018
techalchemy added 13 commits Apr 12, 2018
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
- Leverage functionality where possible to avoid rework

Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
- Also update patch for pip

Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
@techalchemy techalchemy force-pushed the techalchemy:feature/requirements-refactor branch from 95e850e to c154350 May 24, 2018
techalchemy added 3 commits May 24, 2018
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
Signed-off-by: Dan Ryan <dan@danryan.co>
@techalchemy techalchemy merged commit e41c065 into pypa:master May 24, 2018
2 checks passed
2 checks passed
buildkite/pipenv Build #187 passed (8 minutes, 10 seconds)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@techalchemy techalchemy deleted the techalchemy:feature/requirements-refactor branch May 24, 2018
@techalchemy techalchemy moved this from Done to Needs Changelog in 2018.06.x Release Jun 16, 2018
@techalchemy techalchemy moved this from Needs Changelog to Done in 2018.06.x Release Jun 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.