@@ -334,8 +334,8 @@ e.g.: a requirement string like `"dev-cmd[old-pythons]"`.
334334
335335With that done, a minimal configuration looks like so:
336336``` toml
337- [tool .dev-cmd .python . requirements ]
338- export-command = [" uv" , " export" , " -q" , " --no-emit-project" , " -o" , " {requirements.txt}" ]
337+ [[ tool .dev-cmd .python ] ]
338+ 3rdparty- export-command = [" uv" , " export" , " -q" , " --no-emit-project" , " -o" , " {requirements.txt}" ]
339339```
340340
341341Here your export command just needs to be able to output a Pip requirements.txt compatible
@@ -346,8 +346,8 @@ By default, `dev-cmd` also installs your project in each custom venv in editable
346346requirement. You may wish to adjust which extra requirements are installed, in which case you use
347347the ` extra-requirements ` key:
348348``` toml
349- [tool .dev-cmd .python . requirements ]
350- export-command = [
349+ [[ tool .dev-cmd .python ] ]
350+ 3rdparty- export-command = [
351351 " uv" , " export" , " -q" ,
352352 " --no-emit-project" ,
353353 " --no-emit-package" , " subproject" ,
@@ -362,33 +362,55 @@ extra-requirements = [
362362Here we exclude the main project and a local subproject from the requirements export since ` uv `
363363exports hashes for these which Pip does not support for directories. To work around, we just list
364364these two local projects in ` extra-requirements ` and they get installed as-is without a hash check
365- after the exported requirements are installed.
365+ after the exported requirements are installed. You can alternatively supply ` extra-requirements ` as
366+ a single string, in which case the string will be written out to a file and passed to ` pip install `
367+ as a ` -r ` / ` --requirement ` file.
368+
369+ You can also supply a ` finalize-command ` as a list of command line argument strings for the venv.
370+ This command will run last after the 3rdparty requirements and extra requirements are installed and
371+ can use ` {venv-python} ` and ` {venv-site-packages} ` placeholders to receive these paths for
372+ manipulating the venv.
366373
367374You may find the need to vary venv setup per Python ` --version ` . This is supported by specifying
368- ` extra-requirements ` as a list of tables instead of a list of requirement strings . For example:
375+ multiple ` [[tool.dev-cmd.python]] ` entries . For example:
369376``` toml
370- [[tool .dev-cmd .python .requirements .extra-requirements ]]
377+ [[tool .dev-cmd .python ]]
378+ when = " python_version >= '3.7'"
379+ 3rdparty-export-command = [" uv" , " export" , " -q" , " --no-emit-project" , " -o" , " {requirements.txt}" ]
380+
381+ [[tool .dev-cmd .python ]]
371382when = " python_version < '3.7'"
372- pip-req = " pip<23"
373- install-opts = [" --no-use-pep517" ]
374- reqs = [" -e" , " ./" ]
383+
384+ pip-requirement = " pip<10"
385+ extra-requirements = [" ." ]
386+ extra-requirements-pip-install-opts = [" --no-use-pep517" ]
375387```
376388
377- You must ensure just one ` extra-requirements ` entry is selected per ` --python ` via a ` when `
378- environment marker. You can then customise the version of Pip selected for the venv via ` pip-req ` ,
379- the extra ` reqs ` to install and any custom ` pip install ` options you need.
389+ You must ensure just one ` [[tool.dev-cmd.python]] ` entry is selected per ` --python ` via a ` when `
390+ environment marker. You can then customize the version of Pip selected for the venv via
391+ ` pip-requirement ` , the extra ` extra-requirements ` to install and any custom ` pip install ` options
392+ you need for either the 3rdparty requirements install via ` 3rdparty-pip-install-opts ` or the extra
393+ requirements install via ` extra-requirements-pip-install-opts ` .
394+
395+ Note that when defining multiple ` [[tool.dev-cmd.python]] ` entries, the 1st is special in setting
396+ defaults all subsequent ` [[tool.dev-cmd.python]] ` entries inherit for keys left unspecified. In the
397+ example above, the second entry for Python 3.6 and older could add a ` 3rdparty-export-command ` if
398+ it needed different export behavior for those older versions.
380399
381400Venvs are created under a ` .dev-cmd ` directory and are cached based on the values of the
382401"build-system", "project" and "project.optional-dependencies" in ` pyproject.toml ` by default. To
383- change the default input keys, you can specify ` input-keys ` . You can also mix the full contents of
384- any other files into the venv cache key using ` input-files ` . Here, combining both of these options,
385- we turn off pyproject.toml inputs to the venv cache key and just rely on the contents of ` uv.lock ` ,
386- which is what the export command is powered by:
402+ change this default, you can specify a custom ` pyproject-cache-keys ` . You can also mix the full
403+ contents of any other files, directories or environment variables into the venv cache key using
404+ ` extra-cache-keys ` . For files or directories, add a string entry denoting their path or else an
405+ entry like ` {path = "the/path"} ` . For environment variables, add an entry like
406+ ` {env = "THE_ENV_VAR"} ` . Here, combining both of these options, we turn off pyproject.toml inputs to
407+ the venv cache key and just rely on the contents of ` uv.lock ` , which is what the export command is
408+ powered by:
387409``` toml
388410[tool .dev-cmd .python .requirements ]
389411export-command = [" uv" , " export" , " -q" , " --no-emit-project" , " -o" , " {requirements.txt}" ]
390- input -keys = []
391- input-files = [" uv.lock" ]
412+ pyproject-cache -keys = []
413+ extra-cache-keys = [" uv.lock" ]
392414```
393415
394416## Execution
0 commit comments