Skip to content

Commit

Permalink
Merge branch 'topic/default/fix-version' into 'branch/default'
Browse files Browse the repository at this point in the history
Fix version + transonic-get-include

See merge request fluiddyn/transonic!132
  • Loading branch information
paugier committed Feb 3, 2024
2 parents 77de10e + 7e287ef commit 62a9752
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 59 deletions.
58 changes: 32 additions & 26 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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)

Expand All @@ -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)

Expand Down Expand Up @@ -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)

Expand All @@ -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

Expand All @@ -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)

Expand Down Expand Up @@ -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
33 changes: 2 additions & 31 deletions data_tests/package_for_test_meson/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
8 changes: 8 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/transonic/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
__version__ = "0.5.3"
from importlib import metadata

__version__ = metadata.version(__package__)

try:
from pyfiglet import figlet_format
Expand Down
35 changes: 35 additions & 0 deletions src/transonic_cl/get_includes.py
Original file line number Diff line number Diff line change
@@ -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)
22 changes: 22 additions & 0 deletions tests/test_get_includes.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 62a9752

Please sign in to comment.