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

View file

@ -4,6 +4,7 @@
""" """
Testing state space related functions. Testing state space related functions.
""" """
import pytest
import numpy as np import numpy as np
import GPy import GPy
import GPy.models.state_space_model as SS_model import GPy.models.state_space_model as SS_model
@ -620,7 +621,7 @@ class TestStateSpaceKernels:
var_compare_decimal=2, var_compare_decimal=2,
) )
except AssertionError: except AssertionError:
raise SkipTest( raise pytest.skip(
"Skipping Regular kalman filter for kernel addition, because it is not stable (normal situation) for this data." "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: ## What's new:
From now on we keep track of changes in the CHANGELOG.md. 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.
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.
## Contributing to GPy ## 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. 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: ## Supported Platforms:
[<img src="https://www.python.org/static/community_logos/python-logo-generic.svg" height=40px>](https://www.python.org/) [<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"