-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
use existing function convert_deps_to_pip, added 2 params to convert_… #5077
use existing function convert_deps_to_pip, added 2 params to convert_… #5077
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a small test case together with the code?
@oz123 I'm struggling to find an instance were the pipfile.lock is mocked for a test? Any suggestions? |
@fraser-langton You don't really need to mock the Pipfile.lock right, you can just write out a file that is a valid Pipfile.lock and the current tests do that by doing a Alternatively you could generate a lock file locally and write that to a file at the start of your test and generate the requirements from that to test. |
@matteius I'm blind 🤦♂️ I was looking in the wrong directory. Thanks! |
@fraser-langton can you merge latest main branch into your branch and resolve the merge conflict? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding that test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case added for git requirement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All you need is to rebase the branch and you are done! Thanks for the contribution!
…quirements` (pypa#5071) * Print `-e` option and path for editable package * Reduce depth for logical complexity * Add news fragment
* Remove crayons usage from exceptions.py Replace all crayon color with appropriate `click.style` calls.
NamedTemporaryFile was introduced in Python 3.4. We only support Python 3.7+, hence this goes away.
Earlier versions of Python had Mapping in ``collections``. All versions after 3.4 moved Mapping to ``collections.abc`` Since we only support version 3.7+ we can drop this.
pathlib was introduced after Python3.5. We now only support Python3.7+, hence we don't need compat here.
This function is a nice to have alias for one line of code. Also, it uses OrderedDict, which is no longer needed. `dict`s after Python3.6 are guaranteed to be ordered (bonus: dict is faster than ordered dict). If we really want, we can also import it from zipp or python finder.
The former is simply a copy paste of `click.echo`. Since `click` has a much larger user base, it is likely to correct all bugs on all OSes faster.
* vendor in requirementslib==1.6.4 * add news fragment.
@oz123 Think I did correctly :) |
You are almost there @fraser-langton -- There is still a merge conflict that must be resolve with pipenv/cli/command.py -- Probably rebase was not the way to go but merging in the latest main, because now its showing a all the latest changes from main in this PR, which is confusing. Either way, the conflicting file remains. |
@fraser-langton you'll have to restart all over again. I am sorry... It could be that the logic of :
Should be implemented in pipenv/pipenv/utils/dependencies.py Line 246 in f73e76c
That way, the PR we merged earlier can be integrated in a nicer way with yours. |
@fraser-langton You may just want to make a new branch off the latest main and cherry-pick in all of your commits up until the rebase, but consider that there is the conflict to resolve and as @oz123 mentions this other change to fix editable installs for that command -- |
echo(crayons.normal("".join([req_name, value["version"], *hashes]))) | ||
deps.update(lockfile['develop']) | ||
|
||
pip_deps = convert_deps_to_pip(deps, r=False, include_index=False, with_hashes=hash, with_markers=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also tried like PR #5071 to resolve it, but there is a much better code. 😅
I will try my best to make a great code like you. 😎
But there is an error in this part. It needs to be fixed.
pip_deps = convert_deps_to_pip(deps, r=False, include_index=False, include_hashes=hash, include_markers=False)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoyaaaa what's the error?
@fraser-langton I created a new PR to fix the conflict issue. I think this gets the original intent of your code. |
closed with #5083 |
running pipenv requirements with the below example dependency will fail
"exmple-repo": {
"editable": true,
"git": "ssh://git@bitbucket.org/code/exmaple-repo.git",
"ref": "cc858e89f19bc0dbd70983f86b811ab625dc9292"
}
Fix
Use the exisiting
pipenv.utils.dependencies.convert_deps_to_pip
function with some added parameters to output the requirements, remove parsing of file inpipenv.cli.command.requirements
itselfThe checklist
news/
directory to describe this fix with the extension.bugfix
,.feature
,.behavior
,.doc
..vendor
. or.trivial
(this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.Fixes #5076