Skip to content

Commit

Permalink
use dynamic versioning (#342)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dswah authored Feb 12, 2024
1 parent 620958f commit a6c14e4
Show file tree
Hide file tree
Showing 15 changed files with 1,022 additions and 882 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -33,13 +33,13 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: codecov/codecov-action@v3
Expand All @@ -51,9 +51,8 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry export --with dev > requirements.txt
pip install -r requirements.txt
poetry install --with dev
- name: Test with pytest
run: |
pytest --cov=pygam
codecov
poetry run pytest --cov=pygam
poetry run codecov
6 changes: 3 additions & 3 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ Or via ``conda-forge``, however this is typically less up-to-date: ::

conda install -c conda-forge pyGAM

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

pip install flit
flit install
pip install poetry
poetry install


Optional
Expand Down
8 changes: 4 additions & 4 deletions doc/source/notebooks/quick_start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
" \n",
"\n",
"#### Bleeding edge\n",
"You can install the bleeding edge from github using `flit`.\n",
"You can install the bleeding edge from github using `poetry`.\n",
"First clone the repo, ``cd`` into the main directory and do:\n",
"\n",
" pip install flit\n",
" flit install"
" pip install poetry\n",
" poetry install"
]
},
{
Expand Down Expand Up @@ -529,4 +529,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
1,818 changes: 982 additions & 836 deletions poetry.lock

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions pygam/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""
GAM toolkit
"""

from __future__ import absolute_import
from importlib.metadata import version, PackageNotFoundError

from pygam.pygam import GAM
from pygam.pygam import LinearGAM
Expand Down Expand Up @@ -33,4 +32,10 @@
'intercept',
]

__version__ = '0.8.0'

__version__ = "0.0.0" # placeholder for dynamic versioning
try:
__version__ = version("pygam")
except PackageNotFoundError:
# package is not installed
pass
2 changes: 0 additions & 2 deletions pygam/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
CallBacks
"""

from __future__ import absolute_import
from functools import wraps

import numpy as np
Expand Down
3 changes: 0 additions & 3 deletions pygam/core.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
"""
Core classes
"""

from __future__ import absolute_import

import numpy as np

from pygam.utils import round_to_n_decimal_places, flatten
Expand Down
2 changes: 0 additions & 2 deletions pygam/distributions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
Distributions
"""

from __future__ import division, absolute_import
from functools import wraps
from abc import ABCMeta
from abc import abstractmethod
Expand Down
2 changes: 0 additions & 2 deletions pygam/links.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
Link functions
"""
from __future__ import division, absolute_import

import numpy as np

from pygam.core import Core
Expand Down
2 changes: 0 additions & 2 deletions pygam/pygam.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-

from __future__ import division, absolute_import
from collections import defaultdict
from collections import OrderedDict
from copy import deepcopy
Expand Down
1 change: 0 additions & 1 deletion pygam/terms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Link functions
"""
from __future__ import division, absolute_import
from abc import ABCMeta
from abc import abstractmethod, abstractproperty
from collections import defaultdict
Expand Down
1 change: 0 additions & 1 deletion pygam/tests/test_terms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

from copy import deepcopy

import numpy as np
Expand Down
8 changes: 1 addition & 7 deletions pygam/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# -*- coding: utf-8 -*-

from copy import deepcopy

try:
# py >= 3.3
from unittest.mock import patch
except ImportError:
# py < 3.3
from mock import patch
from mock import patch

import numpy as np
import pytest
Expand Down
2 changes: 0 additions & 2 deletions pygam/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
Pygam utilities
"""

from __future__ import division
from copy import deepcopy
import numbers
import sys
Expand Down
25 changes: 18 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
[tool.poetry]
name = "pygam"
version = "0.9.0"
version = "0.0.0" # placeholder for dynamic versioning
description = ""
authors = ["Daniel Servén Marín", "Charlie Brummitt"]
license = "Apache-2.0"
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.8.1, <3.12"
numpy = "^1.24.2"
scipy = "^1.10.1"
python = ">=3.8.1, <3.13"
numpy = [
{ version = ">=1.24.2,<1.25", python = "<3.9,>=3.8" },
{ version = ">=1.25", python = "<3.13,>=3.9" },
]
progressbar2 = "^4.2.0"
scipy = [
{ version = ">=1.10.1,<1.11", python = "<3.9,>=3.8" },
{ version = ">=1.11.1,<1.12", python = "<3.13,>=3.9" }
]

[tool.poetry.group.dev.dependencies]
pandas = ">=1.6"
pytest = "^7.2.2"
flake8 = "^6.0.0"
codecov = "^2.1.12"
Expand All @@ -22,7 +29,6 @@ nbsphinx = "^0.9.0"
sphinx-rtd-theme = "^1.2.0"
sphinxcontrib-napoleon = "^0.7"
ipython = "^8.11.0"
pandas = "^1.5.3"
black = "^23.1.0"

[tool.black]
Expand All @@ -46,5 +52,10 @@ exclude = '''
'''

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
style = "semver"

0 comments on commit a6c14e4

Please sign in to comment.