Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/developinstall.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ guide is described for **Linux**. For *Windows*, see :ref:`developinstallwin:Adv
Requirements
^^^^^^^^^^^^

Install `git <https://github.com/git-guides/install-git>`_, python and `pixi <https://pixi.sh/latest/#installation>`_.
Install `git <https://github.com/git-guides/install-git>`_ and `pixi <https://pixi.sh/latest/#installation>`_.
Some operating systems might require the python headers (e.g python-dev on ubuntu) or other supporting
libraries/packages (e.g. Visual Studio on Windows needs the c++ compiler components).

Expand Down
4 changes: 2 additions & 2 deletions docs/developinstallwin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ guide is described for **Windows**. For *Linux*, see :ref:`developinstall:Advanc
Requirements
^^^^^^^^^^^^

Install `git <https://github.com/git-guides/install-git>`_, python and `pixi <https://pixi.sh/latest/#installation>`_.
Install `git <https://github.com/git-guides/install-git>`_ and `pixi <https://pixi.sh/latest/#installation>`_.

Install `Microsoft C++ compiler <https://wiki.python.org/moin/WindowsCompilers>`_.
Follow the installation steps for the version corresponding to the installed python version.
Expand Down Expand Up @@ -43,7 +43,7 @@ Compile the cython com1DFA part::
You will have to do this compilation every time something changes in the cython code. We also suggest
to do this everytime updates from the repositories are pulled.

**Before** compilation in Windows, make sure to delete ``AvaFrame/build`` directory, in addition to any .pyd, .c, and
**Before** compilation in Windows, make sure to delete ``AvaFrame/build`` directory, in addition to any .pyc, .c, and
.pycache files in ``AvaFrame/avaframe/com1DFA``

This installs avaframe in editable mode, so every time you import avaframe the
Expand Down
20 changes: 7 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
# Cython dependency is optional, see setup.py for details.
# For the package (run-time) dependencies, see setup.cfg.
requires = ["setuptools", "numpy", "Cython", "setuptools-scm"]
requires = ["setuptools", "numpy<2.0", "Cython>=3.0.10", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -26,13 +26,13 @@ classifiers = [
requires-python = ">=3.9,<3.14"
dependencies = [
"numpy<2.0", # numpy 2.0 introduces breaking changes in relation to qgis versions
"salib<1.5.1", # this is the last aversion that works with numpy <2.
"pyshp<3.0", # pin until 3.0.3 is out, there's a known bug for certain polygon types
"salib", # this is the last aversion that works with numpy <2.
"pyshp>=3.0.3", # pin until 3.0.3 is out, there's a known bug for certain polygon types
"matplotlib",
"scipy",
"cmcrameri",
"seaborn",
"cython<3.0", # cython 3.x compiles code that needs numpy > 2.0
"cython>=3.0.10", # Cython 3.x is required for Python 3.12/3.13, configured for numpy < 2.0 in setup.py
"pandas",
"shapely",
"configUpdater",
Expand Down Expand Up @@ -64,7 +64,7 @@ version_file = "avaframe/RELEASE-VERSION.txt"
#build = ["cp312-*"]
skip = ["*musllinux*","*-win32"]
build-verbosity = 1
before-build = "pip install cython numpy"
before-build = "pip install 'cython>=3.0.10' 'numpy<2.0'"


[tool.cibuildwheel.linux]
Expand All @@ -86,7 +86,7 @@ channels = ["https://prefix.dev/conda-forge"]
platforms = ["linux-64", "win-64", "osx-64"]

[tool.pixi.dependencies]
python = "<3.14"
python = ">=3.9,<3.14"
setuptools = "*"
setuptools-scm = "*"
cibuildwheel = "*"
Expand Down Expand Up @@ -114,17 +114,13 @@ sphinxcontrib-bibtex = "*"
[tool.pixi.feature.prod.pypi-dependencies]
avaframe = "*"

#Feature py313
[tool.pixi.feature.py313.dependencies]
python = "==3.13.7"

#Feature rcs
#[tool.pixi.feature.rcs.pypi-dependencies]
#avaframe = "==1.13rc4"

[tool.pixi.tasks]
build = "python setup.py build_ext --inplace"
clean = "find avaframe -type f \\( -name '*.so' -o -name '*.c' \\) -delete"
clean = "python -c \"import pathlib; [f.unlink() for f in pathlib.Path('avaframe').rglob('*.so')]; [f.unlink() for f in pathlib.Path('avaframe').rglob('*.c')]\""
rebuild = { depends-on = ["clean", "build"] }

#Feature qgis
Expand All @@ -139,6 +135,4 @@ dev = ["dev"]
doc = ["doc", "dev"]
prod = ["prod"]
#rcs = ["rcs"]
py313 = ["py313", "dev"]
qgis = ["qgis", "dev"]

15 changes: 13 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@
'avaframe/com1DFA/damCom1DFA.pyx',
]

# Define macros to ensure NumPy 1.x API compatibility
# This allows Cython 3.x to generate code that works with numpy < 2.0
define_macros = [
("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"),
# Target NumPy 1.x C API even when building with Cython 3.x
("NPY_TARGET_VERSION", "NPY_1_22_API_VERSION"),
]

extensions = [
Extension(
name=file.replace('/', '.').replace('.pyx', ''),
sources=[file],
include_dirs=[numpy.get_include()]
include_dirs=[numpy.get_include()],
define_macros=define_macros, # Add the macros here
)
for file in cython_files
]
Expand All @@ -27,6 +36,8 @@
compiler_directives={
'language_level': '3',
'linetrace': True,
# Ensure Cython generates code compatible with older NumPy
'binding': True,
}
)

Expand All @@ -43,4 +54,4 @@
# 'pandas'
# ],
# python_requires='>=3.8',
)
)
Loading