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
8 changes: 6 additions & 2 deletions .github/workflows/deploy_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ jobs:
- name: Build and deploy to TestPyPI
if: steps.duplicate_check.outputs.should_skip != 'true'
run: |
CURRENT_VERSION=$(sed -n 's/__version__ = "\(.*\)"/\1/p' psydac/version.py)
CURRENT_VERSION=$(grep 'version *= *"\([0-9\.]*\)"' pyproject.toml | grep '[0-9\.]*' -o)
TEST_VERSION=${CURRENT_VERSION}.dev$(date +%Y%m%d%H%M%S)
sed -i.bak "s/${CURRENT_VERSION}/${TEST_VERSION}/g" psydac/version.py && rm psydac/version.py.bak
sed -i.bak "s/\"${CURRENT_VERSION}\"/\"${TEST_VERSION}\"/g" pyproject.toml && rm pyproject.toml.bak
echo "TEST_VERSION=${TEST_VERSION}" >> $GITHUB_ENV
# Setup dummy user to save temp version for meson
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git commit -m "Save temp version" pyproject.toml
python -m build --sdist
ls dist/*
twine check --strict dist/*
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "external/igakit"]
path = external/igakit
[submodule "subprojects/igakit"]
path = subprojects/igakit
url = https://github.com/dalcinl/igakit/
47 changes: 47 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
project(
'psydac',
'c', 'fortran',
meson_version: '>=1.1.0',
)

run_command('pyccel', 'make', '-g', 'psydac/**/*_kernels.py', '--convert-only',
check: true)

find = find_program('find', required: true)

pyccel_meson_math_file = run_command(find, '__pyccel__/math', '-name', 'meson.build',
check: true).stdout().strip()
pyccel_meson_cwrapper_file = run_command(find, '__pyccel__/cwrapper', '-name', 'meson.build',
check: true).stdout().strip()
pyccel_meson_files = run_command(find, '__pyccel__/psydac', '-name', 'meson.build',
check: true).stdout().split()

sed = find_program('sed', required: true)

run_command(sed, '-i.swp', 's/install: true//g', pyccel_meson_math_file, pyccel_meson_cwrapper_file,
check: true)

foreach f : pyccel_meson_files
f_parts = f.split('/')
rel_f = f_parts.get(1)
foreach i : range(2, f_parts.length()-1)
rel_f = rel_f / f_parts.get(i)
endforeach
run_command(sed, '-i.swp', 's/install_dir: .*/subdir: \'' + rel_f.replace('/','\/') + '\',/g', f,
check: true)
endforeach


igakit_proj = subproject('igakit')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line to ship without bundling igakit


py = import('python').find_installation(modules: ['numpy'], pure: false)

subdir('__pyccel__/math')
subdir('__pyccel__/cwrapper')
subdir('__pyccel__/psydac')

# Install the pure-Python package itself
install_subdir('psydac', install_dir: py.get_install_dir())
install_subdir('mesh', install_dir: py.get_install_dir())


31 changes: 30 additions & 1 deletion psydac/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,33 @@
# LICENSE file or go to https://github.com/pyccel/psydac/blob/devel/LICENSE #
# for full license details. #
#---------------------------------------------------------------------------#
__version__ = "0.1"
def extract_version() -> str:
"""
Returns either the version of the installed package (e.g. "0.17.1") or the
one found in pyproject.toml (e.g. "0.17.1-dev (at /project/location)").

Returns
-------
str
The package version.

See also
--------
https://stackoverflow.com/a/76206192

"""
from contextlib import suppress
from pathlib import Path

with suppress(FileNotFoundError, StopIteration):
root_dir = Path(__file__).parent.parent
with open(root_dir / "pyproject.toml", encoding="utf-8") as pyproject_toml:
version_line = next(line for line in pyproject_toml if line.startswith("version"))
version = version_line.split("=")[1].strip("'\"\n ")
return f"{version}-dev (at {root_dir})"

import importlib.metadata
return importlib.metadata.version(__package__)


__version__ = extract_version()
20 changes: 7 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[build-system]
requires = ["setuptools >= 64.0, != 67.2.0", "wheel", "numpy", "pyccel >= 2.1.0"]
build-backend = "setuptools.build_meta"
requires = ["meson-python", "wheel", "numpy", "pyccel >= 2.1.0"]
build-backend = "mesonpy"

[project]
name = "psydac"
description = "Python package for isogeometric analysis (IGA)"
dynamic = ["version"]
readme = "README.md"
license = "MIT"
license-files = ["LICENSE", "AUTHORS"]
version = "0.1"
requires-python = ">= 3.10"
authors = [
{name = "PSYDAC development team", email = "[email protected]"}
Expand Down Expand Up @@ -51,9 +51,6 @@ dependencies = [
# When pyccel is run in parallel with MPI, it uses tblib to pickle
# tracebacks, which allows mpi4py to broadcast exceptions
'tblib',

# IGAKIT - not on PyPI
'igakit @ https://github.com/dalcinl/igakit/archive/refs/heads/master.zip'
]

[project.optional-dependencies]
Expand All @@ -73,13 +70,10 @@ Repository = "https://github.com/pyccel/psydac.git"
psydac-mesh = "psydac.cmd.mesh:main"
psydac-accelerate = "psydac.cmd.accelerate:main"

[tool.setuptools.packages.find]
include = ["psydac*"]
exclude = ["*__psydac__*"]
namespaces = false

[tool.setuptools.package-data]
"*" = ["*.txt", "**/tests/data/*.png"]
[tool.meson-python.args]
setup=['-Ddefault_library=static']
dist=['--include-subprojects']
install=['--only=python-modules']

[tool.coverage.run]
branch = true
Expand Down