diff --git a/CHANGES.md b/CHANGES.md index 59f5f41..ebf25aa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,18 +1,25 @@ # Release notes -% Unreleased_ -% ----------- +See also the +[unreleased changes](https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.6.1...branch%2Fdefault). -## [0.6.0] (unpublished) +## [0.6.1] (unpublished) -- Support for [Meson build](https://transonic.readthedocs.io/en/latest/packaging.html) - through `transonic --meson` and multi-backends +- Add `transonic-get-include` command for Meson builds. +- Use `PYTHRANRC=''` for Meson +- Fix `__version__` + +## [0.6.0] (2024-01-16) + +- Support for + [Meson build](https://transonic.readthedocs.io/en/latest/packaging.html) through + `transonic --meson` and multi-backends - Support for Python 3.12 ## [0.5.3] (2023-08-21) -- [!110](https://foss.heptapod.net/fluiddyn/transonic/-/merge_requests/110) - Quick fix autopep8 bug + fix CI (py3.9) +- [!110](https://foss.heptapod.net/fluiddyn/transonic/-/merge_requests/110) Quick + fix autopep8 bug + fix CI (py3.9) ## [0.5.2] (2022-01-04) @@ -42,8 +49,8 @@ ## 0.4.9 (2021-07-02) -- Avoid new Gast and Beniget versions by pinning to the previous versions - (0.4.0 and 0.3.0). No Python 3.10 support! +- Avoid new Gast and Beniget versions by pinning to the previous versions (0.4.0 + and 0.3.0). No Python 3.10 support! ## 0.4.8 (2021-05-03) @@ -79,8 +86,8 @@ ## 0.4.1 (2019-10-08) -- Cython backend: less bugs, better support for fused types, nonecheck, - cdivision, ... +- Cython backend: less bugs, better support for fused types, nonecheck, cdivision, + ... - Fix default parameters for Pythran ## 0.4.0 (2019-09-22) @@ -90,8 +97,8 @@ - memoryviews for Cython - memory layout for arrays (C, Fortran, C_or_F and strided) -- More than one backend in one process + API to select the backend for modules - and functions +- More than one backend in one process + API to select the backend for modules and + functions ## 0.3.3 (2019-08-30) @@ -115,11 +122,12 @@ ## 0.2.4 (2019-06-28) -- Support source in multiple files ([#14](https://foss.heptapod.net/fluiddyn/transonic/issues/14) and #21) +- Support source in multiple files + ([#14](https://foss.heptapod.net/fluiddyn/transonic/issues/14) and #21) - Fix issues #8 (Recursion for boosted method), #17 (Bad formating for Pythran error), #18 (Improve logging jit), #19 (Change default arguments of jit - decorator) and #20 (No Pythran signature generated for boosted functions - without arguments)! + decorator) and #20 (No Pythran signature generated for boosted functions without + arguments)! ## 0.2.3 (2019-06-11) @@ -164,9 +172,8 @@ ## 0.1.9 (2019-01-29) -- Common setup functions such as {code}`get_logger`, - {code}`ParallelBuildExt` and {code}`init_pythran_extensions` in - {code}`transonic.dist`. +- Common setup functions such as {code}`get_logger`, {code}`ParallelBuildExt` and + {code}`init_pythran_extensions` in {code}`transonic.dist`. ## 0.1.8 (2019-01-19) @@ -178,13 +185,12 @@ ## 0.1.6 (2018-12-14) -- Better logging and commandline (no compilation if the extension is - up-to-date) +- Better logging and commandline (no compilation if the extension is up-to-date) ## 0.1.5 (2018-12-12) -- {code}`jit` for simple methods (without assignation to attributes - and call of other methods) +- {code}`jit` for simple methods (without assignation to attributes and call of + other methods) - {code}`Union` for annotations - {code}`include` decorator @@ -207,8 +213,7 @@ - Fix bug C-style `[][]` - {code}`Array[float, "2d"]` supported - {code}`NDim(0)` supported -- Function {code}`set_compile_jit()` to disable compilation of - jit functions +- Function {code}`set_compile_jit()` to disable compilation of jit functions ## 0.1.1 (2018-11-28) @@ -250,4 +255,5 @@ [0.5.1]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.5.0...0.5.1 [0.5.2]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.5.1...0.5.2 [0.5.3]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.5.2...0.5.3 -[unreleased]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.5.3...branch%2Fdefault +[0.6.0]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.5.3...0.6.0 +[0.6.1]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.6.0...0.6.1 diff --git a/data_tests/package_for_test_meson/meson.build b/data_tests/package_for_test_meson/meson.build index e4cfe48..97dc2d5 100644 --- a/data_tests/package_for_test_meson/meson.build +++ b/data_tests/package_for_test_meson/meson.build @@ -19,40 +19,11 @@ endif use_pythran = backend.contains('pythran') if use_pythran - incdir_numpy = run_command( - py, - [ - '-c', - '''import os -import numpy as np -try: - incdir = os.path.relpath(np.get_include()) -except Exception: - incdir = np.get_include() -print(incdir)''' - ], - check: true - ).stdout().strip() - + incdir_numpy = run_command('transonic-get-include', 'numpy', check: true).stdout().strip() inc_np = include_directories(incdir_numpy) np_dep = declare_dependency(include_directories: inc_np) - incdir_pythran = run_command( - py, - [ - '-c', - '''import os -import pythran; -incdir = os.path.dirname(pythran.__file__) -try: - incdir = os.path.relpath(incdir) -except Exception: - pass -print(incdir)''' - ], - check: true - ).stdout().strip() - + incdir_pythran = run_command('transonic-get-include', 'pythran', check: true).stdout().strip() pythran = find_program('pythran', native: true) cpp_args_pythran = [ diff --git a/doc/conf.py b/doc/conf.py index 89942b0..34921da 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -80,6 +80,8 @@ # The full version, including alpha/beta/rc tags. release = transonic.__version__ +if "+" in release: + release = release.split("+")[0] # The short X.Y version. version = release.split(".") version = "{}.{}.{}".format(version[0], version[1], version[2]) diff --git a/noxfile.py b/noxfile.py index eb1f8a6..1256746 100644 --- a/noxfile.py +++ b/noxfile.py @@ -67,3 +67,11 @@ def test(session, with_pythran, with_cython): "TRANSONIC_BACKEND": "pythran", }, ) + + +@nox.session +def doc(session): + session.run_always("pdm", "sync", "-G", "doc", external=True) + session.chdir("doc") + session.run("make", "cleanall", external=True) + session.run("make", external=True) diff --git a/pyproject.toml b/pyproject.toml index bfd2067..c89fd3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "pdm.backend" [project] name = "transonic" -version = "0.6.0" +version = "0.6.1" description = "Make your Python code fly at transonic speeds!" authors = [ { name = "Pierre Augier", email = "pierre.augier@univ-grenoble-alpes.fr" }, @@ -33,6 +33,7 @@ mpi = ["mpi4py"] [project.scripts] transonic = "transonic.run:run" +transonic-get-include = "transonic_cl.get_includes:main" [tool.pdm] package-dir = "src" diff --git a/src/transonic/_version.py b/src/transonic/_version.py index 8e43a60..7de035c 100644 --- a/src/transonic/_version.py +++ b/src/transonic/_version.py @@ -1,4 +1,6 @@ -__version__ = "0.5.3" +from importlib import metadata + +__version__ = metadata.version(__package__) try: from pyfiglet import figlet_format diff --git a/src/transonic_cl/get_includes.py b/src/transonic_cl/get_includes.py new file mode 100644 index 0000000..a5fd7db --- /dev/null +++ b/src/transonic_cl/get_includes.py @@ -0,0 +1,35 @@ +import argparse +import sys +from pathlib import Path + +from importlib import import_module + + +def main(): + parser = argparse.ArgumentParser( + prog="transonic-get-include", + description="Get include directory for packages", + ) + + parser.add_argument("package", type=str, help="Package name") + + args = parser.parse_args() + + try: + mod = import_module(args.package) + except ImportError: + print("ImportError") + sys.exit(1) + + try: + path_include = Path(mod.get_include()) + except AttributeError: + print(f"No {args.package}.get_include") + sys.exit(1) + + try: + path_include = path_include.relative_to(Path.cwd()) + except ValueError: + pass + + print(path_include) diff --git a/tests/test_get_includes.py b/tests/test_get_includes.py new file mode 100644 index 0000000..79f5cf8 --- /dev/null +++ b/tests/test_get_includes.py @@ -0,0 +1,22 @@ +import pytest + +from transonic_cl.get_includes import main + + +class MyException(Exception): + pass + + +def test_get_include(monkeypatch): + monkeypatch.setattr("sys.argv", ["transonic-get-include", "numpy"]) + main() + + def _exit(exit_code): + if exit_code == 1: + raise MyException + + monkeypatch.setattr("sys.exit", _exit) + monkeypatch.setattr("sys.argv", ["transonic-get-include", "numpyyyy"]) + + with pytest.raises(MyException): + main()