pdm-project / pdm Goto Github PK
View Code? Open in Web Editor NEWA modern Python package and dependency manager supporting the latest PEP standards
Home Page: https://pdm-project.org
License: MIT License
A modern Python package and dependency manager supporting the latest PEP standards
Home Page: https://pdm-project.org
License: MIT License
Make sure you run commands with -v
flag before pasting the output.
$ pdm add pytest==4.6.*
The package requires:
[
...
'more-itertools>=4.0.0,<6.0.0;python_version<="2.7"',
'more-itertools>=4.0.0;python_version>"2.7"',
...
]
Lockfile entry:
more-itertools = {marker = "python_version > \"2.7\"", version = ">=4.0.0"}
Both entries are kept in lockfile.
pdm version:
# Paste the output of `pdm info && pdm info --env` below:
C:/hostedtoolcache/windows/Python/3.8.1/x64/python.exe: can't open file ':\hostedtoolcache\windows\python\3.8.1\x64\lib\site-packages\pdm\_editable_install.py': [Errno 22] Invalid argument
pdm remove --force
Synchronizing: ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 71/80 00:00:04Command errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-build_r7c39sw/alembic/setup.py'"'"'; __file__='"'"'/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-build_r7c39sw/alembic/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pip-wheel-m9rvp0oi
cwd: /var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-build_r7c39sw/alembic/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/kevin/workspace/backend_epay_restx_pdm/__pypackages__/3.7/lib/setuptools/__init__.py", line 14, in <module>
from setuptools.extern.six import PY3, string_types
ModuleNotFoundError: No module named 'setuptools.extern'
----------------------------------------
Failed building wheel for alembic
Command errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-build_r7c39sw/alembic/setup.py'"'"'; __file__='"'"'/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-build_r7c39sw/alembic/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
cwd: /var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-build_r7c39sw/alembic
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/kevin/workspace/backend_epay_restx_pdm/__pypackages__/3.7/lib/setuptools/__init__.py", line 14, in <module>
from setuptools.extern.six import PY3, string_types
ModuleNotFoundError: No module named 'setuptools.extern'
----------------------------------------
Failed cleaning build dir for alembic
Retrying (1/1): ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2
Don't know which is the better but may use poetry
's solution.
Environment: Windows 10, Python 3.7
When the library is empty, the following error occurs during python -m pdm list:
C:\Users\dusai>python -m pdm add cowsay
Adding packages to default dependencies: cowsay
Traceback (most recent call last):
File "C:\Users\dusai\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\dusai\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\dusai\AppData\Roaming\Python\Python37\site-packages\pdm\__main__.py", line 4, in <module>
cli.main()
File "C:\Users\dusai\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Users\dusai\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\dusai\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\dusai\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\dusai\AppData\Local\Programs\Python\Python37\lib\site-packages\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "C:\Users\dusai\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\dusai\AppData\Roaming\Python\Python37\site-packages\pdm\cli\commands.py", line 161, in add
actions.do_add(project, dev, section, sync, save, strategy, editables, packages)
File "C:\Users\dusai\AppData\Roaming\Python\Python37\site-packages\pdm\cli\actions.py", line 175, in do_add
project.add_dependencies(requirements)
File "C:\Users\dusai\AppData\Roaming\Python\Python37\site-packages\pdm\project\core.py", line 261, in add_dependencies
deps = self.tool_settings["dependencies"]
File "C:\Users\dusai\AppData\Roaming\Python\Python37\site-packages\pdm\project\core.py", line 35, in getter
_cache = func(self, *args, **kwargs)
File "C:\Users\dusai\AppData\Roaming\Python\Python37\site-packages\pdm\project\core.py", line 91, in tool_settings
data = data.setdefault(sec, {})
AttributeError: 'NoneType' object has no attribute 'setdefault'
When the library has any sitepackage, the error disappears:
C:\Users\dusai>python -m pdm list
pdmtest 1.0.0 (-e c:\users\dusai)
cowsay 2.0.3
😆😆😆It's a great tool. Keep going!😆😆😆
Some hook points:
Traceback (most recent call last):
File "D:\Workspace\pdm\__pypackages__\3.8\Scripts\pdm-script.py", line 12, in <module>
load_entry_point('pdm', 'console_scripts', 'pdm')()
File "D:/Workspace/pdm/__pypackages__/3.8/lib\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "D:/Workspace/pdm/__pypackages__/3.8/lib\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "D:/Workspace/pdm/__pypackages__/3.8/lib\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "D:/Workspace/pdm/__pypackages__/3.8/lib\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "D:/Workspace/pdm/__pypackages__/3.8/lib\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "D:/Workspace/pdm/__pypackages__/3.8/lib\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "D:/Workspace/pdm/__pypackages__/3.8/lib\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "d:\workspace\pdm\pdm\cli\commands.py", line 97, in install
actions.do_lock(project)
File "d:\workspace\pdm\pdm\cli\actions.py", line 95, in do_lock
mapping, dependencies, summaries = resolve(
File "d:\workspace\pdm\pdm\resolver\__init__.py", line 119, in resolve
state = resolver.resolve({k: reqs.values() for k, reqs in requirements.items()})
File "d:\workspace\pdm\pdm\resolver\resolvers.py", line 298, in resolve
resolution.resolve(requirements, max_rounds=max_rounds)
File "d:\workspace\pdm\pdm\resolver\resolvers.py", line 249, in resolve
self._pin_criteria()
File "d:\workspace\pdm\pdm\resolver\resolvers.py", line 216, in _pin_criteria
dependencies = self._p.get_dependencies(candidate)
File "d:\workspace\pdm\pdm\resolver\providers.py", line 48, in get_dependencies
deps, requires_python, summary = self.repository.get_dependencies(candidate)
File "d:\workspace\pdm\pdm\models\repositories.py", line 54, in get_dependencies
requirements, requires_python, summary = getter(candidate)
File "d:\workspace\pdm\pdm\models\repositories.py", line 28, in wrapper
result = func(self, candidate)
File "d:\workspace\pdm\pdm\models\repositories.py", line 114, in _get_dependencies_from_metadata
deps = candidate.get_dependencies_from_metadata()
File "d:\workspace\pdm\pdm\models\candidates.py", line 131, in get_dependencies_from_metadata
metadata = self.get_metadata()
File "d:\workspace\pdm\pdm\models\candidates.py", line 88, in get_metadata
built = self.environment.build(ireq, self.hashes)
File "d:\workspace\pdm\pdm\models\environment.py", line 239, in build
return builder.build(**kwargs)
File "d:\workspace\pdm\pdm\builders\wheel.py", line 38, in build
return self._build_other(build_dir, **kwargs)
File "d:\workspace\pdm\pdm\builders\wheel.py", line 60, in _build_other
raise WheelBuildError(str(self.ireq))
pdm.exceptions.WheelBuildError: functools32; python_version < "3.2" from https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz#sha256=f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d
When lockfile hash mismatches, a full lock process is performed, just to update that hash.
Reuse pins when possible
Make sure you run commands with -v
flag before pasting the output.
$ pdm init
$ pdm add numpy
No hash for numpy
pdm version:
# Paste the output of `pdm info && pdm info --env` below:
Python Interpreter: /Users/fming/Library/PythonUp/cmd/python3.7 (3.7.5)
Project Root: /Users/fming/wkspace/github/pdm-test
{
"implementation_name": "cpython",
"implementation_version": "3.7.5",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "19.3.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64",
"python_full_version": "3.7.5",
"platform_python_implementaiton": "CPython",
"python_version": "3.7",
"sys_platform": "darwin"
}
pdm init --python <python>
to select interpreter. The method is the same as pdm use
OS环境:macOS
python版本:3.7
➜ backend_restx_pdm git:(release.001) ✗ pdm update -vv
⠋ Resolving blinkerCommand errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-buildla663h3c/blinker/setup.py'"'"'; __file__='"'"'/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-buildla663h3c/blinker/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pip-wheel-781gfl3t
cwd: /var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pdm-buildla663h3c/blinker/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
Failed building wheel for blinker
Traceback (most recent call last):
File "/usr/local/bin/pdm", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/pdm/core.py", line 68, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pdm/core.py", line 100, in main
raise err.with_traceback(traceback)
File "/usr/local/lib/python3.7/site-packages/pdm/core.py", line 96, in main
f(options.project, options)
File "/usr/local/lib/python3.7/site-packages/pdm/cli/commands/update.py", line 36, in handle
packages=options.packages,
File "/usr/local/lib/python3.7/site-packages/pdm/cli/actions.py", line 189, in do_update
do_lock(project)
File "/usr/local/lib/python3.7/site-packages/pdm/cli/actions.py", line 56, in do_lock
resolver, requirements, project.environment.python_requires
File "/usr/local/lib/python3.7/site-packages/pdm/resolver/__init__.py", line 119, in resolve
state = resolver.resolve({k: reqs.values() for k, reqs in requirements.items()})
File "/usr/local/lib/python3.7/site-packages/pdm/resolver/resolvers.py", line 298, in resolve
resolution.resolve(requirements, max_rounds=max_rounds)
File "/usr/local/lib/python3.7/site-packages/pdm/resolver/resolvers.py", line 249, in resolve
self._pin_criteria()
File "/usr/local/lib/python3.7/site-packages/pdm/resolver/resolvers.py", line 216, in _pin_criteria
dependencies = self._p.get_dependencies(candidate)
File "/usr/local/lib/python3.7/site-packages/pdm/resolver/providers.py", line 48, in get_dependencies
deps, requires_python, summary = self.repository.get_dependencies(candidate)
File "/usr/local/lib/python3.7/site-packages/pdm/models/repositories.py", line 61, in get_dependencies
requirements, requires_python, summary = getter(candidate)
File "/usr/local/lib/python3.7/site-packages/pdm/models/repositories.py", line 27, in wrapper
result = func(self, candidate)
File "/usr/local/lib/python3.7/site-packages/pdm/models/repositories.py", line 130, in _get_dependencies_from_metadata
deps = candidate.get_dependencies_from_metadata()
File "/usr/local/lib/python3.7/site-packages/pdm/models/candidates.py", line 183, in get_dependencies_from_metadata
metadata = self.get_metadata()
File "/usr/local/lib/python3.7/site-packages/pdm/models/candidates.py", line 138, in get_metadata
built = self.environment.build(ireq, self.hashes, allow_all_wheels)
File "/usr/local/lib/python3.7/site-packages/pdm/models/environment.py", line 315, in build
return builder.build(**kwargs)
File "/usr/local/lib/python3.7/site-packages/pdm/builders/wheel.py", line 37, in build
return self._build_other(build_dir, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pdm/builders/wheel.py", line 56, in _build_other
raise WheelBuildError(str(self.ireq))
pdm.exceptions.WheelBuildError: blinker==1.4 from http://mirrors.aliyun.com/pypi/packages/1b/51/e2a9f3b757eb802f61dc1f2b09c8c99f6eb01cf06416c0671253536517b6/blinker-1.4.tar.gz#md5=8b3722381f83c2813c52de3016b68d33
When doing pdm init
, make python_requires
defaults to >=current_verson
. Users can use *
to allow all versions
Make sure you run commands with -v
flag before pasting the output.
pdm use 2.7
pdm add functools32
Build error since the wheel is generated under Python 3
pdm version:
# Paste the output of `pdm info && pdm info --env` below:
Install current working set into the given path
version = {from = "pdm/__version__.py"}
Make sure you run commands with -v
flag before pasting the output.
To build a wheel
$ pdm build
wheel RECORD is malformed:
/
separated relative path.sha256=
The wheel can't be installed correctly.
pdm version: master
# Paste the output of `pdm info && pdm info --env` below:
git
, svn
, hg
, bzr
keyspdm add
pdm add "requests>=2.20.0; os_name=='nt'" "-e https://github.com/pallets/click.git@master#egg=click"
.setup.py
, setup.cfg
pyproject.toml
List available pythons and corresponding versions
Make sure you run commands with -v
flag before pasting the output.
The nautc package is here:
https://pypi.org/project/nautc/
https://github.com/nasyxx/nautc.git
mkdir temp && cd temp
pdm init
pdm add nautc
Failed to add package nautc
.
λ pdm add -v nautc
Adding packages to default dependencies: nautc
Error: No version available for nautc.
Traceback (most recent call last):
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pdm/cli/commands.py", line 205, in add
actions.do_add(project, dev, section, sync, save, strategy, editables, packages)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pdm/cli/actions.py", line 218, in do_add
resolved = do_lock(project, strategy, tracked_names, all_dependencies)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pdm/cli/actions.py", line 135, in do_lock
mapping, dependencies, summaries = resolve(
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pdm/resolver/__init__.py", line 119, in resolve
state = resolver.resolve({k: reqs.values() for k, reqs in requirements.items()})
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 298, in resolve
resolution.resolve(requirements, max_rounds=max_rounds)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 237, in resolve
self._contribute_to_criteria(name, requirement, parent=f"__{key}__")
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 124, in _contribute_to_criteria
crit = Criterion.from_requirement(self._p, requirement, parent)
File "/Users/Nasy/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 51, in from_requirement
raise NoVersionsAvailable(requirement, parent)
pdm.exceptions.NoVersionsAvailable: No version available for nautc.
It should successfully add package nautc
.
pdm version:
# Paste the output of `pdm info && pdm info --env` below:
Python Interpreter: /Users/Nasy/.pyenv/versions/3.8.1/bin/python (3.8.1)
Project Root: /Users/Nasy/temp/tp
{
"implementation_name": "cpython",
"implementation_version": "3.8.1",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "19.3.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64",
"python_full_version": "3.8.1",
"platform_python_implementaiton": "CPython",
"python_version": "3.8",
"sys_platform": "darwin"
}
A requirement of the form git@server:repo.git
gets translated into ssh://server/repo.git
, dropping the git@
username component of the url. This then fails cloning if the server requires that git
username (as GitHub does).
The issue is this line (specifically self.url[4:]
) that slices out the username when constructing the ssh://
url. You can bypass this errant special casing with an explicit ssh://
schema (e.g. ssh://git@server/repo.git
).
Expected:
Associate with what is picked for the project.
Make sure you run commands with -v
flag before pasting the output.
❯ pdm init -v
Creating a pyproject.toml for PDM...
Please enter the Python interpreter to use:
0. /usr/bin/python3 (3.8.2)
1. /usr/bin/python2 (2.7.17)
Please select: [0]: 0
Using Python interpreter: /usr/bin/python3 (3.8.2)
Project name [test]:
Project version [0.0.0]:
License(SPDX name) [MIT]:
Author name [Aloxaf]:
Author email [[email protected]]:
Python requires('*' to allow any) [>=3.8]: 3.6
Changes are written to pyproject.toml.
❯ pdm add python-telegram-bot -v
Adding packages to default dependencies: python-telegram-bot
Traceback (most recent call last):
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py", line 663, in __init__
parsed.add(Specifier(specifier))
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py", line 111, in __init__
raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
pip._vendor.packaging.specifiers.InvalidSpecifier: Invalid specifier: '3.6'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/aloxaf/.local/bin/pdm", line 8, in <module>
sys.exit(main())
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 68, in __call__
return self.main(*args, **kwargs)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 100, in main
raise err.with_traceback(traceback)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 96, in main
f(options.project, options)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/commands/add.py", line 35, in handle
actions.do_add(
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/actions.py", line 136, in do_add
resolved = do_lock(project, strategy, tracked_names, all_dependencies)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/actions.py", line 47, in do_lock
provider = project.get_provider(strategy, tracked_names)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/project/core.py", line 220, in get_provider
repository = self.get_repository(cls=self.core.repository_class)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/project/core.py", line 209, in get_repository
return cls(sources, self.environment)
File "/usr/lib/python3.8/functools.py", line 966, in __get__
val = self.func(instance)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/project/core.py", line 144, in environment
return Environment(self)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/environment.py", line 85, in __init__
self.python_requires = project.python_requires
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/project/core.py", line 148, in python_requires
return PySpecSet(self.tool_settings.get("python_requires", ""))
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/specifiers.py", line 94, in __init__
super().__init__(version_str)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py", line 665, in __init__
parsed.add(LegacySpecifier(specifier))
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py", line 111, in __init__
raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
pip._vendor.packaging.specifiers.InvalidSpecifier: Invalid specifier: '3.6'
Tell me "3.6" is an invalid specifier after init project.
Tell me "3.6" is an invalid specifier when init project.
pdm version:
❯ pdm info && pdm info --env
Python Interpreter: /usr/bin/python3 (3.8.2)
Project Root: /tmp/test
{
"implementation_name": "cpython",
"implementation_version": "3.8.2",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "5.5.11-zen1-1-zen",
"platform_system": "Linux",
"platform_version": "#1 ZEN SMP PREEMPT Sun, 22 Mar 2020 16:33:18 +0000",
"python_full_version": "3.8.2",
"platform_python_implementaiton": "CPython",
"python_version": "3.8",
"sys_platform": "linux"
}
Make sure you run commands with -v
flag before pasting the output.
dependencies:
[tool.pdm.dependencies]
pytest="==4.6.*"
more-itertools=">=4.0.0,<6.0.0"
pdm lock
more-itertools
has markers.
more-itertools
has no marker.
pdm version:
# Paste the output of `pdm info && pdm info --env` below:
Make sure you run commands with -v
flag before pasting the output.
pdm init
pdm use 3.7
pdm add futures
futures-3.1.1-py2-none-any.whl
is installed
futures-3.1.1-py3-none-any.whl
is installed
pdm version:
# Paste the output of `pdm info && pdm info --env` below:
Python Interpreter: /usr/local/bin/python3.7m (3.7.6)
Project Root: /Users/fming/wkspace/github/pdm-test
{
"implementation_name": "cpython",
"implementation_version": "3.7.6",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "19.3.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64",
"python_full_version": "3.7.6",
"platform_python_implementaiton": "CPython",
"python_version": "3.7",
"sys_platform": "darwin"
}
python_version < \"3.4\" and python_version >= \"2.7\" and python_version not in \"3.0, 3.1, 3.2, 3.3\"
Expected:
python_version >= "2.7" and python_version < "3.0"
环境:树梅派
安装 PDM 后,运行 pip3 报错
Traceback (most recent call last):
File "/usr/bin/pip3", line 11, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
原因可能是 pdm 导致环境中有 2个重复的 pip3
运行python3 -m pip uninstall pip 卸载一个 pip3 后, pip3 恢复正常。
$ python3 -m pdm add cowsay
Adding packages to default dependencies: cowsay
Changes are written to pyproject.toml.
Finish resolving
✔ Resolution success
Changes are written to pdm.lock.
Installing cowsay 2.0.3...
Installing pdmDemo 0.0.0...
AttributeError: 'NoneType' object has no attribute 'group'
虽然报错,但是 pdm 可以正常运行 add,run 指令
python3 -m pdm remove cowsay
Removing packages from default dependencies: cowsay
Changes are written to pyproject.toml.
Finish resolving
✔ Resolution success
Changes are written to pdm.lock.
NonExistentKey: 'Key "package" does not exist.'
如果局部环境中只有一个包,并且执行 remove 将此包删除,则会导致 pdm.lock 中无 [package] 索引,因此 add remove update 指令均报错:
$ python3 -m pdm list
Package Version
------- -------
cowsay 2.0.3
此时可以正常 run :
$ python3 -m pdm run cowsay moo
___
< moo >
===
\
\
^__^
(oo)\_______
(__)\ )\/\
||----w |
|| ||
运行 $ python setup_dev.py 失败,报错如下:
...
Successfully installed pip-20.0.2 pip-shims-0.5.0
Setup project for development...
Installing cursor 1.3.4...
HashMismatch: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
unknown package:
Expected sha256 33f279a17789c04efd27a92501a0dad62bb011f8a4cdff93867c798d26508940
Got 84e0405a5c7c8b5135e54cc7fd38e9afa999389830cb64a80e8f7814709afb97
Traceback (most recent call last):
File "setup_dev.py", line 55, in <module>
main()
File "setup_dev.py", line 35, in main
subprocess.check_call([venv_python.as_posix(), "-m", "pdm", "install", "-d"])
File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['env/bin/python', '-m', 'pdm', 'install', '-d']' returned non-zero exit status 1.
树梅派 pipenv 环境中出现此问题。
Make sure you run commands with -v
flag before pasting the output.
❯ pdm init -v
Creating a pyproject.toml for PDM...
Please enter the Python interpreter to use:
0. /usr/bin/python3 (3.8.2)
1. /usr/bin/python2 (2.7.17)
Please select: [0]: 0
Using Python interpreter: /usr/bin/python3 (3.8.2)
Project name [test]:
Project version [0.0.0]:
License(SPDX name) [MIT]:
Author name [Aloxaf]:
Author email [[email protected]]:
Python requires('*' to allow any) [>=3.8]: >=3.6
Changes are written to pyproject.toml.
❯ pdm add python-telegram-bot -v
Adding packages to default dependencies: python-telegram-bot
⠹ Resolved: decorator 4.4.2See /tmp/pdm-lock-_mj6r4jp.log for detailed debug log.
Traceback (most recent call last):
File "/home/aloxaf/.local/bin/pdm", line 8, in <module>
sys.exit(main())
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 68, in __call__
return self.main(*args, **kwargs)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 100, in main
raise err.with_traceback(traceback)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 96, in main
f(options.project, options)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/commands/add.py", line 35, in handle
actions.do_add(
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/actions.py", line 136, in do_add
resolved = do_lock(project, strategy, tracked_names, all_dependencies)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/actions.py", line 55, in do_lock
mapping, dependencies, summaries = resolve(
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/__init__.py", line 119, in resolve
state = resolver.resolve({k: reqs.values() for k, reqs in requirements.items()})
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 297, in resolve
resolution.resolve(requirements, max_rounds=max_rounds)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 248, in resolve
self._pin_criteria()
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 215, in _pin_criteria
dependencies = self._p.get_dependencies(candidate)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/providers.py", line 127, in get_dependencies
dependencies = super().get_dependencies(candidate)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/providers.py", line 48, in get_dependencies
deps, requires_python, summary = self.repository.get_dependencies(candidate)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/repositories.py", line 61, in get_dependencies
requirements, requires_python, summary = getter(candidate)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/repositories.py", line 27, in wrapper
result = func(self, candidate)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/repositories.py", line 130, in _get_dependencies_from_metadata
deps = candidate.get_dependencies_from_metadata()
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/candidates.py", line 183, in get_dependencies_from_metadata
metadata = self.get_metadata()
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/candidates.py", line 138, in get_metadata
built = self.environment.build(ireq, self.hashes, allow_all_wheels)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/environment.py", line 315, in build
return builder.build(**kwargs)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/builders/wheel.py", line 37, in build
return self._build_other(build_dir, **kwargs)
File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/builders/wheel.py", line 56, in _build_other
raise WheelBuildError(str(self.ireq))
pdm.exceptions.WheelBuildError: future>=0.16.0 from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz#sha256=b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d
❯ cat /tmp/pdm-lock-_mj6r4jp.log
========Start resolving requirements========
python-telegram-bot
Package constraints:
python-telegram-bot <= __default__
Found candidate python-telegram-bot 12.4.2
========Ending round 0========
New pins:
python-telegram-bot 12.4.2
Package constraints:
certifi <= python-telegram-bot
Found candidate certifi 2019.11.28
Package constraints:
cryptography <= python-telegram-bot
Found candidate cryptography 2.8
Package constraints:
decorator>=4.4.0 <= python-telegram-bot
Found candidate decorator 4.4.2
Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pdm-buildtkdqao3m/future/setup.py'"'"'; __file__='"'"'/tmp/pdm-buildtkdqao3m/future/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-w_2dfs7s
cwd: /tmp/pdm-buildtkdqao3m/future/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
Failed building wheel for future
Raise a WheelBuildError
Add it without any error.
pdm version:
# Paste the output of `pdm info && pdm info --env` below:
❯ pdm info && pdm info --env
Python Interpreter: /usr/bin/python3 (3.8.2)
Project Root: /tmp/test
{
"implementation_name": "cpython",
"implementation_version": "3.8.2",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "5.5.11-zen1-1-zen",
"platform_system": "Linux",
"platform_version": "#1 ZEN SMP PREEMPT Sun, 22 Mar 2020 16:33:18 +0000",
"python_full_version": "3.8.2",
"platform_python_implementaiton": "CPython",
"python_version": "3.8",
"sys_platform": "linux"
}
Make sure you run commands with -v
flag before pasting the output.
python_requires = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
pdm add pytest
importlib-metadata
has requirement: pathlib2; python_version=='3.4.*' or python_version < '3'
locked and installed correctly
pdm version: master
# Paste the output of `pdm info && pdm info --env` below:
Reproduce:
pdm add <package>
or
pdm update <package>
From https://github.com/pdm-project/call-for-features/issues/1
global-project
folder under PDM app direcctory.global
that supports following subcommands:
install
sync
remove
add
update
list
Any to add? @nasyxx
pdm add "docutils<0.16,>=0.10"
docutils==0.15.2
[[package]]
name = "docutils"
sections = ["default"]
version = "0.15.post1"
marker = "python_version >= \"2.6\" and python_version not in \"3.0, 3.1, 3.2\""
summary = "Docutils -- Python Documentation Utilities"
[metadata]
"docutils 0.15.post1" = [
{file = "docutils-0.15.post1-py2-none-any.whl", hash = "sha256:ba4584f9107571ced0d2c7f56a5499c696215ba90797849c92d395979da68521"},
]
[root]
content_hash = "md5:a34a70283dc33a99743b6086bef07c0f"
meta_version = "0.0.1"
[ERROR]
Installation failed: gevent
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/pdm/installers.py", line 445, in install_candidate
installer.install(can)
File "/usr/local/lib/python3.7/site-packages/pdm/installers.py", line 286, in install
candidate.get_metadata(allow_all_wheels=False)
File "/usr/local/lib/python3.7/site-packages/pdm/models/candidates.py", line 138, in get_metadata
built = self.environment.build(ireq, self.hashes, allow_all_wheels)
File "/usr/local/lib/python3.7/site-packages/pdm/models/environment.py", line 301, in build
session=finder.session,
File "/usr/local/lib/python3.7/site-packages/pip_shims/compat.py", line 754, in shim_unpack
return unpack_fn(**unpack_kwargs) # type: ignore
File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 287, in unpack_url
hashes=hashes,
File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 159, in unpack_http_url
link, downloader, temp_dir.path, hashes
File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 307, in _download_http_url
hashes.check_against_path(file_path)
File "/usr/local/lib/python3.7/site-packages/pip/_internal/utils/hashes.py", line 102, in check_against_path
with open(path, 'rb') as file:
FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/bv/vvf44mtd4t54p5c4d424jpfh0000gn/T/pip-unpack-97_apydq/gevent-1.4.0-cp37-cp37m-macosx_10_9_x86_64.whl'
Use the pyenv interpreter if pyenv is installed.
Make sure you run commands with -v
flag before pasting the output.
$ pdm add black
Installing black 19.10b0...
Traceback (most recent call last):
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/bin/pdm", line 12, in <module>
load_entry_point('pdm', 'console_scripts', 'pdm')()
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Users/fming/wkspace/github/pdm/pdm/cli/commands.py", line 93, in main
raise err.with_traceback(traceback)
File "/Users/fming/wkspace/github/pdm/pdm/cli/commands.py", line 89, in main
super().main(*args, **kwargs)
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/fming/wkspace/github/pdm/pdm/cli/commands.py", line 172, in sync
actions.do_sync(project, sections, dev, default, dry_run, clean)
File "/Users/fming/wkspace/github/pdm/pdm/cli/actions.py", line 173, in do_sync
handler.synchronize(clean=clean, dry_run=dry_run)
File "/Users/fming/wkspace/github/pdm/pdm/installers.py", line 184, in synchronize
self.install_candidates(
File "/Users/fming/wkspace/github/pdm/pdm/installers.py", line 153, in install_candidates
installer.install(can)
File "/Users/fming/wkspace/github/pdm/pdm/installers.py", line 51, in install
self.install_wheel(candidate.wheel)
File "/Users/fming/wkspace/github/pdm/pdm/installers.py", line 61, in install_wheel
wheel.install(paths, scripts)
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/distlib/wheel.py", line 649, in install
filenames = maker.make(script)
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/distlib/scripts.py", line 400, in make
entry = get_export_entry(specification)
File "/Users/fming/wkspace/github/pdm/__pypackages__/3.8/lib/distlib/util.py", line 731, in get_export_entry
raise DistlibException("Invalid specification "
distlib.DistlibException: Invalid specification 'blackd = blackd:patched_main ['d']'
Black is installed correctly.
pdm version:
# Paste the output of `pdm info && pdm info --env` below:
pdm update --no-constraint
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.