alert-beard-13327
10/22/2024, 4:47 PMpython_sources(
name="healthdash_sources",
sources=["healthdash/**/*.py"],
)
pex_binary(
name="healthdash_app",
entry_point="healthdash.NOC_Pod_Overview",
dependencies=[
":healthdash_sources",
],
)
poetry_requirements(
name="poetry",
)
And my pyproject.toml looks like:
[tool.poetry]
name = "healthdash"
version = "0.1.0"
description = ""
authors = ["REDACTED <REDACTED@website.net>"]
readme = "README.md"
[tool.poetry.dependencies]
python = ">=3.10,<4.0"
streamlit = ">=1.28.1"
httpx = { extras = ["http2"], version = ">=0.25.1" }
logicmonitor-sdk = ">=3.0.172"
confz = ">=2.0.1"
pymssql = ">=2.2.11"
altair = "^5.4.0"
skykick = { path = "../../lib/skykick/", develop = true }
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
In my entrypoint, NOC_Pod_Overview, I have an import skykick statement. My understanding is that pants should automatically infer that dependency and look where the poetry file says it should be, but maybe I'm misunderstanding how Pants reads from pyproject.toml?alert-beard-13327
10/22/2024, 4:48 PMModuleNotFoundError: No module named 'skykick'alert-beard-13327
10/22/2024, 5:01 PMelegant-florist-94385
10/22/2024, 5:28 PM../../lib is listed as a source root, you should just be able to import it and use it without even listing it in your pyproject.tomlelegant-florist-94385
10/22/2024, 5:29 PMalert-beard-13327
10/22/2024, 5:54 PMelegant-florist-94385
10/22/2024, 6:59 PMsrc/python directory that is listed as a source root in pants.toml (and set as part of my PYTHONPATH for the sake of VS code).
within src/python I have internal_lib_1, project_1, project_2 where the internal lib is meant to be shared, and project 1 and 2 are project specific.
All of my imports are from internal_lib_1 import something or import internal_lib_1happy-kitchen-89482
10/22/2024, 11:59 PMskykick stanza in [tool.poetry.dependencies]. Pants can read 3rdparty dependencies (i.e., those specified by a name and version constraint) from there, but internal deps from other parts of the repo are inferred internally. You just need the source root to be configured. You don’t need relative imports.