8000 Update build system and rebuild with numpy >= 2.0 by cvanelteren · Pull Request #611 · matplotlib/basemap · GitHub
[go: up one dir, main page]

Skip to content

Update build system and rebuild with numpy >= 2.0 #611

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update build system and rebuild with numpy >= 2.0
  • Loading branch information
cvanelteren committed Jan 24, 2025
commit 7506e3790b191f8bedd4c1945e8d547b38096bab
27 changes: 27 additions & 0 deletions packages/basemap/build_geos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import sys
from pathlib import Path


def build_geos():
GEOS_DIR = os.environ.get("GEOS_DIR", str(Path.home() / ".local" / "geos"))

try:
import utils

geos = utils.GeosLibrary("3.6.5")
geos.build(installdir=GEOS_DIR)

# Add GEOS directory to environment variables
os.environ["GEOS_DIR"] = GEOS_DIR
os.environ["LD_LIBRARY_PATH"] = (
f"{GEOS_DIR}/lib:{os.environ.get('LD_LIBRARY_PATH', '')}"
)

except Exception as e:
print(f"Error building GEOS: {e}", file=sys.stderr)
sys.exit(1)


if __name__ == "__main__":
build_geos()
86 changes: 75 additions & 11 deletions packages/basemap/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,79 @@
[project]
name = "basemap"
description = "Plot data on map projections with matplotlib"
readme = "README.md"
requires-python = ">=3.7"
license = {text = "MIT"}
authors = [
{name = "Jeff Whitaker", email = "jeffrey.s.whitaker@noaa.gov"},
]
main 8000 tainers = [
{name = "Matplotlib Developers", email = "matplotlib-developers@python.org"}
]
keywords = ["matplotlib", "mapping", "map projections", "gis"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: Scientific/Engineering :: Visualization",
]
dependencies = [
"numpy>=1.16",
"matplotlib>=3.1",
"pyproj>=3.0",
"pyshp>=2.1",
]
dynamic = ["version"]

[project.urls]
Homepage = "https://matplotlib.org/basemap"
Documentation = "https://matplotlib.org/basemap/users/intro.html"
Repository = "https://github.com/matplotlib/basemap"
"Bug Tracker" = "https://github.com/matplotlib/basemap/issues"

[build-system]
requires = [
'setuptools',
'wheel',
'numpy == 1.26.1; python_version >= "3.12"',
'numpy == 1.23.3; python_version == "3.11"',
'numpy == 1.21.4; python_version == "3.10"',
'numpy == 1.21.4; sys_platform == "darwin" and (python_version >= "3.7" and python_version <= "3.9")',
'numpy == 1.16.6; sys_platform != "darwin" and (python_version >= "3.7" and python_version <= "3.9")',
'numpy == 1.16.6; python_version == "2.7" or (python_version >= "3.4" and python_version <= "3.6")',
'numpy == 1.11.3; python_version == "2.6" or (python_version >= "3.2" and python_version <= "3.3")',
'cython >= 0.29, < 3.1; python_version >= "3.3" or python_version < "3.0"',
'cython >= 0.26, < 0.27; python_version == "3.2"'
"setuptools>=45",
"wheel",
"setuptools_scm[toml]>=6.2",
"numpy >= 2.0.0; python_version >= '3.10'",
"numpy == 1.21.4; sys_platform == 'darwin' and (python_version >= '3.7' and python_version <= '3.9')",
"numpy == 1.16.6; sys_platform != 'darwin' and (python_version >= '3.7' and python_version <= '3.9')",
"cython>=0.29,<3.1",
"cmake>=3.12",
]
pre-hook.geos = "build_geos.py"
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["mpl_toolkits.basemap"]
include-package-data = true

[tool.setuptools_scm]
write_to = "basemap/_scm_version.py"
version_scheme = "post-release"
local_scheme = "node-and-timestamp"


[tool.geos]
version = "3.6.5"
build-options = { enable-shared = true, enable-static = false }
install-dir = "${GEOS_DIR}"

[tool.setuptools.package-data]
"mpl_toolkits.basemap" = [
"data/*",
"data/boundaryfiles/*",
"data/5min/*",
"data/10min/*",
]

[tool.setuptools.exclude-package-data]
"*" = ["*.pyc", "*.pyo", "*.pyd", "*.so", "*.dylib"]
2 changes: 1 addition & 1 deletion packages/basemap/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ matplotlib >= 1.5, < 3.0; python_version == "2.7"
matplotlib >= 1.5, < 2.0; python_version == "3.2"
matplotlib >= 1.5, < 2.0; python_version == "3.3"
matplotlib >= 1.5, < 3.0; python_version == "3.4"
matplotlib >= 1.5, < 3.9; python_version >= "3.5"
matplotlib >= 1.5, < 3.10; python_version >= "3.5"

pyproj >= 1.9.3, < 2.1.0; python_version == "2.6"
pyproj >= 1.9.3, < 2.2.0; python_version == "2.7"
Expand Down
3 changes: 0 additions & 3 deletions packages/basemap/src/_geoslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import sys
import numpy
cimport numpy as cnp

__version__ = "1.5.0-dev"


# Need some Python C-API functions for strings.
cdef extern from "Python.h":
object PyBytes_FromString(char *)
Expand Down
11 changes: 11 additions & 0 deletions packages/basemap/src/mpl_toolkits/basemap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@

:func:`addcyclic`: Add cyclic (wraparound) point in longitude.
"""
# SCM versioning
name = "basemap"
try:
from importlib.metadata import version as get_version
version = __version__ = get_version(name)
except Exception:
try:
from ._scm_version import version as __version__
version = __version__
except ImportError:
version = __version__ = "unknown"

import os
import sys
Expand Down
0