[go: nahoru, domu]

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

Use case of --ignore-pipfile #6191

Open
ricolxwz opened this issue Jul 6, 2024 · 1 comment
Open

Use case of --ignore-pipfile #6191

ricolxwz opened this issue Jul 6, 2024 · 1 comment
Assignees
Labels
ai-triaged Contributor Candidate The issue has been identified/triaged and contributions are welcomed/encouraged. triage Type: Bug 🐛 This issue is a bug.

Comments

@ricolxwz
Copy link
ricolxwz commented Jul 6, 2024

AVOID POSTING ISSUES UNDER THIS CATEGORY.

If Pipenv is not functioning as you would like it to, consider filing either a bug report, or a feature request instead.

Please refer to StackOverflow tag for more information.


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: '2024.0.1'

Pipenv location: '/home/wenzexu/.pyenv/versions/3.12.4/lib/python3.12/site-packages/pipenv'

Python location: '/home/wenzexu/.pyenv/versions/3.12.4/bin/python3.12'

OS Name: 'posix'

User pip version: '24.0'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.12.4',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.9.7-200.fc40.x86_64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT_DYNAMIC Thu Jun 27 18:11:45 UTC 2024',
 'python_full_version': '3.12.4',
 'python_version': '3.12',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • SESSION_MANAGER
  • PYENV_HOOK_PATH
  • COLORTERM
  • PYENV_SHELL
  • NVM_INC
  • HISTCONTROL
  • XDG_MENU_PREFIX
  • TERM_PROGRAM_VERSION
  • CONDA_EXE
  • _CE_M
  • HOSTNAME
  • HISTSIZE
  • DOTNET_ROOT
  • SSH_AUTH_SOCK
  • WARP_USE_SSH_WRAPPER
  • MEMORY_PRESSURE_WRITE
  • XMODIFIERS
  • DESKTOP_SESSION
  • EDITOR
  • PYENV_VERSION
  • PWD
  • XDG_SESSION_DESKTOP
  • LOGNAME
  • XDG_SESSION_TYPE
  • SYSTEMD_EXEC_PID
  • XAUTHORITY
  • GJS_DEBUG_TOPICS
  • GDM_LANG
  • HOME
  • USERNAME
  • LANG
  • LS_COLORS
  • XDG_CURRENT_DESKTOP
  • MEMORY_PRESSURE_WATCH
  • WAYLAND_DISPLAY
  • WARP_HONOR_PS1
  • WARP_COMBINED_PROMPT_COMMAND_GRID
  • SSH_SOCKET_DIR
  • INVOCATION_ID
  • MANAGERPID
  • DOTNET_BUNDLE_EXTRACT_BASE_DIR
  • PYENV_DIR
  • GJS_DEBUG_OUTPUT
  • NVM_DIR
  • GNOME_SETUP_DISPLAY
  • XDG_SESSION_CLASS
  • TERM
  • _CE_CONDA
  • LESSOPEN
  • USER
  • CONDA_SHLVL
  • DISPLAY
  • SHLVL
  • NVM_CD_FLAGS
  • QT_IM_MODULE
  • CONDA_PYTHON_EXE
  • XDG_RUNTIME_DIR
  • PYENV_ROOT
  • DEBUGINFOD_URLS
  • WARP_IS_LOCAL_SHELL_SESSION
  • JOURNAL_STREAM
  • XDG_DATA_DIRS
  • PATH
  • GDMSESSION
  • DBUS_SESSION_BUS_ADDRESS
  • NVM_BIN
  • MAIL
  • GIO_LAUNCHED_DESKTOP_FILE_PID
  • GIO_LAUNCHED_DESKTOP_FILE
  • OLDPWD
  • TERM_PROGRAM
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/wenzexu/.pyenv/versions/3.6.15/bin:/home/wenzexu/.pyenv/versions/3.9.19/bin:/home/wenzexu/.pyenv/versions/3.12.4/bin:/home/wenzexu/.pyenv/versions/3.8.19/bin:/home/wenzexu/.pyenv/versions/3.7.17/bin:/home/wenzexu/.pyenv/versions/3.12.4/bin:/home/wenzexu/.pyenv/libexec:/home/wenzexu/.pyenv/plugins/python-build/bin:/home/wenzexu/.pyenv/plugins/pyenv-virtualenv/bin:/home/wenzexu/.pyenv/plugins/pyenv-update/bin:/home/wenzexu/.pyenv/plugins/pyenv-doctor/bin:/home/wenzexu/.pyenv/shims:/home/wenzexu/.pyenv/bin:/home/wenzexu/.nvm/versions/node/v20.15.0/bin:/home/wenzexu/miniconda3/condabin:/home/wenzexu/.local/bin:/home/wenzexu/bin:/home/wenzexu/.pyenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/wenzexu/.dotnet/tools:/home/wenzexu/.cargo/bin:/usr/local/bin:/home/wenzexu/.local/share/JetBrains/Toolbox/scripts:/home/wenzexu/.cargo/bin:/usr/local/bin:/home/wenzexu/.local/share/JetBrains/Toolbox/scripts
  • SHELL: /bin/bash
  • EDITOR: /usr/bin/nano
  • LANG: zh_CN.UTF-8
  • PWD: /home/wenzexu

My question is what is the use case of pipenv install --ignore-pipfile, to me, there is no difference between pipenv install and pipenv install --ignore-pipfile.

For example:

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

[packages]
"requests" = "==2.11.0"

[dev-packages]

[requires]
python_version = "3.12"
# Pipfile.lock
{
    "_meta": {
        "hash": {
            "sha256": "7f1be087f2e6adbe8ec64f71bfaaed8b6bb1595f3769488039b14c9d2e555dca"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.12"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "requests": {
            "hashes": [
                "sha256:09bc1b5f3a56cd8c48d433213a8cba51a67d12936568f73b5f1793fcb0c0979e",
                "sha256:63f1815788157130cee16a933b2ee184038e975f0017306d723ac326b5525b54"
            ],
            "index": "pypi",
            "markers": "python_version >= '3.8'",
            "version": "==2.10.0"
        }
    },
    "develop": {}
}

If I run pipenv install:

$ pipenv install
Pipfile.lock (555dca) out of date: run `pipfile lock` to update to (14165b)...
Running $ pipenv lock then $ pipenv sync.
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (793cf11c853344d4cc8f42ede41e771eb6afaccce2510f7daf1efb578d14165b)!
Installing dependencies from Pipfile.lock (14165b)...
All dependencies are now up-to-date!
Installing dependencies from Pipfile.lock (14165b)...

If I run pipenv install --ignore-pipfile:

$ pipenv install --ignore-pipfile
Pipfile.lock (555dca) out of date: run `pipfile lock` to update to (14165b)...
Running $ pipenv lock then $ pipenv sync.
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (793cf11c853344d4cc8f42ede41e771eb6afaccce2510f7daf1efb578d14165b)!
Installing dependencies from Pipfile.lock (14165b)...
All dependencies are now up-to-date!
Installing dependencies from Pipfile.lock (14165b)...

No difference at all.

If I want to install from Pipfile.lock and really ignore the Pipfile I can run pipenv sync:

$ pipenv sync
Installing dependencies from Pipfile.lock (555dca)...
All dependencies are now up-to-date!
@matteius matteius self-assigned this Jul 29, 2024
@matteius matteius added Type: Bug 🐛 This issue is a bug. Contributor Candidate The issue has been identified/triaged and contributions are welcomed/encouraged. labels Sep 23, 2024
@matteius
Copy link
Member

Analysis of Issue #6191:

1. Problem Summary

The user is questioning the use case of the --ignore-pipfile flag in the pipenv install command. Their experiments show no difference in behavior between using the flag and omitting it, as both scenarios seem to prioritize Pipfile.lock for installation.

They also point out that the pipenv sync command already provides the functionality of installing directly from Pipfile.lock.

2. Comment Discussion Analysis

There are no comments on this issue, indicating a lack of community engagement or a clear understanding of the intended use of the --ignore-pipfile flag.

3. Proposed Resolution

The issue highlights a potential redundancy or misunderstanding regarding the --ignore-pipfile flag. It seems the flag's intended behavior might not align with its actual implementation, as it doesn't appear to genuinely ignore Pipfile during installation.

Possible solutions:

  • Deprecate and Remove: If the flag is truly redundant, consider deprecating and eventually removing it from pipenv install. This simplifies the command interface and eliminates confusion.
  • Clarify Functionality: If the flag has a specific use case beyond pipenv sync, then its functionality needs to be clarified. Update the documentation to explain its purpose and the scenarios where it differs from pipenv install without the flag. This ensures users understand when and how to use it effectively.
  • Re-implement Functionality: If the intention was for --ignore-pipfile to install packages only from Pipfile.lock without even considering Pipfile, then the code needs to be adjusted to achieve this behavior.

4. Potential Code Changes

If opting to re-implement the functionality:

Modify pipenv/routines/install.py inside the do_install function:

	  if not packages and not editable_packages:
	      # ... existing code ...
	  else:
	      if skip_lock:
	          # ... existing code ...
	      elif ignore_pipfile:
	          # Install only from Pipfile.lock, ignoring Pipfile completely.
	          for category in categories:
	              lockfile_category = get_lockfile_section_using_pipfile_category(category)
	              for package_name, package_info in lockfile[lockfile_category].items():
	                  # Construct pip installation command for each package in lockfile
	                  pip_line = requirement_from_lockfile(
	                      package_name, package_info, include_hashes=True, include_markers=True
	                  )
	                  # ... append pip_line to a list for installation ...
	      else:
	          # ... existing code ...

This modification directly constructs installation commands from Pipfile.lock, bypassing any Pipfile checks or updates if --ignore-pipfile is provided.

5. Additional Steps/Investigations

  • Review Existing Tests: Analyze existing tests for pipenv install to identify any test cases covering the --ignore-pipfile flag. If no such tests exist, create new ones to validate the intended behavior after implementing any changes.
  • Community Feedback: Engage with the community (perhaps through a discussion on the issue) to understand user expectations and use cases for the --ignore-pipfile flag. This can help determine the most appropriate course of action.

By either removing, clarifying, or re-implementing the functionality of the --ignore-pipfile flag, Pipenv can maintain a consistent and predictable command interface, aligning with user expectations and avoiding unnecessary confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai-triaged Contributor Candidate The issue has been identified/triaged and contributions are welcomed/encouraged. triage Type: Bug 🐛 This issue is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants