Skip to content

Instantly share code, notes, and snippets.

@kennethreitz
Last active November 22, 2016 17:59
Show Gist options
  • Save kennethreitz/9319936c301be5c01f6da04e518d2cf3 to your computer and use it in GitHub Desktop.
Save kennethreitz/9319936c301be5c01f6da04e518d2cf3 to your computer and use it in GitHub Desktop.
[package]
name = "marathon"
version = "0.1.0"
authors = ["Terence Lee <hone02@gmail.com>"]
build = "build.rs"
[features]
default = ["serde_codegen"]
unstable = ["serde_macros"]
[build-dependencies]
serde_codegen = { version = "0.8", optional = true }
[dependencies]
docopt = "0.6"
rustc-serialize = "0.3"
serde = "^0.8"
serde_yaml = { version = "^0.4", features = ["preserve_order"] }
serde_macros = { version = "0.8", optional = true }
# Note: There will be a default source, and context manager can also be used.
source('https://pypi.org/', verify_ssl=True)
package('requests[security]')
package('Django', '==1.6')
package('pinax', git='git://github.com/pinax/pinax.git', ref='1.4', editable=True)
dev-package('nose')
# Note: There will be a default source, and context manager can also be used.
[sources]
"https://pypi.org/" = { verify_ssl = true }
[packages]
requests = { version = "*", extras = [ "socks" ] }
django = "==1.6"
pinax = { git = "git://github.com/pinax/pinax.git", ref = "1.4", editable = true }
[dev-packages]
nose = "*"
@kennethreitz
Copy link
Author

I don't like the toml version

@flying-sheep
Copy link

flying-sheep commented Nov 21, 2016

hmm, why is it requests[security] (only) in the TOML example and --1.6 instead of ==1.6?

i’d also rather go for this syntax for the sources:

[[sources]]
url = 'https://pypi.org'
verify_ssl = true

apart from that you’re right. i also think the ad-hoc syntax is a little cuter!

however, i think the slightly less expressive syntax is a cheap tradeoff compared to a completely new format requiring a dedicated parser (or a python parser and subsequent extensive verification pass, coupled with the mental load to learn it (and i very much doubt that learning this specific subset of python is harder than learning TOML.)

also: is it even a subset? dev-package is an expression in python. is dev - package also valid syntax? if not, it’s no subset, it has additional grammar.


by the way: if all that sounds pushy or angry or so, i don’t want to be that way 😄

@takluyver
Copy link

This is a bit longer, but feels more natural to me than the example you gave:

[[sources]]
url = 'https://pypi.org'
verify_ssl = true

[packages.requests]
extras="security"

[packages.django]
version = "==1.6"

[packages.pinax]
git = "git://github.com/pinax/pinax.git"
ref = "1.4"
editable = true

[dev-packages.nose]  # Empty tables are allowed in TOML!

@takluyver
Copy link

The sources could also be named, in which case [[sources]] would become [sources.pypi].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment