Hi all, is there anyway to exclude a specific file...
# general
d
Hi all, is there anyway to exclude a specific file from a dependency from ending up in my pex?
Copy code
python_sources(
    name="root",
)

python_requirement(
    name="aenum",
    requirements=["aenum==3.1.15"],
)

pex_binary(
    name="app",
    entry_point="app.py",
    layout="loose",
)
After running
pants package :app
there’s a particular file
_py2.py
that I don’t want included
Copy code
ls dist/app.pex/.deps/aenum-3.1.15-py3-none-any.whl/aenum/_py2.py
dist/app.pex/.deps/aenum-3.1.15-py3-none-any.whl/aenum/_py2.py
Does pants let you control these files with any level of granularity?
b
Not files deep within a third-party dependency, that I know of. Some options: 1. post-processing the pex to get rid of it, before deploying it/running it (with
layout="loose"
this should be as easy as
rm .../_py2.py
) 2. describing more about the background and there might be another way to handle it 🤷‍♂️
d
Managed to get around it by running a step pre-deployment to remove the file from the zip if it exists. Long story short,
aenum
is a transitive dependency of one of our deps. We’re uploading this to google cloud, which runs
python3 -m compileall -f -q .
before deployment. The
_py2.py
contains a bunch of legacy py2 syntax that fails for py3
👍 1