Skip to content

Installing an editable package can result in using the wrong canonical package name in Pipfile #6409

@stewartmiles

Description

@stewartmiles

Issue description

Create a local Python package called mypackage with a mypackage/mypackage/tests/test_setup.py file (see mypackage.zip):

import unittest

class TestNothing(unittest.TestCase):
    def setup(**kwargs):
        pass

    def test_nada(self):
        _ = setup(name='foo')
  • Create a pipenv virtual environment using say
    ( export PIPENV_NO_INHERIT=1; pipenv run echo )
  • Install the package as editable using pipenv install -e ./mypackage
  • See the package installed in the Pipfile uses the name in inferred from test file not the top level setup.py, i.e: grep mypackage Pipfile shows foo = {file = "mypackage"} not mypackage = {file = "mypackage"} as expected.

Expected result

The package should be named correctly in Pipfile.

Actual result

The package name is incorrectly parsed from a test file.

Steps to replicate

See above.


Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

$ pipenv --support

Pipenv version: '2025.0.2'

Pipenv location: '/home/stewart/.local/share/pipx/venvs/pipenv/lib/python3.10/site-packages/pipenv'

Python location: '/home/stewart/.local/share/pipx/venvs/pipenv/bin/python'

OS Name: 'posix'

User pip version: '25.0.1'

user Python installations found:

  • 3.10.12: /usr/bin/python3
  • 3.10.12: /usr/bin/python
  • 3.10.12: /bin/python3
  • 3.10.12: /bin/python
  • 3.8.20: /usr/bin/python3.8
  • 3.8.20: /bin/python3.8

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.12',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.8.0-59-generic',
 'platform_system': 'Linux',
 'platform_version': '#61~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 '
                     '17:03:15 UTC 2',
 'python_full_version': '3.10.12',
 'python_version': '3.10',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • PIPENV_VENV_IN_PROJECT
  • TERMCAP
  • SSH_AUTH_SOCK
  • WINDOW
  • SSH_AGENT_PID
  • PWD
  • LOGNAME
  • XDG_SESSION_TYPE
  • MOTD_SHOWN
  • HOME
  • LANG
  • LS_COLORS
  • SSH_CONNECTION
  • LESSCLOSE
  • XDG_SESSION_CLASS
  • TERM
  • LESSOPEN
  • USER
  • XLA_FLAGS
  • SHLVL
  • XDG_SESSION_ID
  • LD_LIBRARY_PATH
  • XDG_RUNTIME_DIR
  • SSH_CLIENT
  • XDG_DATA_DIRS
  • PATH
  • STY
  • DBUS_SESSION_BUS_ADDRESS
  • SSH_TTY
  • OLDPWD
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_FIND_LINKS
  • PIP_NO_BUILD_ISOLATION
  • PIPENV_SKIP_LOCK

Pipenv–specific environment variables:

  • PIPENV_VENV_IN_PROJECT: true
  • PIPENV_SKIP_LOCK: true

Debug–specific environment variables:

  • PATH: /home/stewart/bin/node/bin:/usr/local/cuda/bin:/usr/local/nvidia/bin:/home/stewart/bin/cmake/bin:~/.local/bin:/home/stewart/.local/bin:/home/stewart/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/halyard/bin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/stewart/src/agentic/service/tmp

Contents of Pipfile ('/home/stewart/src/agentic/service/tmp/Pipfile'):

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

[packages]
foo = {file = "mypackage", editable = true}

[dev-packages]

[requires]
python_version = "3.10"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions