Hi, with the following build i would expect the `v...
# general
c
Hi, with the following build i would expect the
version.txt
to be generated by the
vcs_version
and then able to use it in the
docker_image
Copy code
docker_image(
    name="website-preview",
    source="Containerfile",
    dependencies=[":sources", ":version"],
    repository="docapse/website",
    image_tags=["pr-{build_args.PULL_REQUEST}"],
    description="Build website preview docker image",
    extra_build_args=["PULL_REQUEST"],
)

vcs_version(
    name="version",
    generate_to="website/version.txt",
    template='{version}',
)
But this does not seem to work, not sure what i am missing
h
Yeah, today it generates a
python_source
target, specifically, rather than a resource, and I guess
docker_image
deps must be files/resources? Is that right @curved-television-6568?
It's on my TODO list to fix this
Or maybe in this case it's just that
docker_image
doesn't invoke codegen? I'll try and reproduce
c
Thanks for the answer that was my guess that it might not invoke codegen
side note: i did not find a way to list targets by goal, did i miss something?
also this page: https://www.pantsbuild.org/v2.15/docs/running-pants-from-sources link the pants_from_sources script from
example-python
but seems to have been removed since
f
Those docs should be updated. The scie-pants launcher binary can simulate
pants-from-sources
if it is symlinked as
pants-from-sources
or is invoked with
PANTS_SOURCE
environment variable set. The main installation docs at https://www.pantsbuild.org/docs/installation do mention the new launcher binary which means we should update the linked page as well.
c
so i guess the correct usage is
PANTS_SOURCE=../pants pants version
for example
It fails with
pants: failed to find suitable Python interpreter, looking for: 3.9
but i think it is another issue
f
can you provide the full log of the run?
c
hum that is basically the full log šŸ™‚
the folder ../pants is a clone of the current repo as main
python is 3.9 (default of Mac)
f
The scie-pants launcher should be downloading a standalone build of Python (i.e., from SCIE project). Weird that it reports it cannot find Python.
What version of scie-pants are you using?
actually, can you run:
Copy code
PANTS_BOOTSTRAP_VERSION=report pants
c
Copy code
PANTS_BOOTSTRAP_VERSION=report pants
0.6.0
if i use the scie-pants without the PANTS_SOURCE it works (within my test repo)
but
pants
command fails if i add the PANTS_SOURCE or if i use it inside the pants repo to try to build it
f
is your test repo something that can be shared externally?
so that an issue can be reported to scie-pants
c
nope sorry
Copy code
pants git:(main) pants
pants: failed to find suitable Python interpreter, looking for: 3.9
but this one is running
pants
as is inside the pants repository after having installed pants with
brew install pantsbuild/tap/pants
Copy code
MINI(āŽˆ|loopkube:github)āžœ  pants git:(2.16.x) pants version
pants: failed to find suitable Python interpreter, looking for: 3.9
MINI(āŽˆ|loopkube:github)āžœ  pants git:(2.16.x) git checkout 2.15.x
Switched to branch '2.15.x'
Your branch is up to date with 'origin/2.15.x'.
MINI(āŽˆ|loopkube:github)āžœ  pants git:(2.15.x) pants version
The `pants.toml` at /Users/loopingz/Git/pants/pants.toml has no `pants_version` configured in the `GLOBAL` section.
Would you like set `pants_version` to the latest stable release? (Y/n): n
Error: Isolates your Pants from the elements.
it looks like the 2.15.x branch is ok, but not 2.16.x or main
f
Are you using an ARM Mac?
c
Tes
+Y-T
f
?
c
i cannot edit my comment so it was a patch on
Tes
to
Yes
(sorry geek humor)
f
the
Tes
didn't get sent to my Slack client. weird.
which is why I was confused.
c
Oh that explain why i could not edit šŸ™‚
f
what is your system Python version?
c
Copy code
Python 3.9.6 (default, Mar 10 2023, 20:16:38) 
[Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Copy code
āœ— PANTS_SOURCE=../pants pants version # With main branch
pants: failed to find suitable Python interpreter, looking for: 3.9
āœ— PANTS_SOURCE=../pants pants version # With 2.16.x branch
pants: failed to find suitable Python interpreter, looking for: 3.9
āœ— PANTS_SOURCE=../pants pants version # With 2.15.x branch
/Users/loopingz/Git/pants/build-support/pants_venv: line 20: -c: command not found
Bootstrapping pants_deps with requirements:
  /Users/loopingz/Git/pants/3rdparty/python/requirements.txt
/Users/loopingz/Git/pants/build-support/pants_venv: line 20: -c: command not found
/Users/loopingz/Git/pants/build-support/pants_venv: line 20: -c: command not found
/Users/loopingz/Git/pants/build-support/pants_venv: line 33: : command not found

Failed to create venv.
f
try setting
PY=python3.9
c
with
3.9
it did not work but with
PY=python3 PANTS_SOURCE=../pants pants version
it moves forward
f
py_venv_version=$(${PY} --version | shasum | awk '{print $1}')
an empty PY would cause issues there
I suggest opening an issue for this since we should default that to
python
c
ok will do
f
or use a better source for the Python interpreter location
c
let me try with a 2.16.x branch to see if setting the PY=python3 would help
it seems to work now with newer branch, i guess the message was less verbose with newer versions
Thanks for your help
šŸ‘ 1
c
Yeah, today it generates a
python_source
target, specifically, rather than a resource, and I guess
docker_image
deps must be files/resources? Is that right @curved-television-6568?
It does use codegen, but only supports
file
sources (any other types are included after being `package`d, where applicable) # File sources https://github.com/pantsbuild/pants/blob/2417cfeaf5de9b8c4bcf2a847bffc03551c2f773/src/python/pants/backend/docker/util_rules/docker_build_context.py#L266-L278 # Package other deps, that support it: https://github.com/pantsbuild/pants/blob/2417cfeaf5de9b8c4bcf2a847bffc03551c2f773/src/python/pants/backend/docker/util_rules/docker_build_context.py#L291-L300
c
So i guess it should be move to
file
as it could be a jsonfile, a text file or a python file?