Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

setuptools - Trying to publish a pypi distribution in python that relies on other pypi distribution

Im trying to publish a small distribution in python to pypi.

I'm following the docs https://packaging.python.org/tutorials/packaging-projects/ which specifies that i should have the following directory format directory format.

However, my distribution is divided into class and a main file named app.py My format with the extra classes

My problem is that when i add a class and import it to the app file it doesn't get resolved. app is not able to see it.

Import "logic" could not be resolved

Can anyone help with this?

thank you

question from:https://stackoverflow.com/questions/65649810/trying-to-publish-a-pypi-distribution-in-python-that-relies-on-other-pypi-distri

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Well, for making a Python package that uses other modules, you have to specify what modules those are in your setup.py file. Here's something I personally used that I think you should check out, https://realpython.com/pypi-publish-python-package/. Anyways, basically, in your setup.py, you should be using setuptools.setup(). In that function, there is a parameter called install_requires. I believe that is the parameter where you specify all the packages needed for the package you're making. For example, install_requires=["apackage", "anotherpackage", "etc"]. Hope that makes sense!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...