Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sibling-package-imports #1

Open
yazdipour opened this issue Jul 9, 2023 · 0 comments
Open

Fix sibling-package-imports #1

yazdipour opened this issue Jul 9, 2023 · 0 comments

Comments

@yazdipour
Copy link
Owner

yazdipour commented Jul 9, 2023

Title: Setup.py Update Needed for Improved Importing of Components


Description

Currently, our project uses a workaround that requires manually adding the components folder to the sys.path for it to be imported from anywhere in the project. The relevant code snippet is shown below:

# TODO: fix this hack with a proper setup.py
# Things to do: In setup.py, add a command to copy the components folder to the site-packages folder
# Then, in omnivorex.py, add the site-packages folder to the sys.path
# This will allow the components folder to be imported from anywhere
# Use this as a reference: https://stackoverflow.com/questions/6323860/sibling-package-imports
# sys.path.append(os.path.dirname(os.path.realpath(__file__)))
import omnivorex.utils as utils
from omnivorex.components.article_item import ArticleItem
from omnivorex.components.login_screen import LoginScreen

Tasks

  • Update setup.py to include a command to copy the components folder to the site-packages directory.
  • In omnivorex.py, update sys.path to include the site-packages directory.
  • Verify that the components folder can be imported from anywhere in the project.
  • Remove the manual addition of the components folder to sys.path.

Acceptance Criteria

  • The components folder is automatically copied to the site-packages directory during setup.
  • The omnivorex.py file automatically includes the site-packages directory in sys.path.
  • Components can be imported from anywhere in the project without manual intervention.
  • All existing functionality remains intact and passes all tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant