-
Notifications
You must be signed in to change notification settings - Fork 75
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
Simplify Module Imports by Avoiding Modification of sys.path
#122
Comments
I have already tested this locally. Let me know if these changes can help. Open for discussion. |
Makes sense to me, @shashank-iitbhu! Feel free to send along a PR 🚀 I'll send along the structure changes right now, so if you could bring those into your branch before that'd be great 😊 |
2b72e64 just sent along the directory structure update, @shashank-iitbhu, so you're good to pull in the changes and send along a PR for this :) |
Opened a PR for these changes. |
@andrewtavis and @shashank-iitbhu please is this issue still opened? |
I have linked a PR above, haven't been merged yet. It's still under review. |
* remove modification of sys.path Signed-off-by: Shashank Mittal <[email protected]> * remove unnecessary imports Signed-off-by: Shashank Mittal <[email protected]> * ruff check Signed-off-by: Shashank Mittal <[email protected]> * #122 update docs with directions to pip install the local version --------- Signed-off-by: Shashank Mittal <[email protected]> Co-authored-by: Andrew Tavis McAllister <[email protected]>
Closed in #123 🚀 Thank you, @shashank-iitbhu! |
Terms
Behavior
Description
Currently, in several scripts within the Scribe-Data project, we are modifying
sys.path
to include thesrc/scribe_data
directory to ensure that thescribe_data
module can be imported correctly. For example,This can lead to potential issues with import resolution and is generally not considered a best practice.
Suggested Changes
sys.path
.from scribe_data import module_name
pip install -e .
from the project root directory. This allows for testing changes to the code without needing to reinstall the package.sys.path
list to determine where to look for modules to import. After we have built the modules usingpip install -e .
, thescribe_data
module will already be present insys.path
as it already has path to pip packages and then we do not need to addsrc/scribe_data
explicitly tosys.path
.The text was updated successfully, but these errors were encountered: