flat-sunset-36133
07/31/2024, 2:24 PMThe file or directory 'app.py' does not exist on disk in the workspace, so the address 'app.py' from the dependencies field from the target src/py/olx/apps/MolStandardizerWebApp:dev cannot be resolved.
When trying to run
pants package src/py/olx/apps/MolStandardizerWebApp:dev
This is what the src/py/olx/apps/MolStandardizerWebApp/BUILD file looks like:
python_sources()
py_app_visibility(name="MolStandardizerWebApp",)
pex_binary(
name="dev",
script="streamlit",
args=["run", "app.py"],
execution_mode="venv",
dependencies = ["app.py",],
)
And my code is structured in the following way:
src/py/olx/apps/MolStandardizerWebApp/
├── BUILD
├── __init__.py
├── app.py
├── evaluate_smiles.py
├── run_streamlit.py
├── tests
│ ├── BUILD
│ ├── __init__.py
│ ├── constants.py
│ └── test_evaluate_smiles.py
└── utils.py
The weird thing is when I run pants list ::
at the root of my monorepo I can see that src/py/olx/apps/MolStandardizerWebApp/app.py
is listed, so why isn't it discoverable in my workspace?wide-midnight-78598
07/31/2024, 7:46 PMpython_sources(
name="foo"
)
pex_binary(
...
dependencies=[:foo]
flat-sunset-36133
07/31/2024, 7:47 PMflat-sunset-36133
07/31/2024, 7:50 PM19:49:27.86 [INFO] Completed: Building 3 requirements for src.py.olx.apps.MolStandardizerWebApp/dev.pex from the 3rdparty/py/default.lock resolve: datamol, rdkit==2023.09.5, streamlit
19:49:27.86 [WARN] /home/codespace/.cache/pants/named_caches/pex_root/installed_wheels/8d43c1ed16877f3d2ed39e5ef3e92aa8885d4427cd7d9ce62683c922a5c0cd07/pex-2.3.1-py2.py3-none-any.whl/pex/bin/pex.py:947: PEXWarning: Could not calculate a targeted shebang for:
cp310-cp310-manylinux_2_31_x86_64 interpreter at /workspaces/olx-code/.venv/bin/python3
cp312-cp312-manylinux_2_31_x86_64 interpreter at /opt/conda/bin/python3.12
Using shebang: #!/usr/bin/env python3.10
If this is not appropriate, you can specify a custom shebang using the --python-shebang option.
pex_warnings.warn(
Usage: dev.pex run [OPTIONS] TARGET [ARGS]...
Try 'dev.pex run --help' for help.
Error: Invalid value: File does not exist: app.py
flat-sunset-36133
07/31/2024, 7:50 PMpython_sources(name="app.py")
py_app_visibility(name="MolStandardizerWebApp",)
pex_binary(
name="dev",
script="streamlit",
args=["run", "app.py"],
execution_mode="venv",
dependencies = [":app.py"],
)
flat-sunset-36133
07/31/2024, 7:52 PMpython_sources(name="app")
py_app_visibility(name="MolStandardizerWebApp",)
pex_binary(
name="dev",
script="streamlit",
args=["run", "app.py"],
execution_mode="venv",
dependencies = [":app"],
)
wide-midnight-78598
07/31/2024, 7:57 PMwide-midnight-78598
07/31/2024, 7:57 PMwide-midnight-78598
07/31/2024, 8:07 PM# requirements.txt
streamlit
# pants.toml
[GLOBAL]
pants_version = "2.21.1"
backend_packages = [
"pants.backend.python",
]
[python]
enable_resolves = true
interpreter_constraints = ["==3.12.4"]
# BUILD
python_requirements(
name="reqs",
)
python_sources(
name="lib"
)
pex_binary(
name="bin",
dependencies=[":lib", "//:reqs#streamlit"],
script="streamlit",
args=["run", "app.py"],
include_tools=True,
)
wide-midnight-78598
07/31/2024, 8:07 PMpants run //:bin
👋 Welcome to Streamlit!
flat-sunset-36133
07/31/2024, 8:17 PMflat-sunset-36133
07/31/2024, 8:20 PMflat-sunset-36133
07/31/2024, 8:22 PMwide-midnight-78598
07/31/2024, 8:24 PM