Let's use TOML
Closed this issue · 2 comments
Advantages:
-
--save
,--save-dev
,--save-exact
could be implemented without much effort -
common file format, so we could use existing editor capabilities
-
In the future we possible could converge existing
pyproject.toml
,setup.py
and this file, into one.
This is a little specs, I've created, maybe it will be of any use (it's not complete, VCS has to be expanded, maybe I've forgotten some other cases)
[dependencies]
# plain, command: pip install --save Django
django = ">=1.10.1"
# command: pip install --save-exact Django
django = "==1.10.1"
# command: pip install --save Django==1.10.1
# Any specified specifier goes exactly (even without --save-exact)
django2 = "==1.10.1"
# full version
SomeProject = {version = "==5.4"} # denotes what version exists as a part of package metadata
# environment markers
SomeProject2 = {version = "==5.4", markers = {python_version = "< 2.7", sys_platform = "win32"}}
# OR
[dependencies.SomeProject2.markers]
sys_version = "< 2.7"
sys_platform = "win32"
# particular file
# all non-obvious dependencies should be specified as a table (not inline), it's more verbose, which is a good thing here
[dependencies.numpy] # appears after --save
file = "./downloads/numpy-1.9.2-cp34-none-win32.whl"
# OR
numpy = {file = "./downloads/numpy-1.9.2-cp34-none-win32.whl"}
wxpython = {file = "http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev1820+49a8884-cp34-none-win_amd64.whl"}
# per-requirement overrides
#FooProject >= 1.2 --global-option="--no-user-cfg" \
# --install-option="--prefix='/usr/local'" \
# --install-option="--no-compile"
# maps to
FooProject = {version = ">=1.2", setup_py_options = """--global-option="--no-user-cfg"
--install-option="--prefix='/usr/local'"
--install-option="--no-compile"""} # multiline string, only multiline that in valid in TOML
# OR
# if used in conjunction with --save (it's automatically generated, that's why doesn't really matter if it's verbose or not)
[dependencies.FooProject]
version = ">=1.2"
setup_py_options = """--global-option="--no-user-cfg"
--install-option="--prefix='/usr/local'"
--install-option="--no-compile"""
# if necessary to add hashes
# https://pip.pypa.io/en/stable/reference/pip_install/#hash-checking-mode
hashes = """ # maybe convert to array
--hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 \
--hash=sha256:486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7
"""
# VCS
flask = {git = "git repo", revision = "hash"}
# extras (dev, test, production), dev could be special-cased as [dev_dependencies]
[extras.PDF]
ReportLab = ">=1.2"
I try to follow the conversations here carefully to eventually help where I can. But it seems like people just open new issues without reading the existing ones which makes it really hard to follow this whole thing (at least for me).
It probably makes sense to wait for #10 (and all the ones quoted there by @dstufft in the initial post) or discuss this there - if it really belongs there ...
You're right, I should probably close this thing for now, and reopen it later, if necessary.