未验证 提交 f56b4933 编写于 作者: F frostming

Update README.md

上级 38c88d43
......@@ -3,6 +3,7 @@
A modern Python package manager with PEP 582 support. [中文版本说明](README_zh.md)
![Github Actions](https://github.com/pdm-project/pdm/workflows/Tests/badge.svg)
![PyPI](https://img.shields.io/pypi/v/pdm?logo=python&logoColor=%23cccccc)
## What is PDM?
......@@ -58,7 +59,7 @@ $ pip install --user pdm
PEP 582 is a draft proposal which still needs a lot of polishment, for instance, it doesn't mention how to manage
CLI executables. PDM take the decision to put `bin`, `include` together with `lib` under `__pypackage__/X.Y`.
### 2. How to run CLI scripts in the local package directory?
### 2. How do I run CLI scripts in the local package directory?
The recommended way is to prefix your command with `pdm run`. It is also possible to run CLI scripts directly from
the outside, the PDM's installer has already injected the package path to the `sys.path` in the entry script file.
......@@ -73,6 +74,9 @@ and could lead to some confusion around which packages are being used, though.
You'd better not. The packages installed inside `__pypackages__` are OS dependent. Instead, you should keep `pdm.lock`
in VCS and do `pdm sync` on the target environment to deploy.
### 5. Can I use `pdm` to manage a Python 2.7 project?
Sure. The `pdm` itself can be installed under Python 3.7+ only, but it doesn't restrict the Python used by the project.
## Credits
This project is strongly inspired by [pyflow] and [poetry].
......
......@@ -67,6 +67,9 @@ PDM 会首先在 `__pypackage__` 中寻找,然后会在选择的 Python 解释
最好别这样搞,`__pypackage__` 下面安装的包是和操作系统相关的,所以除非是纯 Python 的包,都会有兼容性的问题。你应该把 `pdm.lock`
纳入版本管理,然后在目标环境中执行 `pdm sync`
### 5. 我能用`pdm`管理一个 Python 2.7 的项目吗?
当然可以。只是`pdm`本身的安装需要 Python 版本高于 3.7,它并不限制项目使用的 Python 版本。
## 鸣谢
本项目的受到 [pyflow] 与 [poetry] 的很多启发。
......
......@@ -14,7 +14,7 @@ from pdm.models.requirements import (
parse_requirement,
)
from pdm.models.specifiers import PySpecSet, SpecifierSet
from pdm.utils import allow_all_wheels, get_pypi_source
from pdm.utils import allow_all_wheels
if TYPE_CHECKING:
from pdm.models.environment import Environment
......@@ -40,7 +40,7 @@ class BaseRepository:
:param sources: a list of sources to download packages from.
:param environment: the bound environment instance.
"""
self.sources = [get_pypi_source()] + sources
self.sources = sources
self.environment = environment
self._candidate_info_cache = context.make_candidate_info_cache()
self._hash_cache = context.make_hash_cache()
......
......@@ -19,7 +19,7 @@ from pdm.models.requirements import Requirement, parse_requirement, strip_extras
from pdm.models.specifiers import PySpecSet
from pdm.project.config import Config
from pdm.project.meta import PackageMeta
from pdm.utils import find_project_root
from pdm.utils import find_project_root, get_pypi_source
if TYPE_CHECKING:
from tomlkit.container import Container
......@@ -137,8 +137,11 @@ class Project:
return self.tool_settings.get("allow_prereleases")
@property
def sources(self) -> Optional[List[Source]]:
return self.tool_settings.get("source")
def sources(self) -> List[Source]:
sources = self.tool_settings.get("source", [])
if not any(source.get("name") == "pypi" for source in sources):
sources.insert(0, get_pypi_source())
return sources
def get_repository(self) -> BaseRepository:
sources = self.sources or []
......
......@@ -13,8 +13,12 @@ repository = "https://github.com/pdm-project/pdm"
keywords = ["packaging", "dependency", "workflow"]
classifiers = [
"Development Status :: 3 - Alpha",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules"
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8"
]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册