Is there a way to get a version number into a `BUI...
# general
j
Is there a way to get a version number into a `BUILD`'s target? We are evaluating different ways of adding metadata to our projects and debating if it is worth adding other files.
h
Not sure I understand, can you give an example?
You mean the Pants version?
Or your version?
j
My version
Say a library is at version 1.0.1. Instead of having a
VERSION
file in the directory with the code or some other system, is there a way to put it in the
python_library
target metadata?
Copy code
python_library(
    name = 'greet',
    sources = ['*.py', '!*_test.py'],
    dependencies = [
        "//:translate",
        ":greetings",
        "helloworld/util"
    ],
    compatibility = ">=3.6",
    version = "1.0.1",
)
☝🏽 1
Maybe this is a bad idea, but we are working on improving our automated builds. So of course I thought of
BUILD
😈
I guess I'd call it the target version.
h
Interesting. And that version would get embedded into the code?
j
Into the build artifact
milk-py3-1.0.1.whl
for sure. I guess some code might need it (e.g.
milk --version
would return
1.0.1
).
I guess I am seeing
BUILD
as solving some of the problems
pyproject.toml
solves.