square-pharmacist-6024305/26/2022, 8:54 AM
to the roots.
When I run
, I see two
files added, one in
, the other in
Why isn’t there a
if that is the root?
it has generated a
entry with name
. When I as a developer add a
file under a Python package (
in this case), its goal is to provide a standard entrypoint for the package, not entrypoint in itself as if
(which is what name
looks to me).
If I want to make
package into something that other subprojects can depend on, where do I declare that it “publishes” the sources under name
? Intuitively, I would put it under
because that directory (
) sees the Python package
in its entirety. But this seems to not match what
generates. If I put it under
, will the contents be under
Python package namespace?
curved-television-656805/26/2022, 9:04 AM
Why isn’t there aPants tailor will only createfile in
BUILDif that is the root?
files where there are “targets” that needs to be declared. If you don’t have any files there, then there are no targets to declare there (you may want to create a BUILD file there for a
perhaps, but that will be a manual operation)
Now, inI’m not sure about theit has generated a
src/py/sub-project/sub_project/BUILDentry with name
__main__. When I as a developer add a
entry_point="__main__.py"file under a Python package (
__main__.pyin this case), its goal is to provide a standard entrypoint for the package, not entrypoint in itself as if
__main__.py(which is what name
__main__looks to me).
thing, but this usually does the right thing. When you package that
you will have an executable that when you run it, will execute your
as expected, and any sources that it depends on will be included in the pex.
If I want to makeYou should just be able to import the sources as-is. When it comes to packaging, you may split your sources into different distributions, in which case you will get proper install requires dependencies between those distributions as required. https://www.pantsbuild.org/docs/python-distributions So, to be clear, the BUILD files placements does not affect your package names to use for importing your python modules. That is solely the source roots, and where you have yourpackage into something that other subprojects can depend on, where do I declare that it “publishes” the sources under name
files (for namespace packages etc) and how the source files are laid out in your source tree. Then all your sources needs to be “owned” by
targets in order for Pants to be able to do its dependency inference magic, and later also for packaging/testing/formatting/linting etc…
square-pharmacist-6024305/26/2022, 9:42 AM
happy-kitchen-8948205/26/2022, 1:42 PM
as a source root