From a2fe7f4307a2235b36a6bcb236e10efeee640131 Mon Sep 17 00:00:00 2001 From: vsnever Date: Wed, 28 Aug 2024 00:55:11 +0200 Subject: [PATCH 1/3] Update setup to support Cherab 1.5. Add demos to the distribution. --- CHANGELOG.md | 4 ++++ README.md | 14 +++++++++----- pyproject.toml | 2 +- setup.py | 17 +++++++++++++++-- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d26f23e..9bd54a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Release 0.1.1 (TBD) ------------------- +New: +* Support Cython 3 stable release +* Support Cherab 1.5 + Bug fixes: * Fix numpy array setflags() bug in UnstructGrid2D pickling. (#4) diff --git a/README.md b/README.md index df08068..4f851ce 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,20 @@ This module enables the creation of Cherab plasma objects and Raysect meshes fro This add-on module requires IMAS to be installed with Python interface. -On ITER SDCC load the respective modules: +On ITER SDCC load the IMAS module: ```bash module load IMAS -module load Raysect/0.7.1-intel-2020b ``` and then install with: ```bash -pip install cherab==1.4.0 --user -pip install -U cython==3.0a5 --user -pip install --user +pip install git@https://github.com/cherab/imas --user +``` +Alternatively, install to a virtual environment: + +```bash +python -m venv /path/to/cherab_virtual_environment +source /path/to/cherab_virtual_environment/bin/activate +pip install git@https://github.com/cherab/imas ``` diff --git a/pyproject.toml b/pyproject.toml index 26918d2..25b55a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython==3.0a5", "raysect==0.8.1", "cherab==1.5.0.dev1"] +requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython~=3.0", "raysect==0.8.1.*", "cherab==1.5"] build-backend="setuptools.build_meta" diff --git a/setup.py b/setup.py index c1ede63..4c8b4ad 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,11 @@ +from collections import defaultdict from setuptools import setup, find_packages, Extension from Cython.Build import cythonize import sys import numpy import os import os.path as path +from pathlib import Path force = False profile = False @@ -33,12 +35,22 @@ if profile: cython_directives["profile"] = True +# Include demos in a separate directory in the distribution as data_files. +demo_parent_path = Path("share/cherab/demos/imas") +data_files = defaultdict(list) +demos_source = Path("demos") +for item in demos_source.rglob("*"): + if item.is_file(): + install_dir = demo_parent_path / item.parent.relative_to(demos_source) + data_files[str(install_dir)].append(str(item)) +data_files = list(data_files.items()) + with open("README.md") as f: long_description = f.read() setup( name="cherab-imas", - version="0.1.0", + version="0.1.1", namespace_packages=['cherab'], description="Cherab spectroscopy framework: IMAS submodule", classifiers=[ @@ -60,6 +72,7 @@ long_description_content_type="text/markdown", packages=find_packages(), include_package_data=True, - install_requires=["raysect==0.8.1", "cherab==1.5.0.dev1"], + install_requires=["cherab==1.5"], ext_modules=cythonize(extensions, force=force, compiler_directives=cython_directives), + data_files=data_files, ) From b284bc18bd78159ec7371ffca5b666c3726b580f Mon Sep 17 00:00:00 2001 From: vsnever Date: Wed, 28 Aug 2024 11:50:32 +0200 Subject: [PATCH 2/3] Update setup.py and pyproject.toml. --- pyproject.toml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 25b55a9..3d17489 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython~=3.0", "raysect==0.8.1.*", "cherab==1.5"] +requires = ["setuptools", "oldest-supported-numpy", "cython~=3.0", "raysect==0.8.1.*", "cherab==1.5.*"] build-backend="setuptools.build_meta" diff --git a/setup.py b/setup.py index 4c8b4ad..fa58dfa 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,7 @@ long_description_content_type="text/markdown", packages=find_packages(), include_package_data=True, - install_requires=["cherab==1.5"], + install_requires=["raysect==0.8.1.*", "cherab==1.5.*"], ext_modules=cythonize(extensions, force=force, compiler_directives=cython_directives), data_files=data_files, ) From e64c05e04b04cb6c1b58d14df6c05b3e9da4eba3 Mon Sep 17 00:00:00 2001 From: vsnever Date: Wed, 11 Sep 2024 22:20:09 +0200 Subject: [PATCH 3/3] Specify package_data in setup.py and remove MANIFEST.in --- MANIFEST.in | 3 --- setup.py | 7 +++++-- 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1b1fc8b..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include README.md CHANGELOG.md MANIFEST.in setup.py -recursive-include cherab *.py -prune demos* diff --git a/setup.py b/setup.py index fa58dfa..2b457fb 100644 --- a/setup.py +++ b/setup.py @@ -71,8 +71,11 @@ long_description=long_description, long_description_content_type="text/markdown", packages=find_packages(), - include_package_data=True, + package_data={"": [ + "**/*.pyx", "**/*.pxd", # Needed to build Cython extensions. + ], + }, + data_files=data_files, install_requires=["raysect==0.8.1.*", "cherab==1.5.*"], ext_modules=cythonize(extensions, force=force, compiler_directives=cython_directives), - data_files=data_files, )