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

chore: convert to using relative imports #1728

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JohnVillalovos
Copy link
Member

@JohnVillalovos JohnVillalovos commented Dec 5, 2021

First commit renames gitlab/__version__.py to gitlab.version.py to minimize confusion.

Switch to using relative imports to ensure that we are importing from
within our library.

Also use the form:
from foo import bar as bar
When we want to signify that we want the import to be re-exported.

https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2021

Codecov Report

Merging #1728 (6b3e7c0) into main (c6d7e9a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1728   +/-   ##
=======================================
  Coverage   92.02%   92.03%           
=======================================
  Files          76       76           
  Lines        4790     4793    +3     
=======================================
+ Hits         4408     4411    +3     
  Misses        382      382           
Flag Coverage Δ
cli_func_v4 81.38% <96.66%> (+0.01%) ⬆️
py_func_v4 80.24% <86.29%> (+0.03%) ⬆️
unit 83.18% <93.70%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/version.py 100.00% <ø> (ø)
gitlab/__init__.py 100.00% <100.00%> (ø)
gitlab/__main__.py 100.00% <100.00%> (ø)
gitlab/base.py 90.22% <100.00%> (ø)
gitlab/cli.py 98.40% <100.00%> (+0.03%) ⬆️
gitlab/client.py 90.51% <100.00%> (-0.05%) ⬇️
gitlab/config.py 94.44% <100.00%> (ø)
gitlab/const.py 100.00% <100.00%> (ø)
gitlab/mixins.py 91.52% <100.00%> (-0.03%) ⬇️
gitlab/v4/cli.py 81.25% <100.00%> (-0.14%) ⬇️
... and 61 more

@JohnVillalovos JohnVillalovos marked this pull request as draft December 5, 2021 20:05
@JohnVillalovos JohnVillalovos marked this pull request as ready for review December 5, 2021 20:12
nejch

This comment was marked as outdated.

@JohnVillalovos
Copy link
Member Author

Note 834677e is only a rebase with no functional changes. Had conflicts after another PR merged. Will work on fixing things in regards to comments later on today most likely.

@JohnVillalovos JohnVillalovos force-pushed the jlvillal/relative_imports branch 6 times, most recently from c2dca37 to 9afb42f Compare December 16, 2021 01:25
@JohnVillalovos JohnVillalovos force-pushed the jlvillal/relative_imports branch 2 times, most recently from 7da5ac0 to c873c92 Compare December 24, 2021 04:46
It was confusing having __version__.py as we were importing the
__version__ variable from __version__.py into the top-level namespace
while also having __version__.py. So depending where we were in the
import chain __version__ could refer to the module __version__.py or
it could refer to the variable __version__
Switch to using relative imports to ensure that we are importing from
within our library.

Also use the form:
  from foo import bar as bar
When we want to signify that we want the import to be re-exported.

https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport
@JohnVillalovos JohnVillalovos marked this pull request as draft February 12, 2022 16:53
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

Successfully merging this pull request may close these issues.

None yet

3 participants