This commit is contained in:
Martin Bubel 2025-01-25 16:18:04 +00:00 committed by GitHub
commit 0059ad0a3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 3558 additions and 94 deletions

View file

@ -30,20 +30,15 @@ jobs:
- name: Install build dependencies
run: |
pip install setuptools
pip install poetry
- name: Install lib
run: |
python setup.py develop
- name: Install test dependencies
run: |
pip install matplotlib
pip install pytest
poetry install
- name: pytest
run: |
pytest GPy/testing
poetry run pytest
test-linux:
strategy:
@ -62,20 +57,15 @@ jobs:
- name: Install build dependencies
run: |
pip install setuptools
pip install poetry
- name: Install lib
run: |
python setup.py develop
- name: Install test dependencies
run: |
pip install matplotlib
pip install pytest
poetry install
- name: pytest
run: |
pytest GPy/testing
poetry run pytest
test-macos:
strategy:
@ -94,20 +84,15 @@ jobs:
- name: Install dependencies
run: |
pip install setuptools
pip install poetry
- name: Install lib
run: |
python setup.py develop
- name: Install test dependencies
run: |
pip install matplotlib
pip install pytest
poetry install
- name: pytest
run: |
pytest GPy/testing
poetry run pytest
build-windows:
if: github.event_name == 'release'
@ -127,11 +112,8 @@ jobs:
- name: Build lib
run: |
pip install setuptools
pip install wheel
python setup.py develop
python setup.py bdist_wheel
python setup.py sdist bdist_wheel
pip install poetry
poetry build
- name: List contents of dist
run: ls -R dist
@ -160,10 +142,8 @@ jobs:
- name: Build lib
run: |
pip install setuptools
pip install wheel
python setup.py develop
python setup.py bdist_wheel
pip install poetry
poetry build
- name: List contents of dist
run: ls -R dist
@ -183,48 +163,53 @@ jobs:
container: quay.io/pypa/manylinux2014_x86_64
steps:
- uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v1
- name: Compile c headers
run: |
/opt/python/${{ matrix.python }}/bin/python setup.py develop
- name: Install poetry
run: |
/opt/python/${{ matrix.python }}/bin/python -m pip install poetry
- name: Build wheel files
run: |
/opt/python/${{ matrix.python }}/bin/python setup.py bdist_wheel
- name: Compile c headers
run: |
/opt/python/${{ matrix.python }}/bin/python -m poetry install
- name: Install auditwheel
run: |
/opt/python/${{ matrix.python }}/bin/python -m pip install auditwheel
- name: Repair wheel files
run: |
/opt/python/${{ matrix.python }}/bin/python -m auditwheel repair dist/*${{ matrix.python }}-linux_x86_64.whl
- name: Build wheel files
run: |
/opt/python/${{ matrix.python }}/bin/python -m poetry build
- name: List contents of dist
run: ls -R dist
- name: Install auditwheel
run: |
/opt/python/${{ matrix.python }}/bin/python -m pip install auditwheel
- name: Repair wheel files
run: |
/opt/python/${{ matrix.python }}/bin/python -m auditwheel repair dist/*${{ matrix.python }}-linux_x86_64.whl
- name: List contests of wheelhouse
run: ls -R wheelhouse
- name: List contents of dist
run: ls -R dist
- name: Move wheelhouse wheel files to dist
run: |
rm dist/*
mv wheelhouse/* dist/
rmdir wheelhouse
- name: List contests of wheelhouse
run: ls -R wheelhouse
- name: List contents of dist
run: ls -R dist
- name: Move wheelhouse wheel files to dist
run: |
rm dist/*
mv wheelhouse/* dist/
rmdir wheelhouse
- name: Get the name of the wheel file
id: get-wheel-name
run: echo "::set-output name=wheel-name::$(ls dist/*.whl)"
- name: List contents of dist
run: ls -R dist
- name: Archive build artifacts
uses: actions/upload-artifact@v1
with:
name: dist-artifacts-manylinux-${{ matrix.python }}
path: ${{ steps.get-wheel-name.outputs.wheel-name }}
- name: Get the name of the wheel file
id: get-wheel-name
run: echo "::set-output name=wheel-name::$(ls dist/*.whl)"
- name: Archive build artifacts
uses: actions/upload-artifact@v1
with:
name: dist-artifacts-manylinux-${{ matrix.python }}
path: ${{ steps.get-wheel-name.outputs.wheel-name }}
deploy:
runs-on: ubuntu-latest
@ -265,8 +250,7 @@ jobs:
run: |
ls -R dist
- name: Upload to PyPI using twine
run: twine upload --skip-existing dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- name: Upload to PyPI
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry publish

View file

@ -4,6 +4,7 @@
"""
Testing state space related functions.
"""
import pytest
import numpy as np
import GPy
import GPy.models.state_space_model as SS_model
@ -620,7 +621,7 @@ class TestStateSpaceKernels:
var_compare_decimal=2,
)
except AssertionError:
raise SkipTest(
raise pytest.skip(
"Skipping Regular kalman filter for kernel addition, because it is not stable (normal situation) for this data."
)

View file

@ -19,9 +19,7 @@ The Gaussian processes framework in Python.
## What's new:
From now on we keep track of changes in the CHANGELOG.md.
If you want your changes to show up there follow the [guidelines](#gl).
In particular tag your commits by the [gitchangelog](https://github.com/vaab/gitchangelog) commit message format.
We switched to [poetry](https://python-poetry.org/). This means that `GPy` has become a `poetry` project. This change won't affect you if you are using `GPy` as a dependency. However, for developers and contributors, this change will make the development process easier and more consistent.
## Contributing to GPy
@ -54,24 +52,6 @@ For any further questions/suggestions head over to the issues section in GPy.
Ask questions using the issues section.
## Updated Structure
We have pulled the core parameterization out of GPy. It is a package called [paramz](https://github.com/sods/paramz) and is the pure gradient based model optimization.
If you installed GPy with pip, just upgrade the package using:
$ pip install --upgrade GPy
If you have the developmental version of GPy (using the develop or -e option) just install the dependencies by running
$ python setup.py develop
again, in the GPy installation folder.
A warning: This usually works, but sometimes `distutils/setuptools` opens a
whole can of worms here, specially when compiled extensions are involved.
If that is the case, it is best to clean the repo and reinstall.
## Supported Platforms:
[<img src="https://www.python.org/static/community_logos/python-logo-generic.svg" height=40px>](https://www.python.org/)

62
build_extension.py Normal file
View file

@ -0,0 +1,62 @@
import sys
import numpy as np
from setuptools import setup, Extension
def ismac():
return sys.platform[:6] == "darwin"
if ismac():
compile_flags = ["-O3"]
link_args = []
else:
compile_flags = ["-fopenmp", "-O3"]
link_args = ["-lgomp"]
extensions = [
Extension(
name="GPy.kern.src.stationary_cython",
sources=[
"GPy/kern/src/stationary_cython.pyx",
"GPy/kern/src/stationary_utils.c",
],
include_dirs=[np.get_include(), "."],
extra_compile_args=compile_flags,
extra_link_args=link_args,
),
Extension(
name="GPy.util.choleskies_cython",
sources=["GPy/util/choleskies_cython.pyx"],
include_dirs=[np.get_include(), "."],
extra_link_args=link_args,
extra_compile_args=compile_flags,
),
Extension(
name="GPy.util.linalg_cython",
sources=["GPy/util/linalg_cython.pyx"],
include_dirs=[np.get_include(), "."],
extra_compile_args=compile_flags,
extra_link_args=link_args,
),
Extension(
name="GPy.kern.src.coregionalize_cython",
sources=["GPy/kern/src/coregionalize_cython.pyx"],
include_dirs=[np.get_include(), "."],
extra_compile_args=compile_flags,
extra_link_args=link_args,
),
Extension(
name="GPy.models.state_space_cython",
sources=["GPy/models/state_space_cython.pyx"],
include_dirs=[np.get_include(), "."],
extra_compile_args=compile_flags,
extra_link_args=link_args,
),
]
def build(setup_kwargs):
"""Needed for the poetry building interface."""
setup_kwargs.update({
'ext_modules': extensions,
# 'include_dirs': [np.get_include()],
})

3386
poetry.lock generated Normal file

File diff suppressed because it is too large Load diff

51
pyproject.toml Normal file
View file

@ -0,0 +1,51 @@
[tool.poetry]
name = "GPy"
version = "1.13.1"
description = "The Gaussian Process Toolbox"
authors = ["GPy Authors <gpy.authors@gmail.com>"]
license = "BSD-3-Clause"
keywords = ["machine-learning", "gaussian-processes", "kernels"]
homepage = "https://sheffieldml.github.io/GPy/"
repository = "https://github.com/SheffieldML/GPy"
documentation = "https://github.com/SheffieldML/GPy"
readme = "README.md"
build = "build_extension.py"
include = ["build_extension.py"]
packages = [{ include = "GPy" }]
[tool.poetry.dependencies]
python = ">=3.9,<4"
numpy = ">=1.7,<2" # paramz is not compatible with numpy 2.0
six = "*"
paramz = ">=0.9.6"
cython = "^0.29"
scipy = [
{ version = ">=1.3.0,<1.14.0", markers = "python_version == \"3.9\"" },
# as off scipy 1.14.0, the minimum python version is 3.10
{ version = ">=1.3.0", markers = "python_version > \"3.9\"" },
]
tables = ">=3.9.0"
sphinx = { version = "*", optional = true }
mpi4py = { version = "*", optional = true }
ipython = { version = ">=4.0.0", optional = true }
matplotlib = { version = ">=3.3.4", optional = true }
plotly = { version = ">=1.8.6", optional = true }
jupyter_client = { version = ">=4.0.6", optional = true }
ipywidgets = { version = ">=4.0.3", optional = true }
ipykernel = { version = ">=4.1.0", optional = true }
notebook = { version = ">=4.0.5", optional = true }
[tool.poetry.extras]
docs = ["sphinx"]
optional = ["mpi4py", "ipython"]
plotting = ["matplotlib", "plotly"]
notebook = ["jupyter_client", "ipywidgets", "ipykernel", "notebook"]
[tool.poetry.group.dev.dependencies]
matplotlib = "^3.9.1"
pytest = "^8.2.2"
pods = "^0.1.14"
[build-system]
requires = ["poetry-core>=1.0.0", "setuptools", "wheel", "numpy", "cython"]
build-backend = "poetry.core.masonry.api"