Skip to content

Commit

Permalink
Use pyproject.toml and src root dir
Browse files Browse the repository at this point in the history
  • Loading branch information
sandorkertesz committed May 8, 2024
1 parent ea15bb2 commit 703ae0b
Show file tree
Hide file tree
Showing 164 changed files with 99 additions and 94 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# setuptools-scm
version.py
_version.py

# Sphinx automatic generation of API
docs/_api/
Expand Down
97 changes: 89 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,100 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
requires = ["setuptools>=61", "setuptools-scm>=8.0"]

[project]
authors = [
{name = "European Centre for Medium-Range Weather Forecasts (ECMWF)", email = "[email protected]"}
]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent"
]
dependencies = [
"cfgrib>=0.9.10.1",
"eccodes>=1.7.0",
"dask",
"entrypoints",
"filelock",
"jinja2",
"jsonschema",
"markdown",
"multiurl",
"netcdf4",
"pandas",
"pdbufr>=0.11.0",
"pyyaml",
"tqdm>=4.63.0",
"xarray>=0.19.0",
"earthkit-meteo>=0.0.1"
]
description = "A format-agnostic Python interface for geospatial data"
dynamic = ["version"]
license = {text = "Apache License Version 2.0"}
name = "earthkit-data"
readme = "README.md"
requires-python = ">= 3.8"

[project.optional-dependencies]
all = [
"earthkit-data[mars]",
"earthkit-data[cds]",
"earthkit-data[ecmwf-opendata]",
"earthkit-data[fdb]",
"earthkit-data[polytope]",
"earthkit-data[wekeo]",
"earthkit-data[odb]",
"earthkit-data[projection]",
"earthkit-data[geopandas]",
"earthkit-data[eccovjson]"
]
cds = ["cdsapi"]
eccovjson = ["eccovjson>=0.0.5"]
ecmwf-opendata = ["ecmwf-opendata>=0.3.3"]
fdb = ["pyfdb"]
geopandas = ["geopandas"]
mars = ["ecmwf-api-client>=1.6.1"]
odb = ["pyodc"]
polytope = ["polytope-client>=0.7.4"]
projection = ["cartopy"]
test = [
"earthkit-data[all]",
"pytest",
"pytest-cov",
"pytest-forked",
"pytest-timeout",
"nbformat",
"nbconvert"
]
wekeo = ["hda"]

[project.urls]
Documentation = "https://earthkit-data.readthedocs.io/"
Homepage = "https://github.com/ecmwf/earthkit-data/"
Issues = "https://github.com/ecmwf/earthkit-data.issues"
Repository = "https://github.com/ecmwf/earthkit-data/"

[tool.coverage.run]
branch = true
branch = "true"

[tool.isort]
profile = "black"

[tool.pydocstyle]
add_ignore = ["D1", "D200", "D205", "D400", "D401", "D403"]
add_ignore = ["D1", "D200", "D205", "D400", "D401"]
convention = "numpy"

[tool.setuptools.packages.find]
include = ["earthkit.data"]
where = ["src/"]

[tool.setuptools_scm]
write_to = "earthkit/data/version.py"
write_to_template = '''
# Do not change! Do not track in version control!
__version__ = "{version}"
'''
version_file = "src/earthkit/data/_version.py"
79 changes: 0 additions & 79 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,82 +1,3 @@
[metadata]
name = earthkit-data
license = Apache License 2.0
description = A format-agnostic Python interface for geospatial data
classifiers =
Development Status :: 2 - Pre-Alpha
Intended Audience :: Science/Research
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Scientific/Engineering
long_description_content_type=text/markdown
long_description = file: README.md
test_suite = tests

[options]
packages = find_namespace:
install_requires =
cfgrib>=0.9.10.1
eccodes>=1.7.0
dask
entrypoints
filelock
jinja2
jsonschema
markdown
multiurl
netcdf4
pandas
pdbufr>=0.11.0
pyyaml
tqdm>=4.63.0
xarray>=0.19.0
earthkit-meteo>=0.0.1
include_package_data = True

[options.packages.find]
include = earthkit.*

[options.extras_require]
mars = ecmwf-api-client>=1.6.1
cds = cdsapi
fdb = pyfdb
polytope = polytope-client>=0.7.4
wekeo = hda
ecmwf-opendata = ecmwf-opendata>=0.3.3
odb = pyodc
projection = cartopy
geopandas = geopandas
eccovjson = eccovjson>=0.0.5
all =
earthkit-data[mars]
earthkit-data[cds]
earthkit-data[ecmwf-opendata]
earthkit-data[fdb]
earthkit-data[polytope]
earthkit-data[wekeo]
earthkit-data[odb]
earthkit-data[projection]
earthkit-data[geopandas]
earthkit-data[eccovjson]
test =
earthkit-data[all]
pytest
pytest-cov
pytest-forked
pytest-timeout
nbformat
nbconvert

[flake8]
max-line-length = 110
extend-ignore = E203, W503

[mypy]
strict = False
ignore_missing_imports = True
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
try:
# NOTE: the `version.py` file must not be present in the git repository
# as it is generated by setuptools at install time
from .version import __version__
from ._version import __version__
except ImportError: # pragma: no cover
# Local copy or not installed with setuptools
__version__ = "999"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _make_metadata(self):
pass

def _values(self, dtype=None):
"""native array type"""
"""Native array type"""
if dtype is None:
return self._array
else:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(
force=force,
# Load lazily so we can do parallel downloads
lazily=lazily,
**kwargs
**kwargs,
)
for url in urls
]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion earthkit/data/testing.py → src/earthkit/data/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class OfflineError(Exception):

_REMOTE_TEST_DATA_URL = "https://get.ecmwf.int/repository/test-data/earthkit-data/"

_ROOT_DIR = top = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
_ROOT_DIR = top = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
)
if not os.path.exists(os.path.join(_ROOT_DIR, "tests", "data")):
_ROOT_DIR = "./"

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PandasDataFrameTranslator(PandasSeriesTranslator):

def __call__(self):
"""
DataFrame requested, if Series convert to DataFrame.
Return DataFrame, if Series convert to DataFrame.
"""
if isinstance(self.data, pd.Series):
return self.data.to_frame()
Expand All @@ -45,7 +45,7 @@ class GeoPandasDataFrameTranslator(PandasSeriesTranslator):

def __call__(self):
"""
GeoDataFrame requested, if normal pandas convert to geopandas.
Return GeoDataFrame, if normal pandas convert to geopandas.
"""
import geopandas as gpd

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/utils/dummy_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def numpy_mean(
a: T.Union[
np.ndarray, xr.Dataset, xr.DataArray, xr.Variable, pd.DataFrame, pd.Series
],
**kwargs
**kwargs,
):
return np.mean(a, **kwargs)

Expand Down

0 comments on commit 703ae0b

Please sign in to comment.