Hey, I’m trying to use my own setup.py. I have a B...
# general
e
Hey, I’m trying to use my own setup.py. I have a BUILD file with the following configuration, python_distribution( name=“django_shared”, dependencies=[ ], provides=python_artifact( name=“django_shared”, version=“0.1.0”, ), wheel_config_settings={“--global-option”: [“--python-tag”, “py3"]}, generate_setup=False, ) And on the same the directory I have a setup.py file setup( name=“django_shared”, version=“0.1.0", packages=find_packages(exclude=[“tests”]), package_dir={“django_shared”: “django_shared”}, install_requires=[“django_ninja”], ) But when I try to run ./pant package :: I end up with a file named UNKNOWN-0.0.0-py3-none-any.whl Someone knows how it works ? And could guide me on this ?
e
You're missing a dependency on the
setup.py
file in the
python_distribution
target. The closest example is here (though it's for
pyproject.toml
and not
setup.py
): https://www.pantsbuild.org/docs/python-distributions So you need to similarly add a resource target and depend on it:
Copy code
resource(name="setup", source="setup.py")

python_distribution(
  ...
  dependencies=[":setup"],
  ...
)
e
Thanks I’m trying 🙂
It still doesn’t work 😕 I try to check the package that I’ve been created, and the code is missing inside I just have the egg-info folder. When I try to execute the ‘python setup.py install’, It’s telling me that I have to remove the file BUILD in order to create a build folder. Did you already encounter this case ?
e
You probably need to change the resources target to a
python_sources(name=..., sources=["**/*.py"])
target to capture all the other python files in the project (not just
setup.py
).
e
It works thanks a lot, I appreciate your help 🙏