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 seems to mix python versions in creating initial __pycache__ files #2213

Closed
1 task done
doolio opened this issue Aug 29, 2023 · 3 comments · Fixed by j178/pdm#1
Closed
1 task done

PDM seems to mix python versions in creating initial __pycache__ files #2213

doolio opened this issue Aug 29, 2023 · 3 comments · Fixed by j178/pdm#1

Comments

@doolio
Copy link
Contributor

doolio commented Aug 29, 2023

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

Steps to reproduce

  1. Install a python version different to the system version using something like pyenv, asdf or rtx but keep the system version as the 'in-use' version.
  2. Create a pdm managed python project with pdm init.
  3. When prompted to select an interpreter to use select the one installed in step 1.

Actual behavior

From the screenshot below, you can see I selected to use python 3.11 (specifically 3.11.5 installed via asdf) for the virtual environment (even though the system version 3.9.2 is the 'in-use' version) which it does but I see python 3.9 .pyc files within the __pycache__ folders presumably because the system version is the 'in-use' version?

image

Expected behavior

I appreciate one could consider this user error in selecting a python version that was not selected as 'in-use' but I would have expected pdm to warn me of this or to not find such versions in the first place and thus avoid mixing versions or to correctly use the selected version to create the .pyc files.

Environment Information

# Output of `pdm info && pdm info --env` below:
PDM version:
  5.8.2
Python Interpreter:
  /home/doolio/projects/learning/python/pdm-demo/.venv/bin/python (3.11)
Project Root:
  /home/doolio/projects/learning/python/pdm-demo
Local Packages:
  
{
  "implementation_name": "cpython",
  "implementation_version": "3.11.5",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.10.0-25-amd64",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Debian 5.10.191-1 (2023-08-16)",
  "python_full_version": "3.11.5",
  "platform_python_implementation": "CPython",
  "python_version": "3.11",
  "sys_platform": "linux"
}
@doolio doolio added the 🐛 bug Something isn't working label Aug 29, 2023
@doolio
Copy link
Contributor Author

doolio commented Aug 29, 2023

Also, I noticed the project name pdm-demo differs from the package name example_package. I can open a separate issue for this if necessary.

@frostming
Copy link
Collaborator

I don't think it's a big deal. Those pyc files are copied from the in-package template since your PDM is installed with Python 3.9 and the 3.11 pyc files have not been generated yet.

Also, I noticed the project name pdm-demo differs from the package name example_package. I can open a separate issue for this if necessary.

The package name only changes according to the project name you input if you select "yes" to init a library instead. Not a bug.

@frostming frostming added not a bug and removed 🐛 bug Something isn't working labels Aug 30, 2023
@doolio
Copy link
Contributor Author

doolio commented Aug 30, 2023

I don't think it's a big deal.
The package name only changes according to the project name you input if you select "yes" to init a library instead. Not a bug.

OK. In that case, then I think we can close this issue. Thanks for your time.

@doolio doolio closed this as completed Aug 30, 2023
frostming added a commit that referenced this issue Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants