I'm not really sure if this is a bug, or (plausibly) I have just misunderstood the available instructions.
Make sure you run commands with -v flag before pasting the output.
Steps to reproduce
First, I was reminded that I need to have the token-based authentication setup:
$ pdm publish -v
Building sdist...
pdm.termui: Preparing environment(Isolated mode) for PEP 517 build...
pdm.termui: ======== Start resolving requirements ========
pdm.termui: Adding requirement python==3.12.3
pdm.termui: Adding requirement pdm-backend
pdm.termui: ======== Resolution Result ========
pdm.termui: python None
pdm.termui: pdm-backend 2.4.1
pdm.termui: Fetching hashes for pdm-backend@2.4.1
pdm.termui: Installing pdm-backend@2.4.1...
pdm.termui: Using cached response for https://files.pythonhosted.org/packages/46/8b/.../pdm_backend-2.4.1-py3-none-any.whl
unearth.preparer: Downloading <Link https://files.pythonhosted.org/packages/46/8b/.../pdm_backend-2.4.1-py3-none-any.whl (from https://pypi.org/simple/pdm-backend/)> (107 kB)
pdm.termui: Synchronization complete.
pdm.termui: - Adding LICENSE -> LICENSE
pdm.termui: - Adding README.md -> README.md
pdm.termui: - Adding .pdm-build/pyproject.toml -> pyproject.toml
pdm.termui: - Adding src/simq/__init__.py -> src/simq/__init__.py
pdm.termui: - Adding src/simq/simpy_ggc_network.py -> src/simq/simpy_ggc_network.py
pdm.termui: - Adding tests/__init__.py -> tests/__init__.py
pdm.termui: - Adding PKG-INFO -> PKG-INFO
Built sdist at /home/galen/projects/SimQ/dist/simq-0.1.0.tar.gz
Building wheel from sdist...
pdm.termui: Preparing environment(Isolated mode) for PEP 517 build...
pdm.termui: - Adding .pdm-build/simq-0.1.0.dist-info/METADATA -> simq-0.1.0.dist-info/METADATA
pdm.termui: - Adding .pdm-build/simq-0.1.0.dist-info/WHEEL -> simq-0.1.0.dist-info/WHEEL
pdm.termui: - Adding .pdm-build/simq-0.1.0.dist-info/entry_points.txt -> simq-0.1.0.dist-info/entry_points.txt
pdm.termui: - Adding .pdm-build/simq-0.1.0.dist-info/licenses/LICENSE -> simq-0.1.0.dist-info/licenses/LICENSE
pdm.termui: - Adding src/simq/__init__.py -> simq/__init__.py
pdm.termui: - Adding src/simq/simpy_ggc_network.py -> simq/simpy_ggc_network.py
pdm.termui: - Adding simq-0.1.0.dist-info/RECORD -> simq-0.1.0.dist-info/RECORD
Built wheel at /home/galen/projects/SimQ/dist/simq-0.1.0-py3-none-any.whl
Username: galenseilis
Password:
Uploading simq-0.1.0-py3-none-any.whl
[PublishError]: Client error '403 Username/Password authentication is no longer supported. Migrate to API Tokens or
Trusted Publishers instead. See https://pypi.org/help/#apitoken and https://pypi.org/help/#trusted-publishers' for
url 'https://upload.pypi.org/legacy/'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
So I created a token, but I wasn't sure 'where' to use it. Read this issue I attempted to use pdm publish -u <username> -p <token>, but quickly realized that wasn't right. I got this error:
[ProjectError]: tool.pdm.distribution must be `true` to be built.
I figure that I am getting the ProjectError because I am not using the password/token correctly. Although, I have noted that
[tool.pdm]
distribution = true
is actually in my pyproject.toml.
Reviewing what I have done in the past using Twine, I realized that I already have a $HOME/.pypirc so I am guessing that PDM isn't able to see it for some reason.
Expected behavior
The expected behaviour would be successfully publishing to PyPI.
Environment Information
# Paste the output of `pdm info && pdm info --env` below:
$ pdm info && pdm info --env
PDM version:
2.19.1
Python Interpreter:
/home/galen/projects/SimQ/.venv/bin/python (3.12)
Project Root:
/home/galen/projects/SimQ
Local Packages:
{
"implementation_name": "cpython",
"implementation_version": "3.12.3",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "6.8.0-45-generic",
"platform_system": "Linux",
"platform_version": "#45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024",
"python_full_version": "3.12.3",
"platform_python_implementation": "CPython",
"python_version": "3.12",
"sys_platform": "linux"
}
I'm not really sure if this is a bug, or (plausibly) I have just misunderstood the available instructions.
Make sure you run commands with
-vflag before pasting the output.Steps to reproduce
First, I was reminded that I need to have the token-based authentication setup:
So I created a token, but I wasn't sure 'where' to use it. Read this issue I attempted to use
pdm publish -u <username> -p <token>, but quickly realized that wasn't right. I got this error:I figure that I am getting the
ProjectErrorbecause I am not using the password/token correctly. Although, I have noted thatis actually in my
pyproject.toml.Reviewing what I have done in the past using Twine, I realized that I already have a
$HOME/.pypircso I am guessing that PDM isn't able to see it for some reason.Expected behavior
The expected behaviour would be successfully publishing to PyPI.
Environment Information