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 2.13.x + pdm-wheel: [TypeError]: expected str, bytes or os.PathLike object, not CachedPackage #2747

Closed
1 task done
enku opened this issue Mar 30, 2024 · 4 comments · Fixed by #2750
Closed
1 task done
Assignees
Labels
🐛 bug Something isn't working

Comments

@enku
Copy link

enku commented Mar 30, 2024

  • 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

set -e
pdm=$(pwd)
pyver=3.12
d=/tmp/pdm-issue
rm -rf $d
mkdir -p $d
python${pyver} -m venv $d/venv
$d/venv/bin/python -m pip install "$pdm"
$d/venv/bin/pdm self add pdm-wheel
mkdir $d/project
cd $d/project
$d/venv/bin/pdm init --non-interactive --python ${pyver}
$d/venv/bin/pdm add setproctitle psycopg gunicorn rq
$d/venv/bin/pdm wheel -v --prod

Actual behavior

pdm wheel --prod fails:

$d/venv/bin/pdm wheel -v --prod
Checking project file...
Checking lockfile...
The lockfile does not contain static file URLs. Exporting wheel may be longer than expected, and 
make calls to indexes.
Use `pdm lock --refresh --static-urls` to include static file URLs in the lockfile.
Resolving wheel candidates for this platform...
The exported wheels are no longer cross-platform. Using it them other platforms may cause unexpected
result.
STATUS: Resolving packages from lockfile...
STATUS: Fetching hashes for resolved packages...
Creating target directory: /tmp/pdm-issue/project/wheels
Traceback (most recent call last):
  File "/tmp/pdm-issue/venv/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/tmp/pdm-issue/venv/lib/python3.12/site-packages/pdm/core.py", line 341, in main
    return core.main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/pdm-issue/venv/lib/python3.12/site-packages/pdm/core.py", line 259, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/tmp/pdm-issue/venv/lib/python3.12/site-packages/pdm/core.py", line 254, in main
    self.handle(project, options)
  File "/tmp/pdm-issue/venv/lib/python3.12/site-packages/pdm/core.py", line 209, in handle
    command.handle(project, options)
  File "/tmp/pdm-issue/venv/lib/python3.12/site-packages/pdm_wheel/wheel.py", line 116, in handle
    rel_path = shutil.copy(path, wheel_dir)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/shutil.py", line 434, in copy
    dst = os.path.join(dst, os.path.basename(src))
                            ^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 171, in basename
TypeError: expected str, bytes or os.PathLike object, not CachedPackage

Expected behavior

Prior to pdm 2.13 this operation succeeds and creates wheels in the wheels directory. git bisect points to f7f87bb as the offending commit. I'm not sure, but I don't think the actual packages in the project matter.

Environment Information

  • (Gentoo) Linux
  • Python 3.12

Paste the output of pdm info && pdm info --env below:

PDM version:
  2.13.1
Python Interpreter:
  /usr/bin/python3.12 (3.12)
Project Root:
  /tmp/pdm-issue/project
Local Packages:
  /tmp/pdm-issue/project/__pypackages__/3.12

{
  "implementation_name": "cpython",
  "implementation_version": "3.12.2",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.8.2",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Wed Mar 27 07:03:46 AM CDT 2024",
  "python_full_version": "3.12.2",
  "platform_python_implementation": "CPython",
  "python_version": "3.12",
  "sys_platform": "linux"
}
@enku enku added the 🐛 bug Something isn't working label Mar 30, 2024
@frostming
Copy link
Collaborator

I think pdm-wheel is responsible for updating to be compatible with 2.13

@frostming
Copy link
Collaborator

I changed my mind, I am going to backport the old build function to not break downstream. Thanks.

@frostming frostming self-assigned this Mar 30, 2024
frostming added a commit that referenced this issue Mar 30, 2024
Fixes #2747

Signed-off-by: Frost Ming <me@frostming.com>
frostming added a commit that referenced this issue Mar 30, 2024
Fixes #2747

Signed-off-by: Frost Ming <me@frostming.com>
@enku
Copy link
Author

enku commented Mar 30, 2024

Thanks. I actually did not realize that pdm-wheel had a different maintainer until you mentioned it.

@GabDug
Copy link
Contributor

GabDug commented Mar 31, 2024

Maintainer of pdm-wheel here, thanks for the backport :)

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.

3 participants