diff --git a/README.md b/README.md index 6681b479264d549d09a8f6a808f116e98e475269..487a6feeea6fb04a3ec4fede88e0b00878beb46b 100644 --- a/README.md +++ b/README.md @@ -65,10 +65,48 @@ environments. It is a relative new proposal and there are not many tools support is [pyflow]), but it is written with Rust and thus can't get much help from the big Python community. For the same reason it can't act as a PEP 517 backend. -## Installation: +## Installation PDM requires python version 3.7 or higher. +Like Pip, PDM provides an installation script that will install PDM into an isolated environment. + +**For Linux/Mac** + +```bash +curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/install-pdm.py | python - +``` + +**For Windows** + +```powershell +(Invoke-WebRequest -Uri https://raw.githubusercontent.com/pdm-project/pdm/install-pdm.py -UseBasicParsing).Content | python - +``` + +The installer will install PDM into the user site and the location depends on the system: + +- `$HOME/.local/bin` for Unix +- `%APPDATA%\Python\Scripts` on Windows + +You can pass additional options to the script to control how PDM is installed: + +``` +usage: install-pdm.py [-h] [-v VERSION] [--prerelease] [--remove] [-p PATH] [-d DEP] + +optional arguments: + -h, --help show this help message and exit + -v VERSION, --version VERSION | envvar: PDM_VERSION + Specify the version to be installed, or HEAD to install from the main branch + --prerelease | envvar: PDM_PRERELEASE Allow prereleases to be installed + --remove | envvar: PDM_REMOVE Remove the PDM installation + -p PATH, --path PATH | envvar: PDM_HOME Specify the location to install PDM + -d DEP, --dep DEP | envvar: PDM_DEPS Specify additional dependencies, can be given multiple times +``` + +You can either pass the options after the script or set the env var value. + +## Alternative Installation Methods + If you are on MacOS and using `homebrew`, install it by: ```bash diff --git a/README_zh.md b/README_zh.md index 0df2a4a77c4a42d6f5059dd7ec162ef5026c13ca..1e33adcaaa645dbd8fca0008265ea2dc88da83ab 100644 --- a/README_zh.md +++ b/README_zh.md @@ -60,11 +60,49 @@ foo 没有很多相关的工具实现它,这其中就有 [pyflow]。但 pyflow 又是用 Rust 写的,不是所有 Python 的社区 都会用 Rust,这样就没法贡献代码,而且,基于同样的原因,pyflow 并不支持 PEP 517 构建。 -## 安装: +## 安装 PDM 需要 Python 3.7 或更高版本。 -如果你使用的是 MacOS 并且安装了`homebrew`: +像 pip 一样,PDM 也提供了一键安装脚本,用来将 PDM 安装在一个隔离的环境中。 + +**Linux/Mac 安装命令** + +```bash +curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/install-pdm.py | python - +``` + +**Windows 安装命令** + +```powershell +(Invoke-WebRequest -Uri https://raw.githubusercontent.com/pdm-project/pdm/install-pdm.py -UseBasicParsing).Content | python - +``` + +默认情况下,此脚本会将 PDM 安装在 Python 的用户目录下,具体位置取决于当前系统: + +- Unix 上是 `$HOME/.local/bin` +- Windows 上是 `%APPDATA%\Python\Scripts` + +你还可以通过命令行的选项来改变安装脚本的行为: + +``` +usage: install-pdm.py [-h] [-v VERSION] [--prerelease] [--remove] [-p PATH] [-d DEP] + +optional arguments: + -h, --help show this help message and exit + -v VERSION, --version VERSION | envvar: PDM_VERSION + Specify the version to be installed, or HEAD to install from the main branch + --prerelease | envvar: PDM_PRERELEASE Allow prereleases to be installed + --remove | envvar: PDM_REMOVE Remove the PDM installation + -p PATH, --path PATH | envvar: PDM_HOME Specify the location to install PDM + -d DEP, --dep DEP | envvar: PDM_DEPS Specify additional dependencies, can be given multiple times +``` + +你既可以通过直接增加选项,也可以通过设置对应的环境变量来达到这一效果。 + +## 其他安装方法 + +如果你使用的是 MacOS 并且安装了 `homebrew`: ```bash $ brew install pdm @@ -145,7 +183,6 @@ $ python /home/frostming/workspace/flask_app/app.py [Awesome PDM](https://github.com/pdm-project/awesome-pdm) 这个项目收集了一些非常有用的 PDM 插件及相关资源。 - ## 常见问题 ### 1. `__pypackages__` 里都包含什么? diff --git a/docs/docs/index.md b/docs/docs/index.md index 3f2158840695c740171a001e8f0cb45075ecb10b..5877660ed885e52efac41847fd70e3c1611470b6 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -28,6 +28,47 @@ PDM requires Python 3.7+ to be installed. It works on multiple platforms includi ### Recommended installation method +PDM requires python version 3.7 or higher. + +Like Pip, PDM provides an installation script that will install PDM into an isolated environment. + +**For Linux/Mac** + +```bash +curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/install-pdm.py | python - +``` + +**For Windows** + +```powershell +(Invoke-WebRequest -Uri https://raw.githubusercontent.com/pdm-project/pdm/install-pdm.py -UseBasicParsing).Content | python - +``` + +The installer will install PDM into the user site and the location depends on the system: + +- `$HOME/.local/bin` for Unix +- `%APPDATA%\Python\Scripts` on Windows + +You can pass additional options to the script to control how PDM is installed: + +``` +usage: install-pdm.py [-h] [-v VERSION] [--prerelease] [--remove] [-p PATH] [-d DEP] + +optional arguments: + -h, --help show this help message and exit + -v VERSION, --version VERSION | envvar: PDM_VERSION + Specify the version to be installed, or HEAD to install from the main branch + --prerelease | envvar: PDM_PRERELEASE Allow prereleases to be installed + --remove | envvar: PDM_REMOVE Remove the PDM installation + -p PATH, --path PATH | envvar: PDM_HOME Specify the location to install PDM + -d DEP, --dep DEP | envvar: PDM_DEPS Specify additional dependencies, can be given multiple times +``` + +You can either pass the options after the script or set the env var value. + + +### Other installation methods + If your are on MacOS and using `homebrew`, install it by: ```bash @@ -41,9 +82,7 @@ is via [pipx](https://pypi.org/project/pipx): $ pipx install pdm ``` -### Other installation methods - -Install PDM into user site with `pip`: +Or you can install PDM into the user site with `pip`: ```console $ pip install --user pdm diff --git a/news/508.feature.md b/news/508.feature.md new file mode 100644 index 0000000000000000000000000000000000000000..621d4284d23c8fc4d1ec4f3ab845a3192f7fb56b --- /dev/null +++ b/news/508.feature.md @@ -0,0 +1 @@ +Add an install script to bootstrap PDM quickly without help of other tools. Modify docs to recommend this installation method.