Skip to content

Commit b36fa9e

Browse files
authored
Merge pull request #9 from brian-team/infra_updates
Infrastructure updates
2 parents 2883ffc + da987f7 commit b36fa9e

15 files changed

+66
-85
lines changed

.github/workflows/publish.yaml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,19 @@ on:
44
push:
55
tags:
66
- 'v*'
7-
pull_request:
8-
tags:
9-
- 'v*'
107

118
jobs:
129
pypi-publish:
1310
name: upload release to PyPI
1411
runs-on: ubuntu-latest
1512
environment: release
1613
permissions:
14+
# IMPORTANT: this permission is mandatory for trusted publishing
1715
id-token: write
1816
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v4
21-
22-
- name: Set up Python
23-
uses: actions/setup-python@v5
17+
- uses: actions/checkout@v4
2418
with:
25-
python-version: '3.x'
26-
27-
- name: Install build dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install build
31-
32-
- name: Build package
33-
run: python -m build
34-
35-
- name: List dist directory contents
36-
run: ls -la dist
37-
19+
fetch-depth: 0 # We need all history to determine the version
20+
- uses: pdm-project/setup-pdm@v4
3821
- name: Publish package distributions to PyPI
39-
uses: pypa/gh-action-pypi-publish@release/v1
22+
run: pdm publish

.github/workflows/pytest-ubuntu.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
name: Python package
1+
name: Tests
22

33
on: [push, pull_request]
44

55
jobs:
66
test:
7-
runs-on: ubuntu-latest
7+
name: Run tests
8+
runs-on: ubuntu-24.04
89

910
steps:
1011
- name: Check out the repository
1112
uses: actions/checkout@v4
1213

13-
- name: Set up Python
14-
uses: actions/setup-python@v5
14+
- name: Set up PDM
15+
uses: pdm-project/setup-pdm@v4
1516
with:
16-
python-version: '3.x'
17+
python-version: 3.13
1718

1819
- name: Install dependencies
1920
run: |
20-
python -m pip install --upgrade pip
21-
pip install .[test]
21+
pdm install -G test
2222
2323
- name: Run tests
2424
run: |
25-
pytest --doctest-modules
25+
pdm run -v pytest --doctest-modules

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,8 @@ cython_debug/
161161

162162
# version
163163
_version.py
164+
165+
# pdm
166+
pdm.lock
167+
.pdm-*/
168+
.pdm-*

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ version: 2
77

88
# Set the OS, Python version and other tools you might need
99
build:
10-
os: 'ubuntu-20.04'
10+
os: 'ubuntu-22.04'
1111
tools:
12-
python: "3.11"
12+
python: "3.12"
1313

1414
# Build documentation in the "docs/" directory with Sphinx
1515
sphinx:

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
# QuantSI
22
Work in progress: unit system as used by the Brian2 simulator
3-
4-
We will think of a better name before releasing…

pyproject.toml

Lines changed: 34 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[project]
22
name = "QuantSI"
3+
description = "unit system as used by the Brian2 simulator"
34
authors = [
4-
{name = 'Sorin Birchi'},
5+
{name = "Sorin Birchi"},
6+
{name = "Marcel Stimberg"},
7+
{name = "Dan Goodman"},
8+
{name = "Romain Brette"},
59
]
6-
requires-python = '>=3.10'
7-
dependencies = [
8-
'numpy>=1.23.5',
9-
'sympy>=1.2',
10-
'setuptools>=61'
11-
]
12-
dynamic = ["version", "readme"]
13-
description = 'unit system as used by the Brian2 simulator'
14-
keywords = ['computational neuroscience', 'simulation', 'system units']
10+
dependencies = ["numpy>=1.25", "sympy>=1.2"]
11+
requires-python = ">=3.10"
12+
readme = "README.md"
13+
license = {text = "GPLv3"}
14+
keywords = ['SI', 'SI units', 'unit system', 'physical quantities']
1515
classifiers = [
1616
'Development Status :: 4 - Beta',
1717
'Intended Audience :: Science/Research',
@@ -20,51 +20,34 @@ classifiers = [
2020
'Operating System :: OS Independent',
2121
'Programming Language :: Python',
2222
'Programming Language :: Python :: 3',
23-
'Topic :: Scientific/Engineering :: Bio-Informatics'
23+
'Topic :: Scientific/Engineering'
2424
]
25+
dynamic = ["version"]
2526

2627
[project.optional-dependencies]
27-
test = ['pytest', 'pytest-xdist>=1.22.3']
28-
docs = ['sphinx>=7', 'ipython>=5', 'sphinx-tabs']
29-
30-
[project.urls]
31-
Documentation ='https://QuantSI.readthedocs.io/en/latest/'
32-
Source = 'https://github.com/brian-team/QuantSI'
33-
Tracker = 'https://github.com/brian-team/QuantSI/issues'
34-
35-
[build-system]
36-
requires = [
37-
"setuptools>=61",
38-
"numpy>=2.0.0rc1",
39-
"wheel",
40-
"setuptools_scm[toml]>=6.2"
28+
test = [
29+
"pytest>=8.3.4",
30+
"pytest-xdist>=1.22.3",
31+
"pdm-backend>=2.4.3",
4132
]
42-
build-backend = "setuptools.build_meta"
43-
44-
[tool.setuptools]
45-
zip-safe = false
46-
include-package-data = true
47-
48-
[tool.setuptools.packages.find]
49-
include = ["QuantSI*"]
50-
51-
[tool.setuptools.dynamic]
52-
readme = {file = 'README.md', content-type = "text/markdown"}
33+
docs = [
34+
"sphinx>=7",
35+
"ipython>=5",
36+
"sphinx-tabs>=3.4.7",
37+
]
38+
[build-system]
39+
requires = ["pdm-backend"]
40+
build-backend = "pdm.backend"
5341

54-
[tool.setuptools_scm]
55-
version_scheme = 'post-release'
56-
local_scheme = 'no-local-version'
57-
write_to = 'QuantSI/_version.py'
58-
fallback_version = 'unknown'
42+
[tool.pdm]
43+
distribution = true
5944

60-
[tool.black]
61-
target-version = ['py310']
62-
include = '^/QuantSI/.*\.pyi?$'
45+
[tool.pdm.version]
46+
source = "scm"
47+
tag_filter = "v*"
48+
version_format = "src.version_helper:format_version"
49+
write_to = "QuantSI/_version.py"
50+
write_template = "__version__ = '{}'"
6351

64-
[tool.isort]
65-
atomic = true
66-
profile = "black"
67-
py_version = "311"
68-
skip_gitignore = true
69-
# NOTE: isort has no "include" option, only "skip".
70-
skip_glob = ["docs_sphinx/*"]
52+
[tool.pytest.ini_options]
53+
addopts = "-ra"

QuantSI/__init__.py renamed to src/QuantSI/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
# isort:skip_file
6+
from ._version import __version__
67

78
from .allunits import (
89
# basic units
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/version_helper.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from pdm.backend.hooks.version import SCMVersion
2+
3+
def format_version(version) -> str:
4+
"""
5+
Format the version number of the package. This function is only supposed to be
6+
called by the pdm-backend to get the version number of the package.
7+
"""
8+
if version.distance is None:
9+
return str(version.version)
10+
else:
11+
return f"{version.version}.post{version.distance}"

0 commit comments

Comments
 (0)