bright-pilot-85305
11/13/2022, 9:02 PMpython_distribution
) where I get the version from the current git tag? Is there a way to do this without writing my own plugin?curved-television-6568
11/13/2022, 10:43 PMvcs_version
target that lets you update a version string in some arbitrary source file.
See: https://www.pantsbuild.org/docs/generating-version-tagsbright-pilot-85305
11/14/2022, 4:10 PMbright-pilot-85305
11/14/2022, 4:10 PMcurved-television-6568
11/14/2022, 4:24 PMvcs_version
target: https://www.pantsbuild.org/v2.15/docs/reference-setuptools-scm
I’ll defer to @happy-kitchen-89482 in case he has a better answer for you 🙂happy-kitchen-89482
11/14/2022, 7:20 PMvcs_version
doesn’t modify a checked-in source file, it’s a code generator. So it should do what you want.bright-pilot-85305
11/15/2022, 12:38 AMpackage-<version>-py3-whatever.whl
built and uploaded to pypi? Like I'm getting a Missing a 'version' kwarg in the 'provides' field
when I try to package without putting a hardcoded version in python_artifact
. I'm trying to use
python_distribution(
name="library",
provides=python_artifact(
name="library",
description="Long description here",
author_email="Me <my@email.com>",
),
generate_setup=True,
interpreter_constraints=["CPython>=3.10.0"],
sdist=False,
skip_twine=True,
)
happy-kitchen-89482
11/15/2022, 1:14 AMhappy-kitchen-89482
11/15/2022, 1:14 AMhappy-kitchen-89482
11/15/2022, 1:14 AMhappy-kitchen-89482
11/15/2022, 1:14 AMfuture-oxygen-10553
11/15/2022, 3:37 PMfaint-dress-64989
01/25/2023, 9:55 PMhappy-kitchen-89482
01/26/2023, 2:04 AMfaint-dress-64989
01/26/2023, 2:55 PMhappy-kitchen-89482
01/26/2023, 9:09 PMhappy-kitchen-89482
01/26/2023, 9:10 PMbrave-smartphone-45640
02/20/2024, 4:16 PMpython_distribution
target.
Would also be happy to contribute this under some guidance!
Thanks! 🙏square-psychiatrist-19087
02/20/2024, 6:14 PM#!/bin/sh
VERSION="${VERSION:-$(git describe --tags --dirty --match "[0-9\.]*" || echo 0.0.1)}"
export VERSION
then in `BUILD`:
python_distribution(
name="mydist",
...
provides=python_artifact(
name="mydist",
version=env("VERSION"),
...
),
)
We use this with docker images, but it should work with python_distribution toohappy-kitchen-89482
02/21/2024, 1:42 AMhappy-kitchen-89482
02/21/2024, 1:42 AMhappy-kitchen-89482
02/21/2024, 1:48 AMsquare-psychiatrist-19087
02/21/2024, 11:16 AMhappy-kitchen-89482
02/21/2024, 2:28 PMbrave-smartphone-45640
02/21/2024, 2:57 PMsquare-psychiatrist-19087
03/09/2024, 11:18 AMfresh-continent-76371
03/09/2024, 6:45 PMsquare-psychiatrist-19087
03/09/2024, 6:47 PMhappy-kitchen-89482
03/09/2024, 9:58 PMfresh-continent-76371
03/09/2024, 10:20 PMsetup_kwargs(..)
plugin. But this is limiting, only works for python_distrubutions(.. )
◦ https://github.com/rbuckland/pants-playground
◦ I would not put that into pantsbuild/pants
as it is limiting, the better way is my goal of read_file_contents(filename=..., [regex=...])
will be MUCH nicer.
◦ e..g
## read_file_contents proposal
python_distribution(
name = "simple_lib_wheel",
dependencies = [
"./src:sources",
":reqs"
],
generate_setup = True,
provides = python_artifact(
name = "my_simple_lib",
version_file = read_file_contents(filename="VERSION"),
long_description_file = read_file_contents(filenames=["README.md","CHANGELOG.md"]),
),
)
fresh-continent-76371
03/11/2024, 10:46 AMsquare-psychiatrist-19087
04/27/2024, 2:30 PMwould you be open to writing a short blog post about this@happy-kitchen-89482 Here you go https://github.com/pantsbuild/pantsbuild.org/pull/197/files