未验证 提交 b6c1c3d3 编写于 作者: F Frost Ming

add config items

Close #202
上级 1a4db10a
......@@ -115,7 +115,7 @@ If you want global project to track another project file other than `~/.pdm/glob
project path following `-g/--global`.
!!! danger "NOTE"
Be careful with `remove` and `sync --clean` commands when global project is used. Because it may remove packages installed in your system Python.
Be careful with `remove` and `sync --clean` commands when global project is used. Because it may remove packages installed in your system Python.
## Working with a virtualenv
......@@ -160,6 +160,8 @@ $ pdm export -o requirements.txt
| `pypi.url` | The URL of PyPI mirror | Read `index-url` in `pip.conf`, or `https://pypi.org/simple` if not found | Yes | `PDM_PYPI_URL` |
| `pypi.verify_ssl` | Verify SSL certificate when query PyPI | Read `trusted-hosts` in `pip.conf`, defaults to `True` | Yes | |
| `pypi.json_api` | Consult PyPI's JSON API for package metadata | `False` | Yes | `PDM_PYPI_JSON_API` |
| `strategy.save` | Specify how to save versions when a package is added | `compatible`(can be: `exact`, `wildcard`) | Yes | |
| `strategy.update` | The default strategy for updating packages | `reuse`(can be : `eager`) | Yes | |
_If the env var is set, the value will take precendence over what is saved in the config file._
......
Make update strategy and save strategy configurable in pdm config.
......@@ -37,8 +37,8 @@ class Command(BaseCommand):
dev=options.dev,
section=options.section,
sync=options.sync,
save=options.save_strategy,
strategy=options.update_strategy,
save=options.save_strategy or project.config["strategy.save"],
strategy=options.update_strategy or project.config["strategy.update"],
editables=options.editables,
packages=options.packages,
)
......@@ -30,8 +30,8 @@ class Command(BaseCommand):
dev=options.dev,
sections=options.sections,
default=options.default,
save=options.save_strategy,
strategy=options.update_strategy,
save=options.save_strategy or project.config["strategy.save"],
strategy=options.update_strategy or project.config["strategy.update"],
unconstrained=options.unconstrained,
packages=options.packages,
)
......@@ -109,7 +109,6 @@ save_strategy_group.add_argument(
dest="save_strategy",
const="compatible",
help="Save compatible version specifiers",
default="compatible",
)
save_strategy_group.add_argument(
"--save-wildcard",
......@@ -117,7 +116,6 @@ save_strategy_group.add_argument(
dest="save_strategy",
const="wildcard",
help="Save wildcard version specifiers",
default="compatible",
)
save_strategy_group.add_argument(
"--save-exact",
......@@ -125,7 +123,6 @@ save_strategy_group.add_argument(
dest="save_strategy",
const="exact",
help="Save exact version specifiers",
default="compatible",
)
update_strategy_group = ArgumentGroup("update_strategy", is_mutually_exclusive=True)
......@@ -134,7 +131,6 @@ update_strategy_group.add_argument(
action="store_const",
dest="update_strategy",
const="reuse",
default="reuse",
help="Reuse pinned versions already present in lock file if possible",
)
update_strategy_group.add_argument(
......
......@@ -79,6 +79,12 @@ class Config(MutableMapping):
True,
"PDM_AUTO_GLOBAL",
),
"strategy.update": ConfigItem(
"The default strategy for updating packages", "reuse", False
),
"strategy.save": ConfigItem(
"Specify how to save versions when a package is added", "compatible", False
),
"parallel_install": ConfigItem(
"Whether to perform installation and uninstallation in parallel",
True,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册