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

pdm init in non-interactive mode does not respect --python option #1984

Closed
1 task done
AvlWx2014 opened this issue Jun 7, 2023 · 0 comments · Fixed by #1985
Closed
1 task done

pdm init in non-interactive mode does not respect --python option #1984

AvlWx2014 opened this issue Jun 7, 2023 · 0 comments · Fixed by #1985
Assignees
Labels
🐛 bug Something isn't working

Comments

@AvlWx2014
Copy link
Contributor

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

[rsmit@rsmit:pdm-test-repo]$ pdm init -vn --python ~/.asdf/installs/python/3.7.14/bin/python
Creating a pyproject.toml for PDM...
Run command: ['/home/rsmit/.asdf/installs/pdm/2.7.0/venv/bin/python', '-m', 'virtualenv', '/home/rsmit/repos/github/pdm-test-repo/.venv', 
'-p', '/home/rsmit/.asdf/installs/python/3.10.7/bin/python', '--prompt=pdm-test-repo-3.10', '--no-pip', '--no-setuptools', '--no-wheel']
created virtual environment CPython3.10.7.final.0-64 in 47ms
  creator CPython3Posix(dest=/home/rsmit/repos/github/pdm-test-repo/.venv, clear=False, no_vcs_ignore=False, global=False)
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Virtualenv is created successfully at /home/rsmit/repos/github/pdm-test-repo/.venv
Changes are written to pyproject.toml.
[rsmit@rsmit:pdm-test-repo]$ cat pyproject.toml | grep "requires-python"
requires-python = ">=3.10"
[rsmit@rsmit:pdm-test-repo]$ pdm run python --version
Python 3.10.7
[rsmit@rsmit:pdm-test-repo]$ ~/.asdf/installs/python/3.7.14/bin/python --version
Python 3.7.14

Actual behavior

When initializing a new project with pdm init -n --python the Python interpreter passed to --python is ignored and my default interpreter is used instead.

Expected behavior

My project is initialized with the Python 3.7 interpreter passed to --python when used with pdm init -n.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:
  2.7.0
Python Interpreter:
  /home/rsmit/repos/github/pdm-test-repo/.venv/bin/python (3.10)
Project Root:
  /home/rsmit/repos/github/pdm-test-repo
Local Packages:
  
{
  "implementation_name": "cpython",
  "implementation_version": "3.10.7",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "4.18.0-425.19.2.el8_7.x86_64",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Fri Mar 17 01:52:38 EDT 2023",
  "python_full_version": "3.10.7",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "linux"
}
@AvlWx2014 AvlWx2014 added the 🐛 bug Something isn't working label Jun 7, 2023
@frostming frostming self-assigned this Jun 8, 2023
frostming added a commit that referenced this issue Jun 8, 2023
…ption

Fixes #1984

Signed-off-by: Frost Ming <me@frostming.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants