Skip to content

Commit

Permalink
Remove pkg resources (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocefpaf authored Dec 16, 2021
1 parent dd2aae7 commit 3b5ac13
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
cf_xarray/_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
15 changes: 15 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
graft cf_xarray/data
exclude cf_xarray/_version.py

prune ci
prune doc
prune *.egg-info
prune .binder/
prune .github/

exclude CITATION.cff
exclude .deepsource.toml
exclude .tributors
exclude .zenodo.json
exclude *.yml
exclude *.yaml
exclude .gitignore
9 changes: 5 additions & 4 deletions cf_xarray/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Any, Dict, Iterable
from xml.etree import ElementTree

from pkg_resources import DistributionNotFound, get_distribution
from xarray import DataArray


Expand Down Expand Up @@ -94,7 +93,9 @@ def parse_cf_standard_name_table(source=None):


def _get_version():
__version__ = "unknown"
try:
return get_distribution("cf_xarray").version
except DistributionNotFound:
return "unknown"
from ._version import __version__
except ImportError:
pass
return __version__
6 changes: 3 additions & 3 deletions doc/examples/introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,9 @@
"## Feature: Rewriting arguments\n",
"\n",
"`cf_xarray` can rewrite arguments for a large number of xarray functions. By\n",
"this I mean that instead of specifying say `dim=\"lon\"`, you can pass `dim=\"X\"` or\n",
"`dim=\"longitude\"` and `cf_xarray` will rewrite that to `dim=\"lon\"` based on the\n",
"attributes present in the dataset.\n",
"this I mean that instead of specifying say `dim=\"lon\"`, you can pass `dim=\"X\"`\n",
"or `dim=\"longitude\"` and `cf_xarray` will rewrite that to `dim=\"lon\"` based on\n",
"the attributes present in the dataset.\n",
"\n",
"Here are a few examples\n"
]
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ python_requires = >=3.6
install_requires =
numpy >= 1.15
pandas >= 0.25
setuptools >= 41.2 # For pkg_resources
xarray
setup_requires =
setuptools >= 41.2
Expand Down Expand Up @@ -42,7 +41,7 @@ skip_gitignore = true
force_to_top = true
default_section = THIRDPARTY
known_first_party = cf_xarray
known_third_party = dask,matplotlib,numpy,pandas,pint,pkg_resources,pytest,setuptools,sphinx_autosummary_accessors,xarray
known_third_party = dask,matplotlib,numpy,pandas,pint,pytest,setuptools,sphinx_autosummary_accessors,xarray

# Most of the numerical computing stack doesn't have type annotations yet.
[mypy-affine.*]
Expand Down
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
from setuptools import setup

setup(
use_scm_version=True,
setup_requires=["setuptools_scm"],
# The package metadata is specified in setup.cfg but GitHub's downstream dependency graph
# does not work unless we put the name this here too.
name="cf_xarray",
use_scm_version={
"write_to": "cf_xarray/_version.py",
"write_to_template": '__version__ = "{version}"',
"tag_regex": r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$",
},
description="A lightweight convenience wrapper for using CF attributes on xarray objects. ",
url="https://cf-xarray.readthedocs.io",
)

0 comments on commit 3b5ac13

Please sign in to comment.