Skip to content

Move core.config to _config.config #25793

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

Merged
merged 18 commits into from
Mar 24, 2019
Merged

Conversation

jbrockmendel
Copy link
Member

and update imports. Move tests.test_config to tests.config.test_config.

Following this there will be one more follow-up that will 1) address the TODO in tests.config.test_localization, 2) fully disentangle tslibs from its dependency on core.

@jreback jreback added the Clean label Mar 20, 2019
@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #25793 into master will increase coverage by <.01%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25793      +/-   ##
==========================================
+ Coverage   91.26%   91.26%   +<.01%     
==========================================
  Files         173      174       +1     
  Lines       52982    52984       +2     
==========================================
+ Hits        48355    48357       +2     
  Misses       4627     4627
Flag Coverage Δ
#multiple 89.83% <92.85%> (ø) ⬆️
#single 41.76% <82.14%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/_config/config.py 86.82% <ø> (ø)
pandas/core/api.py 100% <ø> (ø) ⬆️
pandas/core/dtypes/dtypes.py 96.1% <0%> (ø) ⬆️
pandas/io/formats/console.py 86.27% <0%> (ø) ⬆️
pandas/core/computation/expressions.py 93.27% <100%> (ø) ⬆️
pandas/core/indexes/multi.py 95.62% <100%> (ø) ⬆️
pandas/io/formats/format.py 97.99% <100%> (ø) ⬆️
pandas/core/base.py 97.76% <100%> (ø) ⬆️
pandas/plotting/_core.py 83.65% <100%> (ø) ⬆️
pandas/io/formats/html.py 99.35% <100%> (ø) ⬆️
... and 17 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 fb11912...0e28708. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #25793 into master will increase coverage by <.01%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25793      +/-   ##
==========================================
+ Coverage   91.47%   91.47%   +<.01%     
==========================================
  Files         172      173       +1     
  Lines       52870    52872       +2     
==========================================
+ Hits        48362    48364       +2     
  Misses       4508     4508
Flag Coverage Δ
#multiple 90.03% <92.85%> (ø) ⬆️
#single 41.82% <82.14%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/_config/config.py 86.82% <ø> (ø)
pandas/core/api.py 100% <ø> (ø) ⬆️
pandas/core/dtypes/dtypes.py 96.1% <0%> (ø) ⬆️
pandas/io/formats/console.py 86.27% <0%> (ø) ⬆️
pandas/core/computation/expressions.py 93.27% <100%> (ø) ⬆️
pandas/core/indexes/multi.py 95.62% <100%> (ø) ⬆️
pandas/io/formats/format.py 97.99% <100%> (ø) ⬆️
pandas/core/base.py 97.76% <100%> (ø) ⬆️
pandas/plotting/_core.py 83.65% <100%> (ø) ⬆️
pandas/io/formats/html.py 99.35% <100%> (ø) ⬆️
... and 17 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 0f5a7e3...8655437. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Mar 20, 2019

ImportError while importing test module 'D:\a\1\s\pandas\tests\sparse\test_format.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pandas\tests\sparse\test_format.py:9: in <module>
    from pandas.core.config import option_context
E   ModuleNotFoundError: No module named 'pandas.core.config'
============================== warnings summary ================

@jbrockmendel
Copy link
Member Author

Fixed

@jreback jreback added this to the 0.25.0 milestone Mar 22, 2019
@jreback
Copy link
Contributor

jreback commented Mar 22, 2019

can you rebase

@jbrockmendel
Copy link
Member Author

rebased+green

@@ -30,6 +30,8 @@ from dateutil.relativedelta import relativedelta
from dateutil.parser import DEFAULTPARSER
from dateutil.parser import parse as du_parse

from pandas._config.config import get_option
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than reaching in, I would expose get_options, and company in pandas._config (in the 'all')?

@pep8speaks
Copy link

pep8speaks commented Mar 22, 2019

Hello @jbrockmendel! 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-03-24 15:48:29 UTC

@@ -36,6 +36,9 @@

from datetime import datetime

from pandas._config.config import (get_option, set_option, reset_option,
Copy link
Contributor

Choose a reason for hiding this comment

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

what I mean was to have all of these listed in the 'all' in pandas._config, then this can just be a * import and then you can always just from pandas._config import ..... rather than reaching into pandas._config.config (I know there are some cases of that but can fix those in a follow). this would make clear then this modules public api.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. Moved those into _config.__init__. Will update all the other imports on the next pass. Will ignore the "*" import idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will ignore the "*" import idea.

we do this for all api imports in pandas/init.py

Copy link
Member Author

Choose a reason for hiding this comment

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

... for now.

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.

needs a rebase. pls try to normalize all of the imports to import from pandas if at all possible (which should be fore all except: import pandas._config.config as cf which is used occasionally (want to clean those up too but can be a followup)

@@ -54,7 +54,7 @@ def test_format_sparse_display():


def test_repr_with_unicode_data():
with pd.core.config.option_context("display.encoding", 'UTF-8'):
with pd._config.config.option_context("display.encoding", 'UTF-8'):
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 just import option_context at the top

@@ -3,10 +3,11 @@

import numpy as np

from pandas._config.config import option_context
Copy link
Contributor

Choose a reason for hiding this comment

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

would prefer you import from pandas directly (and all cases where it is possible)

@jreback
Copy link
Contributor

jreback commented Mar 24, 2019

sorry, can you rebase again :< looks good otherwise.

@@ -36,6 +36,9 @@

from datetime import datetime

from pandas._config import (get_option, set_option, reset_option,
Copy link
Contributor

Choose a reason for hiding this comment

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

how did these get in here now? (Ithink it is explicit and ok), but just wondering

Copy link
Member Author

Choose a reason for hiding this comment

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

These used to be a "*" import, now made explicit.

@jreback jreback merged commit 2618b21 into pandas-dev:master Mar 24, 2019
@jreback
Copy link
Contributor

jreback commented Mar 24, 2019

thanks @jbrockmendel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants