plain-summer-72727
09/20/2022, 12:23 AMpython_sources(
name="lib",
dependencies=[
"//:root#auth0-python",
"//:root#django-admin-rangefilter",
...,
],
)
pex_binary(
name="manage",
entry_point="manage.py",
dependencies=[
":lib",
],
restartable=True,
)
My Django application has various HTML files, SQL files, and other non-Python files that are required for it to function. What's the typical pattern to make sure that these files are present in the PEX when running ./pants package src/myapp/manage.py
?gentle-sugar-52379
09/20/2022, 12:43 AMresources(name="templates", sources=["**/*.html"])
gentle-sugar-52379
09/20/2022, 12:45 AMpython_sources(dependencies=["./templates"])
plain-summer-72727
09/20/2022, 12:51 AMgentle-sugar-52379
09/20/2022, 12:53 AMplain-summer-72727
09/20/2022, 12:57 AMplain-summer-72727
09/20/2022, 1:01 AMpython_source(
name="lib",
dependencies=[
":non-py",
"...",
]
)
resources(
name="non-py",
sources=["!**/*.py"],
)
gentle-sugar-52379
09/20/2022, 1:01 AMgentle-sugar-52379
09/20/2022, 1:02 AMgentle-sugar-52379
09/20/2022, 1:02 AMgentle-sugar-52379
09/20/2022, 1:03 AMgentle-sugar-52379
09/20/2022, 1:04 AMgentle-sugar-52379
09/20/2022, 1:04 AMplain-summer-72727
09/20/2022, 1:11 AMenough-analyst-54434
09/20/2022, 2:33 AMjsirois@Gill-Windows:~/dev/pantsbuild/example-django (main) $ cat <<EOF > BUILD.experiment
resources(
name="non-py",
sources=["**/*", "!**/*.py"]
)
EOF
jsirois@Gill-Windows:~/dev/pantsbuild/example-django (main) $ ./pants filedeps //:non-py
.flake8
.gitignore
.isort.cfg
BUILD
BUILD.experiment
LICENSE
README.md
build-support/generate_constraints.sh
helloworld/BUILD
helloworld/greet/BUILD
helloworld/greet/migrations/BUILD
helloworld/person/BUILD
helloworld/person/migrations/BUILD
helloworld/service/admin/BUILD
helloworld/service/frontend/BUILD
helloworld/service/user/BUILD
helloworld/service/welcome/BUILD
helloworld/translate/BUILD
helloworld/translate/migrations/BUILD
helloworld/ui/BUILD
helloworld/ui/static/BUILD
helloworld/ui/static/helloworld/ui/helloworld.css
helloworld/ui/templates/BUILD
helloworld/ui/templates/helloworld/ui/index.html
helloworld/util/BUILD
lockfiles/mypy.txt
lockfiles/pytest.txt
lockfiles/python-default.txt
mypy.ini
pants
pants.ci.toml
pants.toml
pants_from_sources
pytest.ini
requirements.txt
enough-analyst-54434
09/20/2022, 2:34 AMresources
has no default globs. By defualt it captures nothing. So you need to have "***/**"
as the basis for "all" for the exclude to subtract from; otherwise you subtract from 0.plain-summer-72727
09/20/2022, 4:58 AM