Skip to content

Commit

Permalink
setuptools-scm and isort tweaks (#3720)
Browse files Browse the repository at this point in the history
* Don't require setuptools

* isort __init__.py

* Fix import

* black
  • Loading branch information
crusaderky authored and dcherian committed Jan 24, 2020
1 parent 6d1434e commit ecd67f4
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 56 deletions.
22 changes: 11 additions & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ classifiers =

[options]
packages = xarray
zip_safe = True
zip_safe = False # https://mypy.readthedocs.io/en/latest/installed_packages.html
include_package_data = True
python_requires = >=3.6
install_requires =
Expand All @@ -91,8 +91,8 @@ xarray =
static/html/*

[tool:pytest]
python_files=test_*.py
testpaths=xarray/tests properties
python_files = test_*.py
testpaths = xarray/tests properties
# Fixed upstream in https://github.com/pydata/bottleneck/pull/199
filterwarnings =
ignore:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning
Expand All @@ -104,7 +104,7 @@ markers =
slow: slow tests

[flake8]
ignore=
ignore =
# whitespace before ':' - doesn't work well with black
E203
E402
Expand All @@ -119,13 +119,13 @@ exclude=
doc

[isort]
default_section=THIRDPARTY
known_first_party=xarray
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
default_section = THIRDPARTY
known_first_party = xarray
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88

# Most of the numerical computing stack doesn't have type annotations yet.
[mypy-affine.*]
Expand Down
58 changes: 24 additions & 34 deletions xarray/__init__.py
Original file line number Diff line number Diff line change
@@ -1,49 +1,39 @@
""" isort:skip_file """

import pkg_resources

try:
__version__ = pkg_resources.get_distribution("xarray").version
except Exception:
# Local copy, not installed with setuptools
__version__ = "unknown"

from .core.alignment import align, broadcast
from .core.common import full_like, zeros_like, ones_like
from .core.concat import concat
from .core.combine import combine_by_coords, combine_nested, auto_combine
from .core.computation import apply_ufunc, dot, where
from .core.extensions import register_dataarray_accessor, register_dataset_accessor
from .core.variable import as_variable, Variable, IndexVariable, Coordinate
from .core.dataset import Dataset
from .core.dataarray import DataArray
from .core.merge import merge, MergeError
from .core.options import set_options
from .core.parallel import map_blocks

from . import testing, tutorial, ufuncs
from .backends.api import (
open_dataset,
load_dataarray,
load_dataset,
open_dataarray,
open_dataset,
open_mfdataset,
save_mfdataset,
load_dataset,
load_dataarray,
)
from .backends.rasterio_ import open_rasterio
from .backends.zarr import open_zarr

from .conventions import decode_cf, SerializationWarning

from .coding.cftime_offsets import cftime_range
from .coding.cftimeindex import CFTimeIndex

from .conventions import SerializationWarning, decode_cf
from .core.alignment import align, broadcast
from .core.combine import auto_combine, combine_by_coords, combine_nested
from .core.common import ALL_DIMS, full_like, ones_like, zeros_like
from .core.computation import apply_ufunc, dot, where
from .core.concat import concat
from .core.dataarray import DataArray
from .core.dataset import Dataset
from .core.extensions import register_dataarray_accessor, register_dataset_accessor
from .core.merge import MergeError, merge
from .core.options import set_options
from .core.parallel import map_blocks
from .core.variable import Coordinate, IndexVariable, Variable, as_variable
from .util.print_versions import show_versions

from . import tutorial
from . import ufuncs
from . import testing
try:
import pkg_resources

from .core.common import ALL_DIMS
__version__ = pkg_resources.get_distribution("xarray").version
except Exception:
# Local copy, not installed with setuptools, or setuptools is not available.
# Disable minimum version checks on downstream libraries.
__version__ = "999"

# A hardcoded __all__ variable is necessary to appease
# `mypy --strict` running in projects that import xarray.
Expand Down
5 changes: 4 additions & 1 deletion xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@

import numpy as np

from .. import DataArray, Dataset, auto_combine, backends, coding, conventions
from .. import backends, coding, conventions
from ..core import indexing
from ..core.combine import (
_infer_concat_order_from_positions,
_nested_combine,
auto_combine,
combine_by_coords,
)
from ..core.dataarray import DataArray
from ..core.dataset import Dataset
from ..core.utils import close_on_error, is_grib_path, is_remote_uri
from .common import AbstractDataStore, ArrayWriter
from .locks import _get_scheduler
Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/cfgrib_.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import numpy as np

from .. import Variable
from ..core import indexing
from ..core.utils import Frozen, FrozenDict
from ..core.variable import Variable
from .common import AbstractDataStore, BackendArray
from .locks import SerializableLock, ensure_lock

Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/h5netcdf_.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import numpy as np

from .. import Variable
from ..core import indexing
from ..core.utils import FrozenDict, is_remote_uri
from ..core.variable import Variable
from .common import WritableCFDataStore, find_root_and_group
from .file_manager import CachingFileManager, DummyFileManager
from .locks import HDF5_LOCK, combine_locks, ensure_lock, get_write_lock
Expand Down
3 changes: 2 additions & 1 deletion xarray/backends/netCDF4_.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import numpy as np

from .. import Variable, coding
from .. import coding
from ..coding.variables import pop_to
from ..core import indexing
from ..core.utils import FrozenDict, is_remote_uri
from ..core.variable import Variable
from .common import (
BackendArray,
WritableCFDataStore,
Expand Down
3 changes: 2 additions & 1 deletion xarray/backends/netcdf3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import numpy as np

from .. import Variable, coding
from .. import coding
from ..core.variable import Variable

# Special characters that are permitted in netCDF names except in the
# 0th position of the string
Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/pseudonetcdf_.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import numpy as np

from .. import Variable
from ..core import indexing
from ..core.utils import Frozen, FrozenDict
from ..core.variable import Variable
from .common import AbstractDataStore, BackendArray
from .file_manager import CachingFileManager
from .locks import HDF5_LOCK, NETCDFC_LOCK, combine_locks, ensure_lock
Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/pydap_.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np

from .. import Variable
from ..core import indexing
from ..core.pycompat import integer_types
from ..core.utils import Frozen, FrozenDict, is_dict_like
from ..core.variable import Variable
from .common import AbstractDataStore, BackendArray, robust_getitem


Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/pynio_.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import numpy as np

from .. import Variable
from ..core import indexing
from ..core.utils import Frozen, FrozenDict
from ..core.variable import Variable
from .common import AbstractDataStore, BackendArray
from .file_manager import CachingFileManager
from .locks import HDF5_LOCK, NETCDFC_LOCK, SerializableLock, combine_locks, ensure_lock
Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/rasterio_.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import numpy as np

from .. import DataArray
from ..core import indexing
from ..core.dataarray import DataArray
from ..core.utils import is_scalar
from .common import BackendArray
from .file_manager import CachingFileManager
Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/scipy_.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import numpy as np

from .. import Variable
from ..core.indexing import NumpyIndexingAdapter
from ..core.utils import Frozen, FrozenDict
from ..core.variable import Variable
from .common import BackendArray, WritableCFDataStore
from .file_manager import CachingFileManager, DummyFileManager
from .locks import ensure_lock, get_write_lock
Expand Down
3 changes: 2 additions & 1 deletion xarray/backends/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import numpy as np

from .. import Variable, coding, conventions
from .. import coding, conventions
from ..core import indexing
from ..core.pycompat import integer_types
from ..core.utils import FrozenDict, HiddenKeyDict
from ..core.variable import Variable
from .common import AbstractWritableDataStore, BackendArray, _encode_variable_name

# need some special secret attributes to tell us the dimensions
Expand Down

0 comments on commit ecd67f4

Please sign in to comment.