nedbat / scriv

Changelog management tool
https://scriv.readthedocs.io
Apache License 2.0
260 stars 29 forks source link

Read version info from `pyproject.toml` #44

Closed kurtmckee closed 2 years ago

kurtmckee commented 3 years ago

Hi Ned! I'm looking for a way to read the app version from the pyproject.toml file, which is used as the single source of metadata truth in several projects I've started working on.

I'd like to contribute support for this ASAP but I wanted to first ask what your thoughts are regarding this? It appears that you've already teed up additional use of literal: for this purpose...what syntax would you envision for this in the scriv configuration? Would something this be an option:

version = "literal: pyproject.toml: tool.poetry.version"

tool.poetry.version would get resolved to dictionary traversal of the loaded TOML file (like config["tool"]["poetry"]["version"]).

If this proposal sounds reasonable I'll cook up a PR with some tests and submit that for your review.

Thanks for your work on scriv, it's a great tool to work with!

nedbat commented 3 years ago

Hi Kurt, thanks. Just for concreteness, can you link me to one of your projects that would use it this way?

kurtmckee commented 3 years ago

Thanks for the quick response! I've started working at a company that has recently introduced scriv to several public repos. Here's the one where I encountered this scriv/TOML combo:

https://github.com/globus/globus-automate-client