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

Relative file path in Pipfile being converted to Absolute file path in Pipfile.lock #5489

Closed
bendog opened this issue Nov 23, 2022 · 2 comments
Assignees
Labels
triage Type: Regression This issue is a regression of a previous behavior.

Comments

@bendog
Copy link

bendog commented Nov 23, 2022

Issue description

Using the file install method for Pipenv, we've run into an issue with a relative path being converted to an absolute path on locking. This prevents us from using the lock file to install from as the path will very from user to user.

I've tried changing the method of import, and I've tried removing the .lock file, but it still gets built at an absolute path.

pipenv, version 2022.9.24

Pipfile

himl = {file = "./lib/himl"}

Expected result

Expected result would be a portable lock file that references the location relatively

Pipfile.lock

        "himl": {
            "file": "./lib/himl",
            "version": "==0.5.4"
        },

Actual result

Pipfile.lock

        "himl": {
            "file": "file:///Users/username/dev/livemine-hole-information-service/hole-information-loader/lib/himl",
            "version": "==0.5.4"
        },

Steps to replicate

Given a Pipfile containing a relative file import.
When the user runs pipenv lock
Then the Pipfile.lock file generated converts the relative file location for an absolute file location for the machine it was run on.


$ pipenv --support

Pipenv version: '2022.9.24'

Pipenv location: '/opt/homebrew/Cellar/pipenv/2022.9.24/libexec/lib/python3.10/site-packages/pipenv'

Python location: '/opt/homebrew/Cellar/pipenv/2022.9.24/libexec/bin/python3.10'

OS Name: 'posix'

User pip version: '22.2.2'

user Python installations found:

  • 3.10.8: /opt/homebrew/bin/python3
  • 3.10.5: ~/.pyenv/versions/3.10.5/bin/python3
  • 3.10.1: ~/.pyenv/versions/3.10.1/bin/python3
  • 3.9.15: /opt/homebrew/bin/python3.9
  • 3.9.13: ~/.pyenv/versions/3.9.13/bin/python3
  • 3.9.6: /usr/bin/python3
  • 3.8.15: /opt/homebrew/bin/python3.8
  • 3.7.12: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin/python3
  • 3.7.12: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin/python
  • 3.7.12: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin/python3.7m
  • 3.7.12: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin/python3.7
  • 3.7.12: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin/python3
  • 3.7.12: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin/python
  • 3.7.12: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin/python3.7m
  • 3.7.12: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin/python3.7
  • 3.7.12: ~/.pyenv/versions/3.7.12/bin/python3
  • 3.6.15: ~/.pyenv/versions/3.6.15/bin/python3
  • 2.7.18: ~/.pyenv/versions/2.7.18/bin/python

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.8',
 'os_name': 'posix',
 'platform_machine': 'arm64',
 'platform_python_implementation': 'CPython',
 'platform_release': '21.6.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT '
                     '2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000',
 'python_full_version': '3.10.8',
 'python_version': '3.10',
 'sys_platform': 'darwin'}

System environment variables:

  • PATH
  • MANPATH
  • LDFLAGS
  • TERM_PROGRAM
  • PYENV_ROOT
  • _P9K_TTY
  • PIP_PYTHON_PATH
  • TERM
  • SHELL
  • TMPDIR
  • HOMEBREW_REPOSITORY
  • CPPFLAGS
  • TERM_PROGRAM_VERSION
  • TERM_SESSION_ID
  • ZSH
  • USER
  • pipfile_dir
  • SSH_AUTH_SOCK
  • __CF_USER_TEXT_ENCODING
  • VIRTUAL_ENV
  • PAGER
  • LSCOLORS
  • PIPENV_ACTIVE
  • _
  • __CFBundleIdentifier
  • PWD
  • P9K_SSH
  • LANG
  • P9K_TTY
  • XPC_FLAGS
  • PYTHONDONTWRITEBYTECODE
  • XPC_SERVICE_NAME
  • HOME
  • SHLVL
  • PYENV_SHELL
  • HOMEBREW_PREFIX
  • LOGNAME
  • LESS
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PKG_CONFIG_PATH
  • HOMEBREW_CELLAR
  • INFOPATH
  • GDAL_CONFIG
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_ACTIVE: 1

Debug–specific environment variables:

  • PATH: /opt/homebrew/Cellar/pipenv/2022.9.24/libexec/tools:/Users/username/.local/bin:/Users/username/.pyenv/shims:/Users/username/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/username/.local/share/virtualenvs/hole-information-loader-UUj0tf3n/bin:/opt/homebrew/Cellar/pipenv/2022.9.24/libexec/tools:/Users/username/.local/bin:/Users/username/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/username/Library/Application Support/JetBrains/Toolbox/scripts:/Users/username/Library/Application Support/JetBrains/Toolbox/scripts
  • SHELL: /bin/zsh
  • LANG: en_AU.UTF-8
  • PWD: livemine-hole-information-service/hole-information-loader
  • VIRTUAL_ENV: ~/.local/share/virtualenvs/hole-information-loader-UUj0tf3n

Contents of Pipfile (livemine-hole-information-service/hole-information-loader/Pipfile'):

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

[packages]
arrow = "~=0.14.4"
bc = "==0.0.1"
boto3 = "==1.9.202"
numpy = "==1.21.6" # PINNED for speed
pandas = "==1.3.5"  #updated
pyproj = "==2.5.0" # REQUIRES https://proj.org/
pyyaml = "==5.1.2"
cx-oracle = "==7.2.2"
kafka-python = "==2.0.1"
pymssql = "==2.1.4" # REQUIRES freetds
pymongo = "==3.9.0"
himl = {file = "./lib/himl"}

[dev-packages]
coverage = "==4.5.4"
isort = "*"
fakeredis = "==1.1.0"
mongomock = "==3.19.0"
requests-mock = "==1.7.0"
pylint = "==2.4.4"

[requires]
python_version = "3.7"
@matteius matteius added Type: Regression This issue is a regression of a previous behavior. triage labels Nov 23, 2022
@oz123 oz123 self-assigned this Nov 26, 2022
@matteius
Copy link
Member

matteius commented Dec 8, 2022

I believe this is also solved by: #5523

matte@LAPTOP-N5VSGIBD MINGW64 ~/Projects/pipenv-triage/pipenv-5489
$ cat Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
resolvelib = {file = "./resolvelib", version = "*"}

[dev-packages]

[requires]
python_version = "3.10"

matte@LAPTOP-N5VSGIBD MINGW64 ~/Projects/pipenv-triage/pipenv-5489
$ cat Pipfile.lock
{
    "_meta": {
        "hash": {
            "sha256": "993cc0953680867672c2cd5189abae2b02d7ce1719838a8ca37b9d0fff0ae787"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.10"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "certifi": {
            "hashes": [
                "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
                "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"
            ],
            "markers": "python_version >= '3.6'",
            "version": "==2022.12.7"
        },
        "charset-normalizer": {
            "hashes": [
                "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845",
                "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"
            ],
            "markers": "python_full_version >= '3.6.0'",
            "version": "==2.1.1"
        },
        "idna": {
            "hashes": [
                "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4",
                "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"
            ],
            "markers": "python_version >= '3.5'",
            "version": "==3.4"
        },
        "requests": {
            "hashes": [
                "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
                "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"
            ],
            "index": "pypi",
            "version": "==2.28.1"
        },
        "resolvelib": {
            "file": "./resolvelib",
            "version": "==0.8.2.dev0"
        },
        "urllib3": {
            "hashes": [
                "sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc",
                "sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
            "version": "==1.26.13"
        }
    },
    "develop": {}
}

@matteius matteius closed this as completed Dec 8, 2022
@bendog
Copy link
Author

bendog commented Dec 14, 2022

Solved

The solution was to use the key word "path" not "file"

Using Pipenv v 2022.9.20

resolvelib = {file = "./resolvelib", version = "*"}
would create an absolute path in Pipfile.lock

resolvelib = {path = "./resolvelib", version = "*"}
would create a relative path in Pipfile.lock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Type: Regression This issue is a regression of a previous behavior.
Projects
None yet
Development

No branches or pull requests

3 participants