-1

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

sinoroc
  • 18,409
  • 2
  • 39
  • 70
Omar Jarkas
  • 100
  • 5
  • 1
    Please, no screenshot. They are not practical for us to work with, use copy paste and good formatting as much as possible. Show your `setup.py`. See [an example of good formatting](https://stackoverflow.com/a/65408847). – sinoroc Jan 10 '21 at 09:16

1 Answers1

1

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!

Ayaan
  • 157
  • 1
  • 11
  • Thank you for answering the title. Actually, the title is wrong since I forgot the replace the title for my new question which is related to the body of the question. The body and the title are two different questions as you might have noticed. But thank you anyway, and if you can help in the body question that would be really helpful. – Omar Jarkas Jan 10 '21 at 04:11
  • Oh ok. Okay, so the problem you're getting could be because of a few reasons. Are you using a module in your package called logic? – Ayaan Jan 10 '21 at 04:27
  • Yes. I'm using the following imports import os import csv import json. however, when I remove them, the problem persists – Omar Jarkas Jan 10 '21 at 04:33
  • Huh, that's weird – Ayaan Jan 10 '21 at 16:47