Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when depending on files targets in a pex_binary or python_awslambda #11659

Merged
merged 1 commit into from Mar 10, 2021

Conversation

Eric-Arellano
Copy link
Contributor

@Eric-Arellano Eric-Arellano commented Mar 10, 2021

One of our most common reported gotchas is confusion why files targets are not showing up with pex_binary. #11551 attempted to fix this by simply including the files, but it turned out much more complex than I expected, including:

  1. Requiring the user to set the binary to unzip or venv mode (not the default), and
  2. Using __file__ to anchor the relpath, which behaves differently between ./pants package and ./pants run.

While we may still want to allow including files if we can address the above, this improves the status quo. It corresponds with new docs warnings:

Example warning:

The pex_binary target src/py/project transitively depends on the below files targets, but Pants will not include them in the PEX. Filesystem APIs like open() are not able to load files within the binary itself; instead, they read from the current working directory.

Instead, use resources targets or wrap this pex_binary in an archive. See https://www.pantsbuild.org/v2.4/docs/resources.

Files targets dependencies: ['assets/f.txt:files', 'assets:relocated']

[ci skip-rust]

…wslambda`

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants