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

TYP: Replace wildcardimports in toplevelinit as precursor for reshape,stata,io PRs #25936 #25940 #25939 #26019

Conversation

ryankarlos
Copy link
Contributor

@ryankarlos ryankarlos commented Apr 7, 2019

@ryankarlos ryankarlos changed the title Replace wildcardimports in toplevelinit as precursor for reshape,stata,io p rs #25936 #25940 #25939 Replace wildcardimports in toplevelinit as precursor for reshape,stata,io PRs #25936 #25940 #25939 Apr 7, 2019
@ryankarlos
Copy link
Contributor Author

@WillAyd Since im working on PRs #25936 #25940 #25939 which all depend on this top level import - thought it would make sense to replace wildcard imports for stata, reshape and io modules at the same time.

@WillAyd
Copy link
Member

WillAyd commented Apr 7, 2019

I think you can still import from the apis exposed by each package but just need to list out the object that you are pulling in. Does that no work with Mypy?

@ryankarlos
Copy link
Contributor Author

So the only error that mypy throws is this -
pandas/__init__.py:70: error: Module 'pandas._libs' has no attribute 'join'

Theres a lot of other modules in those apis which do not particularly affect the reshape, stata PRs that i am working on but Ive I've included them in in case they need to be imported via top level from other modules in the future.

@jreback jreback added the Typing type annotations, mypy/pyright type checking label Apr 7, 2019
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this must be very precisely done, IOW importing names explicity as we have tests which exactly guaranteee these imports are no more and no less what is actually imported

@ryankarlos ryankarlos force-pushed the Replace_wildcardimports_in_toplevelinit_as_precursor_for_reshape,stata,io_PRs_#25936_#25940_#25939 branch from b55ca28 to 3dd505e Compare April 7, 2019 22:39
@ryankarlos ryankarlos force-pushed the Replace_wildcardimports_in_toplevelinit_as_precursor_for_reshape,stata,io_PRs_#25936_#25940_#25939 branch from 3dd505e to 7aa943b Compare April 7, 2019 22:57
@codecov
Copy link

codecov bot commented Apr 7, 2019

Codecov Report

Merging #26019 into master will decrease coverage by 51.1%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #26019       +/-   ##
===========================================
- Coverage   91.82%   40.72%   -51.11%     
===========================================
  Files         175      175               
  Lines       52536    52536               
===========================================
- Hits        48243    21397    -26846     
- Misses       4293    31139    +26846
Flag Coverage Δ
#multiple ?
#single 40.72% <ø> (-0.14%) ⬇️
Impacted Files Coverage Δ
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-99.37%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.16%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.1%) ⬇️
pandas/core/tools/numeric.py 10.44% <0%> (-89.56%) ⬇️
pandas/io/s3.py 0% <0%> (-89.48%) ⬇️
... and 130 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d2f9228...7aa943b. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 7, 2019

Codecov Report

Merging #26019 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26019      +/-   ##
==========================================
- Coverage   91.84%   91.83%   -0.01%     
==========================================
  Files         175      175              
  Lines       52517    52517              
==========================================
- Hits        48233    48228       -5     
- Misses       4284     4289       +5
Flag Coverage Δ
#multiple 90.39% <ø> (ø) ⬆️
#single 40.72% <ø> (-0.13%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 75% <0%> (-12.5%) ⬇️
pandas/core/frame.py 96.79% <0%> (-0.12%) ⬇️
pandas/util/testing.py 90.62% <0%> (-0.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f6b90a...f519a03. Read the comment docs.

@WillAyd WillAyd added this to the 0.25.0 milestone Apr 7, 2019
@ryankarlos
Copy link
Contributor Author

ryankarlos commented Apr 7, 2019

@jreback @WillAyd Thanks for the reviews, i've pushed latest changes - all green now.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is still one wildcard import for NumPy compat - can you take a look at that here?

from pandas.tseries.api import *
from pandas.core.computation.api import *
from pandas.core.reshape.api import *
from pandas.core.api import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you organize these by section, e.g. something like

from pandas.core.api import (
    # dtype
    Int8Dtype.........

   # indexes
    Int64Index.....

  # tseries
   NaT, Period.....

  # conversion
   to_numeric, to_datetime...

  # missing
   isna, isnul.....

  # misc
  np, TimeGrouper....

from pandas.io.api import *

from pandas.io.api import (
read_clipboard, ExcelFile, ExcelWriter, read_excel,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you sort these

…place_wildcardimports_in_toplevelinit_as_precursor_for_reshape,stata,io_PRs_#25936_#25940_#25939
@pep8speaks
Copy link

pep8speaks commented Apr 9, 2019

Hello @ryankarlos! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-04-10 00:38:29 UTC

@ryankarlos ryankarlos force-pushed the Replace_wildcardimports_in_toplevelinit_as_precursor_for_reshape,stata,io_PRs_#25936_#25940_#25939 branch from 1d5cae3 to e21eb72 Compare April 9, 2019 23:36
@ryankarlos
Copy link
Contributor Author

@jreback @WillAyd pushed latest changes through

@jreback jreback merged commit 9d66bdf into pandas-dev:master Apr 10, 2019
@jreback
Copy link
Contributor

jreback commented Apr 10, 2019

thanks @ryankarlos

@jreback
Copy link
Contributor

jreback commented Apr 10, 2019

if you’d merge master and update any typing PRs can get them in

@ryankarlos ryankarlos deleted the Replace_wildcardimports_in_toplevelinit_as_precursor_for_reshape,stata,io_PRs_#25936_#25940_#25939 branch April 10, 2019 02:11
@ryankarlos
Copy link
Contributor Author

Thanks @jreback , pushed latest updates for dependant PRs #25936 #25940 #25939

@ryankarlos ryankarlos changed the title Replace wildcardimports in toplevelinit as precursor for reshape,stata,io PRs #25936 #25940 #25939 TYP: Replace wildcardimports in toplevelinit as precursor for reshape,stata,io PRs #25936 #25940 #25939 Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants