Skip to content

Commit 61a0dd4

Browse files
authored
build: move to pyproject (#1849)
1 parent 16153fa commit 61a0dd4

File tree

6 files changed

+142
-69
lines changed

6 files changed

+142
-69
lines changed

MANIFEST.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/whats-new.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ Enhancements
7474
- Added a new way to calibrate the mass balance model with MB
7575
timeseries (:pull:`1827`).
7676
By `Chloe Hancock <https://github.com/chloe-hancock>`_
77-
77+
- Refactored installation. Pip installations now accept optional dependencies,
78+
and no longer requires setting up an environment beforehand. Added support
79+
for `uv`. (:pull:`1849`).
80+
By `Nicolas Gampierakis <https://github.com/gampnico>`_.
7881

7982
Bug fixes
8083
~~~~~~~~~
@@ -95,6 +98,10 @@ Bug fixes
9598
- Changed COPDEM data source (again) - this comes with good sides as the download
9699
is much easier now (:pull:`1773`).
97100
By `Fabien Maussion <https://github.com/fmaussion>`_
101+
- Fixed ``ModuleNotFoundError`` caused by calling ``distutils`` which has been deprecated since Python 3.12.
102+
Reimplements ``strtobool`` natively.
103+
By `Nicolas Gampierakis <https://github.com/gampnico>`_.
104+
98105

99106
Breaking changes
100107
~~~~~~~~~~~~~~~~

oggm/utils/_funcs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
import shapely.geometry as shpg
2929
from shapely.ops import linemerge
3030
from shapely.validation import make_valid
31-
from salem.gis import Grid
31+
try:
32+
from salem.gis import Grid
33+
except ImportError:
34+
pass
3235

3336
# Optional libs
3437
try:

pyproject.toml

Lines changed: 130 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,133 @@
11
[build-system]
2-
build-backend = 'setuptools.build_meta'
3-
requires = [
4-
"setuptools>=61",
5-
"setuptools_scm[toml]>=7.0",
6-
"wheel",
2+
requires = ["hatchling >= 1.26", "hatch-vcs"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "oggm"
7+
dynamic = ["version"]
8+
authors = [
9+
{ name = "OGGM Contributors", email = "info@oggm.org"}
10+
]
11+
description = "Open Global Glacier Model"
12+
readme = "README.rst"
13+
requires-python = ">=3.11"
14+
license = "BSD-3-Clause"
15+
license-files = ["LICENSE.txt"]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Intended Audience :: Science/Research",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Programming Language :: Python :: 3.14",
24+
]
25+
dependencies = [
26+
"configobj",
27+
"matplotlib",
28+
"netcdf4",
29+
"numpy",
30+
"pandas",
31+
"requests",
32+
"scipy",
33+
"shapely",
34+
"xarray",
35+
]
36+
37+
[project.optional-dependencies]
38+
build = [
39+
"build>=1.4.0",
40+
"twine>=6.2.0",
41+
]
42+
dev = [
43+
"oggm[docs, full]",
44+
]
45+
full = [
46+
"oggm[build, tests]",
47+
"bottleneck",
48+
"cartopy",
49+
"dask",
50+
"geopandas",
51+
"ipython",
52+
"joblib",
53+
"motionless",
54+
"netcdf4",
55+
"pillow",
56+
"progressbar2",
57+
"pyproj",
58+
"rasterio",
59+
"rioxarray",
60+
"salem",
61+
"scikit-image",
62+
"scikit-learn",
63+
"seaborn",
64+
"tables",
65+
]
66+
docs = [
67+
"numpydoc",
68+
"pydata-sphinx-theme",
69+
"sphinx",
70+
"sphinx-book-theme",
71+
"sphinx-intl",
72+
"sphinx-reredirects",
73+
"sphinx-togglebutton",
74+
]
75+
tests = [
76+
"pytest",
77+
"pytest-mpl-oggm>=0.180.1",
78+
]
79+
80+
[project.urls]
81+
"Homepage" = "https://oggm.org"
82+
"Bug Tracker" = "https://github.com/OGGM/oggm/issues"
83+
"Documentation" = "https://docs.oggm.org/"
84+
85+
[project.scripts]
86+
oggm_prepro = "oggm.cli.prepro_levels:main"
87+
oggm_benchmark = "oggm.cli.benchmark:main"
88+
oggm_netrc_credentials = "oggm.cli.netrc_credentials:cli"
89+
"pytest.oggm" = "oggm.tests.__main__:main"
90+
91+
[tool.hatch.build.targets.sdist]
92+
packages = ["oggm"]
93+
exclude = [
94+
"docs",
95+
".coverage.*"
96+
]
97+
include = [
98+
"pytest.ini",
99+
"oggm/params.cfg",
100+
"oggm/data/dem_sources.txt",
101+
]
102+
# fallback if include group doesn't work as intended
103+
force-include = {"pytest.ini" = "pytest.ini"}
104+
105+
[tool.hatch.build.targets.wheel]
106+
packages = ["oggm"]
107+
include = [
108+
"pytest.ini",
109+
"oggm/params.cfg",
110+
"oggm/data/dem_sources.txt",
111+
]
112+
# fallback if include group doesn't work as intended
113+
force-include = {"pytest.ini" = "pytest.ini"}
114+
115+
[tool.hatch.envs.default]
116+
env-vars-file = ".env"
117+
118+
[tool.hatch.version]
119+
path = "oggm/__init__.py"
120+
source = "vcs"
121+
122+
# This section is for uv, but may also used by hatchling when building the package
123+
124+
# local dependency groups for uv
125+
[dependency-groups]
126+
build = [
127+
"build>=1.4.0",
128+
"twine>=6.2.0",
7129
]
8130

9-
[tool.setuptools_scm]
131+
[tool.uv.build-backend]
132+
module-root = ""
133+
module-name = "oggm"

setup.cfg

Lines changed: 0 additions & 54 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)