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

ask_for_import() resets build backend to default #2388

Closed
1 task done
floxay opened this issue Nov 9, 2023 · 0 comments · Fixed by #2393
Closed
1 task done

ask_for_import() resets build backend to default #2388

floxay opened this issue Nov 9, 2023 · 0 comments · Fixed by #2393
Assignees
Labels
🐛 bug Something isn't working

Comments

@floxay
Copy link

floxay commented Nov 9, 2023

  • 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

  • Have a requirements.txt or other config file recognized by find_importable_files() in the project:
    for filename in ("Pipfile", "pyproject.toml", "requirements.in", "requirements.txt", "setup.py", "setup.cfg"):
  • Run pdm init
  • Tell PDM this project is installable
  • Select a build backend (preferably not the default one; setuptools)
  • [build backend is now set to setuptools in pyproject.toml]
  • Fill out name, email etc. to finish project initialization
  • Choose to import from requirements.txt when Found following files from other formats that you may import appears
  • Build backend is now back to default

I believe this happens because ask_for_import() calls Command.do_import() which just simply replaces it:

pyproject["build-system"] = DEFAULT_BACKEND.build_system()

Actual behavior

After initializing and importing PDM will reset the build backend to the default.

Expected behavior

PDM should not reset the build backend, especially if it was specified in the same "session", like in the example above using init.

Environment Information

PDM version:
  2.10.1
Python Interpreter:
  C:\Users\x\Documents\GitHub\test-proj\.venv\Scripts\python.exe (3.11)
Project Root:
  C:/Users/x/Documents/GitHub/test-proj
Local Packages:

{
  "implementation_name": "cpython",
  "implementation_version": "3.11.6",
  "os_name": "nt",
  "platform_machine": "AMD64",
  "platform_release": "10",
  "platform_system": "Windows",
  "platform_version": "10.0.22621",
  "python_full_version": "3.11.6",
  "platform_python_implementation": "CPython",
  "python_version": "3.11",
  "sys_platform": "win32"
}
@floxay floxay added the 🐛 bug Something isn't working label Nov 9, 2023
@frostming frostming self-assigned this Nov 10, 2023
frostming added a commit that referenced this issue Nov 10, 2023
Fixes #2388

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