Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to poetry #1080

Open
wants to merge 14 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 56 additions & 72 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 contents of dist
run: ls -R dist

- name: List contests of wheelhouse
run: ls -R wheelhouse
- name: List contests of wheelhouse
run: ls -R wheelhouse

- name: Move wheelhouse wheel files to dist
run: |
rm dist/*
mv wheelhouse/* dist/
rmdir wheelhouse
- name: Move wheelhouse wheel files to dist
run: |
rm dist/*
mv wheelhouse/* dist/
rmdir wheelhouse

- name: List contents of dist
run: ls -R dist
- name: List contents of dist
run: ls -R dist

- name: Get the name of the wheel file
id: get-wheel-name
run: echo "::set-output name=wheel-name::$(ls dist/*.whl)"
- 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 }}
- 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
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion GPy/testing/test_gpy_kernels_state_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -620,7 +621,7 @@ def get_new_kernels():
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."
)

Expand Down
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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/)
Expand Down
62 changes: 62 additions & 0 deletions build_extension.py
Original file line number Diff line number Diff line change
@@ -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()],
})
Loading
Loading