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

Platform specific installs are not respected when using file with a url #5785

Closed
kaine-bruce-dmt opened this issue Jul 10, 2023 · 5 comments · Fixed by #5871
Closed

Platform specific installs are not respected when using file with a url #5785

kaine-bruce-dmt opened this issue Jul 10, 2023 · 5 comments · Fixed by #5871
Labels
Type: Bug 🐛 This issue is a bug.

Comments

@kaine-bruce-dmt
Copy link

kaine-bruce-dmt commented Jul 10, 2023

Issue description

The below entry in a Pipfile does not seem to be respected on Linux. I believe we have followed the correct syntax.

This is using our in-house package, as such I have redacted some parts.

I can privately share our pipenv support output if needed.

$ pipenv --version
pipenv, version 2023.7.9

Expected result

The package should be skipped on operating systems that are not Windows.

Actual result

On Ubuntu:
Screenshot 2023-07-10 142419

Steps to replicate

#Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
package_name= { sys_platform = "== 'win32'", file = "https://{REDACTED}.whl"}

[requires]
python_version = "3.10"
# cmd
pipenv install
@matteius
Copy link
Member

@kaine-bruce-dmt I got somewhere with this finally, if you want to take a look/try out the draft PR: #5871

@lewiswolf
Copy link

lewiswolf commented Aug 28, 2023

Not sure if this is fixed or not or if I'm missing something.

pip install "git+https://github.com/lewiswolf/graphs.git#egg=graphs"

Results in:

Installing git+https://github.com/lewiswolf/graphs.git#egg=graphs...
Resolving git+https://github.com/lewiswolf/graphs.git#egg=graphs...
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/cli/options.py", line 58, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/cli/command.py", line 209, in install
    do_install(
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/routines/install.py", line 255, in do_install
    added, cat, normalized_name = project.add_package_to_pipfile(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/project.py", line 1167, in add_package_to_pipfile
    name, normalized_name, entry = self.generate_package_pipfile_entry(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/project.py", line 1147, in generate_package_pipfile_entry
    entry["ref"] = vcs_parts[1].split("#", 1)[0].strip()

And without using #egg=...:

Installing git+https://github.com/lewiswolf/graphs.git...
Resolving git+https://github.com/lewiswolf/graphs.git...
⠋ Installing...INFO:pipenv.patched.pip._internal.vcs.git:Cloning https://github.com/lewiswolf/graphs.git to /var/folders/6w/mgc4qy2n69b8cc1nszttrrsr0000gn/T/tmpycprpo8n
INFO:pip.subprocessor:Running command git clone --filter=blob:none https://github.com/lewiswolf/graphs.git /var/folders/6w/mgc4qy2n69b8cc1nszttrrsr0000gn/T/tmpycprpo8n
INFO:pip.subprocessor:Cloning into '/var/folders/6w/mgc4qy2n69b8cc1nszttrrsr0000gn/T/tmpycprpo8n'...
⠼ Installing None...INFO:pipenv.patched.pip._internal.vcs.git:Resolved https://github.com/lewiswolf/graphs.git to commit 855109828a26129f513965f6b32f682744613e03
⠴ Installing None...Error: Traceback (most recent call last):
  File 
"/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/routines/inst
all.py", line 255, in do_install
    added, cat, normalized_name = project.add_package_to_pipfile(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/project.py", 
line 1167, in add_package_to_pipfile
    name, normalized_name, entry = self.generate_package_pipfile_entry(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/project.py", 
line 1114, in generate_package_pipfile_entry
    req_name = determine_package_name(package)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/local/Cellar/pipenv/2023.8.26/libexec/lib/python3.11/site-packages/pipenv/utils/depende
ncies.py", line 744, in determine_package_name
    raise ValueError(f"Could not determine package name from {package}")
ValueError: Could not determine package name from git+https://github.com/lewiswolf/graphs.git

✘ Failed adding package to Pipfile

@matteius
Copy link
Member

@lewiswolf I think the problem from your example is we handle either specifying a git repository without the egg, or we support it with the ref and and the egg, but you appear to not be suppling a ref, but just an egg. So for example: pip install "git+https://github.com/lewiswolf/graphs.git@main#egg=graphs"

@lewiswolf
Copy link

lewiswolf commented Aug 28, 2023

so the second example is expected behaviour also, i.e pipenv install "git+https://github.com/lewiswolf/graphs.git"?

Am getting the same result when using the command you specified also: ValueError: Could not determine package name from git+https://github.com/lewiswolf/graphs.git@master

Thanks!

@matteius
Copy link
Member

@lewiswolf Can you open a new issue report for your example, I think it has to do with the setup.py ast parser trying to get the name out of that setup.py example, but I cannot be sure and cannot look at it currently, but I also don't want it to get lost under the banner of a different issue report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants