Skip to content

Commit

Permalink
Drop Python 3.7, support 3.11, improve installation (#134)
Browse files Browse the repository at this point in the history
- Require Python 3.8 as minimum version
- Remove `setup.py` and create `pyproject.toml`
- Do not run CI tests with Python 3.7
- Run CI tests with Python 3.11
- Read `__version__` in "smart" way: either from metadata of installed
package, or directly from `pyproject.toml`
- Update package version to 0.17.2
  • Loading branch information
yguclu committed Jul 6, 2023
1 parent fdc7c4d commit 0147846
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.8, 3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v2
Expand Down
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[build-system]
requires = ["setuptools >= 64.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "sympde"
version = "0.17.2"
description = "Symbolic calculus for partial differential equations (and variational forms)"
readme = "README.rst"
requires-python = ">= 3.8, < 3.12"
license = {file = "LICENSE"}
authors = [{name = "Ahmed Ratnani", email = "ratnaniahmed@gmail.com"}]
maintainers = [
{name = "Yaman Güçlü", email = "yaman.guclu@gmail.com"},
{name = "Said Hadjout"},
]
keywords = ["math"]
classifiers = ["Programming Language :: Python :: 3"]
dependencies = [
'sympy >= 1.2, < 1.7',
'h5py',
'pytest',
'pyyaml',
'numpy',
'matplotlib'
]

[project.urls]
Repository = "https://github.com/pyccel/sympde"

[tool.setuptools.packages.find]
include = ["sympde*"]
namespaces = false

[tool.setuptools.package-data]
"*" = ["README.rst"]
61 changes: 0 additions & 61 deletions setup.py

This file was deleted.

31 changes: 30 additions & 1 deletion sympde/version.py
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
__version__ = "0.17.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()

0 comments on commit 0147846

Please sign in to comment.