Skip to content

Commit a6c14e4

Browse files
authored
use dynamic versioning (#342)
* use dynamic versioning * remove python-2 imports * replace mentions of flit with poetry * test py311 py312 * allow py312 * fix solving for scipy * fix solving for scipy * fix solving for scipy * fix solving for scipy * use poetry natively? * special numpy for py312 * update pandas, remove zieb cli
1 parent 620958f commit a6c14e4

File tree

15 files changed

+1022
-882
lines changed

15 files changed

+1022
-882
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
permissions:
1313
contents: read
14-
14+
1515
jobs:
1616
lint:
1717
runs-on: ubuntu-latest
@@ -33,13 +33,13 @@ jobs:
3333
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3434
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3535
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36-
36+
3737
test:
3838
runs-on: ubuntu-latest
3939
strategy:
4040
fail-fast: false
4141
matrix:
42-
python-version: ["3.8", "3.9", "3.10"]
42+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
4343
steps:
4444
- uses: actions/checkout@v3
4545
- uses: codecov/codecov-action@v3
@@ -51,9 +51,8 @@ jobs:
5151
run: |
5252
python -m pip install --upgrade pip
5353
pip install poetry
54-
poetry export --with dev > requirements.txt
55-
pip install -r requirements.txt
54+
poetry install --with dev
5655
- name: Test with pytest
5756
run: |
58-
pytest --cov=pygam
59-
codecov
57+
poetry run pytest --cov=pygam
58+
poetry run codecov

doc/source/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ Or via ``conda-forge``, however this is typically less up-to-date: ::
2828

2929
conda install -c conda-forge pyGAM
3030

31-
You can install the bleeding edge from github using ``flit``.
31+
You can install the bleeding edge from github using ``poetry``.
3232
First clone the repo, ``cd`` into the main directory and do: ::
3333

34-
pip install flit
35-
flit install
34+
pip install poetry
35+
poetry install
3636

3737

3838
Optional

doc/source/notebooks/quick_start.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
" \n",
2828
"\n",
2929
"#### Bleeding edge\n",
30-
"You can install the bleeding edge from github using `flit`.\n",
30+
"You can install the bleeding edge from github using `poetry`.\n",
3131
"First clone the repo, ``cd`` into the main directory and do:\n",
3232
"\n",
33-
" pip install flit\n",
34-
" flit install"
33+
" pip install poetry\n",
34+
" poetry install"
3535
]
3636
},
3737
{
@@ -529,4 +529,4 @@
529529
},
530530
"nbformat": 4,
531531
"nbformat_minor": 2
532-
}
532+
}

poetry.lock

Lines changed: 982 additions & 836 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pygam/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
GAM toolkit
33
"""
4-
5-
from __future__ import absolute_import
4+
from importlib.metadata import version, PackageNotFoundError
65

76
from pygam.pygam import GAM
87
from pygam.pygam import LinearGAM
@@ -33,4 +32,10 @@
3332
'intercept',
3433
]
3534

36-
__version__ = '0.8.0'
35+
36+
__version__ = "0.0.0" # placeholder for dynamic versioning
37+
try:
38+
__version__ = version("pygam")
39+
except PackageNotFoundError:
40+
# package is not installed
41+
pass

pygam/callbacks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""
22
CallBacks
33
"""
4-
5-
from __future__ import absolute_import
64
from functools import wraps
75

86
import numpy as np

pygam/core.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"""
22
Core classes
33
"""
4-
5-
from __future__ import absolute_import
6-
74
import numpy as np
85

96
from pygam.utils import round_to_n_decimal_places, flatten

pygam/distributions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""
22
Distributions
33
"""
4-
5-
from __future__ import division, absolute_import
64
from functools import wraps
75
from abc import ABCMeta
86
from abc import abstractmethod

pygam/links.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""
22
Link functions
33
"""
4-
from __future__ import division, absolute_import
5-
64
import numpy as np
75

86
from pygam.core import Core

pygam/pygam.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
3-
from __future__ import division, absolute_import
42
from collections import defaultdict
53
from collections import OrderedDict
64
from copy import deepcopy

pygam/terms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
22
Link functions
33
"""
4-
from __future__ import division, absolute_import
54
from abc import ABCMeta
65
from abc import abstractmethod, abstractproperty
76
from collections import defaultdict

pygam/tests/test_terms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
32
from copy import deepcopy
43

54
import numpy as np

pygam/tests/test_utils.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
from copy import deepcopy
4-
5-
try:
6-
# py >= 3.3
7-
from unittest.mock import patch
8-
except ImportError:
9-
# py < 3.3
10-
from mock import patch
4+
from mock import patch
115

126
import numpy as np
137
import pytest

pygam/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""
22
Pygam utilities
33
"""
4-
5-
from __future__ import division
64
from copy import deepcopy
75
import numbers
86
import sys

pyproject.toml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
[tool.poetry]
22
name = "pygam"
3-
version = "0.9.0"
3+
version = "0.0.0" # placeholder for dynamic versioning
44
description = ""
55
authors = ["Daniel Servén Marín", "Charlie Brummitt"]
66
license = "Apache-2.0"
77
readme = "README.md"
88

99
[tool.poetry.dependencies]
10-
python = ">=3.8.1, <3.12"
11-
numpy = "^1.24.2"
12-
scipy = "^1.10.1"
10+
python = ">=3.8.1, <3.13"
11+
numpy = [
12+
{ version = ">=1.24.2,<1.25", python = "<3.9,>=3.8" },
13+
{ version = ">=1.25", python = "<3.13,>=3.9" },
14+
]
1315
progressbar2 = "^4.2.0"
16+
scipy = [
17+
{ version = ">=1.10.1,<1.11", python = "<3.9,>=3.8" },
18+
{ version = ">=1.11.1,<1.12", python = "<3.13,>=3.9" }
19+
]
1420

1521
[tool.poetry.group.dev.dependencies]
22+
pandas = ">=1.6"
1623
pytest = "^7.2.2"
1724
flake8 = "^6.0.0"
1825
codecov = "^2.1.12"
@@ -22,7 +29,6 @@ nbsphinx = "^0.9.0"
2229
sphinx-rtd-theme = "^1.2.0"
2330
sphinxcontrib-napoleon = "^0.7"
2431
ipython = "^8.11.0"
25-
pandas = "^1.5.3"
2632
black = "^23.1.0"
2733

2834
[tool.black]
@@ -46,5 +52,10 @@ exclude = '''
4652
'''
4753

4854
[build-system]
49-
requires = ["poetry-core"]
50-
build-backend = "poetry.core.masonry.api"
55+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
56+
build-backend = "poetry_dynamic_versioning.backend"
57+
58+
[tool.poetry-dynamic-versioning]
59+
enable = true
60+
vcs = "git"
61+
style = "semver"

0 commit comments

Comments
 (0)