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

Move locale code out of tm, into _config #25757

Merged
merged 6 commits into from
Mar 20, 2019

Conversation

jbrockmendel
Copy link
Member

As discussed last week, one of ugliest runtime imports in tslibs is of tm for tm.set_locale. This moves set_locale and a couple of other locale-related functions out of tm.

As discussed in #25162, #25203, #25613, this moves the affected functions to a new directory pandas/_config, intended to be strictly "upstream" from the rest of pandas (potentially even made actually-upstream as suggested here).

Following this and #25613, a bunch of other cleanup/simplification becomes feasible.

@codecov
Copy link

codecov bot commented Mar 17, 2019

Codecov Report

Merging #25757 into master will increase coverage by <.01%.
The diff coverage is 96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25757      +/-   ##
==========================================
+ Coverage   91.25%   91.25%   +<.01%     
==========================================
  Files         172      173       +1     
  Lines       52977    52978       +1     
==========================================
+ Hits        48342    48343       +1     
  Misses       4635     4635
Flag Coverage Δ
#multiple 89.82% <96%> (ø) ⬆️
#single 41.74% <96%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 88.83% <100%> (-0.16%) ⬇️
pandas/_config/localization.py 95.83% <95.83%> (ø)

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 707c720...72eced6. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 17, 2019

Codecov Report

Merging #25757 into master will increase coverage by <.01%.
The diff coverage is 96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25757      +/-   ##
==========================================
+ Coverage   91.26%   91.26%   +<.01%     
==========================================
  Files         172      173       +1     
  Lines       52964    52965       +1     
==========================================
+ Hits        48337    48338       +1     
  Misses       4627     4627
Flag Coverage Δ
#multiple 89.83% <96%> (ø) ⬆️
#single 41.74% <96%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 89.3% <100%> (-0.15%) ⬇️
pandas/_config/localization.py 95.83% <95.83%> (ø)

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 8311214...a0c6fa2. Read the comment docs.

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.

Not sure if I missed it in another thread but what is the issue with get_locales moving as well?

@@ -18,10 +17,13 @@
import numpy as np
from numpy.random import rand, randn

from pandas._config.localization import ( # noqa:F401
Copy link
Member

Choose a reason for hiding this comment

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

What's the noqa for?

Copy link
Member Author

Choose a reason for hiding this comment

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

some of the imports are not used in this file, but are retained so that we can still use them as tm.foo

Copy link
Contributor

Choose a reason for hiding this comment

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

should try to completely remove these from testing at some point

@WillAyd WillAyd added the Clean label Mar 18, 2019
@jreback
Copy link
Contributor

jreback commented Mar 18, 2019

conceptually this looks good. some failing checks.

@jbrockmendel
Copy link
Member Author

what is the issue with get_locales moving as well?

get_locales depends on pd.options.display.encoding, so it can't be moved (in a way that keeps the dependency structure clean) until pd.core.config and parts of config_init are moved to _config.

@jbrockmendel
Copy link
Member Author

CI checks fixed.

@jbrockmendel
Copy link
Member Author

@jreback rebased following #25613. Nice follow-up available after this.

@jreback jreback added this to the 0.25.0 milestone Mar 20, 2019
@jreback jreback merged commit fc24c2c into pandas-dev:master Mar 20, 2019
@jreback
Copy link
Contributor

jreback commented Mar 20, 2019

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the locale_contained branch March 20, 2019 01:17
sighingnow added a commit to sighingnow/pandas that referenced this pull request Mar 20, 2019
* origin/master:
  DOC: clean bug fix section in whatsnew (pandas-dev#25792)
  DOC: Fixed PeriodArray api ref (pandas-dev#25526)
  Move locale code out of tm, into _config (pandas-dev#25757)
  Unpin pycodestyle (pandas-dev#25789)
  Add test for rdivmod on EA array (GH23287) (pandas-dev#24047)
  ENH: Support datetime.timezone objects (pandas-dev#25065)
  Cython language level 3 (pandas-dev#24538)
  API: concat on sparse values (pandas-dev#25719)
  TST: assert_produces_warning works with filterwarnings (pandas-dev#25721)
  make core.config self-contained (pandas-dev#25613)
  CLN: replace %s syntax with .format in pandas.io.parsers (pandas-dev#24721)
  TST: Check pytables<3.5.1 when skipping (pandas-dev#25773)
  DOC: Fix typo in docstring of DataFrame.memory_usage  (pandas-dev#25770)
  Replace dicts with OrderedDicts in groupby aggregation functions (pandas-dev#25693)
  TST: Fixturize tests/frame/test_missing.py (pandas-dev#25640)
  DOC: Improve the docsting of Series.iteritems (pandas-dev#24879)
  DOC: Fix function name. (pandas-dev#25751)
  Implementing iso_week_year support for to_datetime (pandas-dev#25541)
  DOC: clarify corr behaviour when using a callable (pandas-dev#25732)
  remove unnecessary check_output (pandas-dev#25755)

# Conflicts:
#	doc/source/whatsnew/v0.25.0.rst
thoo added a commit to thoo/pandas that referenced this pull request Mar 20, 2019
* upstream/master: (55 commits)
  PERF: Improve performance of StataReader (pandas-dev#25780)
  Speed up tokenizing of a row in csv and xstrtod parsing (pandas-dev#25784)
  BUG: Fix _binop for operators for serials which has more than one returns (divmod/rdivmod). (pandas-dev#25588)
  BUG-24971 copying blocks also considers ndim (pandas-dev#25521)
  CLN: Panel reference from documentation (pandas-dev#25649)
  ENH: Quoting column names containing spaces with backticks to use them in query and eval. (pandas-dev#24955)
  BUG: reading windows utf8 filenames in py3.6 (pandas-dev#25769)
  DOC: clean bug fix section in whatsnew (pandas-dev#25792)
  DOC: Fixed PeriodArray api ref (pandas-dev#25526)
  Move locale code out of tm, into _config (pandas-dev#25757)
  Unpin pycodestyle (pandas-dev#25789)
  Add test for rdivmod on EA array (GH23287) (pandas-dev#24047)
  ENH: Support datetime.timezone objects (pandas-dev#25065)
  Cython language level 3 (pandas-dev#24538)
  API: concat on sparse values (pandas-dev#25719)
  TST: assert_produces_warning works with filterwarnings (pandas-dev#25721)
  make core.config self-contained (pandas-dev#25613)
  CLN: replace %s syntax with .format in pandas.io.parsers (pandas-dev#24721)
  TST: Check pytables<3.5.1 when skipping (pandas-dev#25773)
  DOC: Fix typo in docstring of DataFrame.memory_usage  (pandas-dev#25770)
  ...
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