Hi - I'm trying out the new environments feature i...
# general
p
Hi - I'm trying out the new environments feature in 2.15.0a0 and I'm running into the following issue:
Copy code
raise InvalidFieldException(
pants.engine.target.InvalidFieldException: Unrecognized field `environment=local_docker` in target src/database:funstuff. Valid fields for the target type `pex_binary`: ['complete_platforms', 'dependencies', 'description', 'emit_warnings', 'entry_point', 'execution_mode', 'ignore_errors', 'include_requirements', 'include_sources', 'include_tools', 'inherit_path', 'interpreter_constraints', 'layout', 'output_path', 'platforms', 'resolve', 'resolve_local_platforms', 'restartable', 'script', 'shebang', 'strip_pex_env', 'tags', 'venv_site_packages_copies'].
I just want to confirm that I have 2.15.0a0 set up properly, since it looks like my pex_binary target isn't accepting
environment
as a field: • I set
pants_version
to 2.15.0a0 • In pants.toml, I set
[environments-preview.names]
to
local_docker="//:local_docker"
• In my topmost BUILD file I added:
Copy code
docker_environment(
    name="local_docker",
    platform="linux_x86_64",
    image="python:3.9-bullseye",
)
• Lastly, in src/database/BUILD I added:
Copy code
pex_binary(
    name="funstuff",
    entry_point="funstuff.py",
    environment="local_docker",
)

docker_image(
    name="docker_image",
    instructions=[
        "FROM python:3.9-bullseye",
        'ENTRYPOINT ["/main"]',
        "COPY examples/main.pex /main",
    ],
)
(funstuff.py is just a hello-world Python script). Definitely understand that this is an alpha build but I figured this is likely a basic error w/ something I'm msising. Help would be appreciated - thank you!
w
mmm: it looks like
pex_binary
didn’t actually get its
environment=
field: sorry for the oversight! we’ll get a change out for that tomorrow.
p
No worries - thank you for the quick response!
a
Just getting a fix into
main
now!
i
Thank you! @ancient-vegetable-10556 Are we good to try it out?
a
@incalculable-hydrogen-44003 You may have to use
PANTS_SHA
to invoke it, as there isn’t a release yet, but if you’re OK with that, then yes!
i
ok. we will give it a shot
I get these errors when I run with the SHA
Copy code
A deprecated alias for `[python-repos].find_links`.
12:01:42.32 [ERROR] Invalid option 'tailor_ignore_solitary_init_files' under [python] in /home/sepehr500/Documents/starkblast/pants.toml
12:01:42.32 [ERROR] Invalid option 'inits' under [python-infer] in /home/sepehr500/Documents/starkblast/pants.toml
12:01:42.32 [ERROR] Invalid config entries detected. See log for details on which entries to update or remove.
(Specify --no-verify-config to disable this check.)
Were these options removed?
a
Not sure which sha you’re trying, but if you got a sha from main instead of the release branch, try
34c5cd8f22d9db60c4478824cbdc17932b15457c
first
i
2de6f77ee6dfb4acf89e45f5e3b9ec7cb8ebdb11
a
options shouldn’t have disappeared after 2.15.0a1 went out
i
ok. will give that sha a shot
a
2de…
is on
main
, which will have the 2.16 API, not the 2.15 API
i
got it
a
34c….
is on
2.15.x
i
ERROR: No matching distribution found for pantsbuild.pants==2.15.0a0+git34c5cd8f
with sha
34c5cd8f22d9db60c4478824cbdc17932b15457c
a
how are you running pants?
i
PANTS_SHA=34c5cd8f22d9db60c4478824cbdc17932b15457c ./pants package src/cort/manage.py -- runserver 0.0.0.0:8000 --noreload
a
hmm ok
that seems right, and it’s failing for me similarly
OK, I’ve figured it out. Using
PANTS_SHA
goes and looks for a wheel that has been built in CI.
34c
did not have a wheel uploaded. I went back through commits in the 2.15.x branch, and this one has the fix available, and is ready to go:
217edbcdc37b3005abb96911f1e65a7d6b938669
i
ok. thanks. will give it a shot
hmm...getting the same error
Copy code
A deprecated alias for `[python-repos].find_links`.
12:01:42.32 [ERROR] Invalid option 'tailor_ignore_solitary_init_files' under [python] in /home/sepehr500/Documents/starkblast/pants.toml
12:01:42.32 [ERROR] Invalid option 'inits' under [python-infer] in /home/sepehr500/Documents/starkblast/pants.toml
12:01:42.32 [ERROR] Invalid config entries detected. See log for details on which entries to update or remove.
(Specify --no-verify-config to disable this check.)
a
OK, I’m not 100% across changes made to tailor. That’s usually Eric’s role, but they’re out today
i
ok. no worries. thanks
So would you say at the moment there is no way to test out cross-platform builds?
because of the pex
environment=
issue?
a
There is no way to test it on a published version of Pants. You can use that sha I sent — try using
--no-verify-config
to switch off the errors. There may be a way to adjust your config to silence those errors, but
--no-verify-config
is at least a starting point
make sure you can successfully do a single-environment build first though
w
@incalculable-hydrogen-44003: what version were you using previously? we recommend updating 1 minor version at a time (2.13 -> 2.14, 2.14 -> 2.15, etc)
things shouldn’t be removed without deprecations: if they were, it’s a bug
i
we are on 13. I can bump to 15 see what happens
tried out
2.15.0a0
and got
nvalid option 'tailor_ignore_solitary_init_files'
I guess they were removed?
w
@incalculable-hydrogen-44003: what i am saying is that you should upgrade to 2.14 successfully before trying to go to 2.15*
but yes: in 2.14 you should see a deprecation for that option
i
ok. trying that now
w
i
hm...ya got
Invalid option 'inits'
on 2.14.0
I guess I will look at the changelog for deprecation
w
let’s start a new thread for this: you’ll need to do the 2.14 upgrade before trying to jump to 2.15
i
sounds good. sorry about that
w
and fix any deprecations you already have on 2.13
and regarding not being able to use PANTS_SHA for some builds: those are likely “docs only” builds, which won’t build wheels
i
Getting this error after fixing deprecation errors
[Errno 2] No such file or directory: '/tmp/pants-sandbox-hFwPns/.tmp/pex-pip-log.ck6i41a7/pip.log'
on the sha
217edbcdc37b3005abb96911f1e65a7d6b938669
w
that’s probably unrelated to this thread, but we’d be happy to help debug it… can you open a new thread with some more context? alpha releases are … alpha
i
yup!