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

Remove relative imports, use "best practices" python module importing #246

Closed
schuylermartin45 opened this issue Jun 8, 2023 · 1 comment

Comments

@schuylermartin45
Copy link
Collaborator

schuylermartin45 commented Jun 8, 2023

As discussed in the last meeting, and exemplified by this PR we need to move away from using relative Python imports and use the "best/fully-sanctioned" method of managing Python modules in a project.

I've run into Python module issues several times in my career and I can never remember exactly what "the right way" to do it is, but I think we have to setup the directory structure such that there is one top-level module so that all submodules can "see" each other.

Something along the lines of:

src/
|-- anaconda-linter/
  |-- run.py
  |-- lint/
    |-- check_foobar.py
  |--...
|-- scripts/
  |-- foo.py
  |-- bar.py
  |-- ...
test/
|-- test_blah.py
|-- ...

The most important part is I think we have to remove all uses of relative imports. I believe that is the root cause of most of our current module issues.

@schuylermartin45
Copy link
Collaborator Author

I did this a few weeks ago. Closing.

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