Repository navigation
Conversation
Walks through a short dialog (requirements.txt import, Python version, package index, packages, dev packages, and whether to create the virtualenv and lock). `--yes` accepts defaults without prompting and is implied when stdin isn't a TTY; `--install/--no-install` controls the follow-up install. A Pipfile in a parent directory no longer blocks starting a new project in a subdirectory. Closes #5792 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5792
Adds
pipenv init, which creates a Pipfile through a short dialog, similar tonpm init:Behavior
-y/--yesaccepts every default without prompting (likenpm init -y). It's implied when stdin isn't a TTY, so CI never hangs on a prompt.--install/--no-installcontrols whether the virtualenv and lock get created afterwards. By default it asks; under--yesit skips. Installing goes through the normaldo_install.--pythonaccepts either a bare version (3.12) or an interpreter path.Project()chdirs into the found project's folder at startup, soinitswitches back to the directory it was invoked from.shlex, so quoted markers and>=3,<4both work). Paths, URLs and VCS references are rejected with a note to add them later withpipenv install, since only the full install code builds correct entries for those.Scope
The issue also asked for name/version/author prompts. Those belong in
pyproject.toml, not a Pipfile, so the dialog only covers what a Pipfile records. The docs say so.Testing
tests/unit/test_init_routine.py(16 tests): requirement parsing,--yeswith requirements.txt import, bare--pythonversion, refusing an existing Pipfile, the parent-Pipfile case, and the full interactive dialog with mocked prompts.pipenv --python 3.12 init -y --install, which imported a requirements.txt, built the venv and wrotePipfile.lock.🤖 Generated with Claude Code