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

Use poetry backend #322

Merged
merged 11 commits into from
Oct 31, 2024
Merged
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
52 changes: 22 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Ubuntu CI

on: [push, pull_request]

env:
POETRY_VERSION: 1.8.3

jobs:
check_skip:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -31,12 +34,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip and setuptools
run: >
python -m pip install -U
pip
setuptools
virtualenv
- name: Install poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}

- name: Checkout source
uses: actions/checkout@v4
Expand Down Expand Up @@ -64,18 +65,14 @@ jobs:
echo "NUMBA_NRT_STATS=1" >> .env
echo "NUMBA_CAPTURED_ERRORS='new_style'" >> .env

- name: Create base virtual environment
run: python -m virtualenv -p ${{ matrix.python-version }} /tmp/base
- name: Setup poetry virtual environment
run: poetry env use python${{ matrix.python-version }}

- name: Install base codex-africanus
run: |
source /tmp/base/bin/activate
pip install .[testing]
- name: Install base package
run: poetry install --extras testing

- name: Run base test suite
run: |
source /tmp/base/bin/activate
py.test -s -vvv africanus/
- name: Test base package
run: poetry run pytest -s -vvv africanus

- name: List the measures directory
run: curl ftp://ftp.astron.nl/outgoing/Measures/ > measures_dir.txt
Expand All @@ -96,18 +93,11 @@ jobs:
curl ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar | tar xvzf - -C ~/measures
echo "measures.directory: ~/measures" > ~/.casarc

- name: Create complete virtual environment
run: python -m virtualenv -p ${{ matrix.python-version }} /tmp/complete
- name: Install complete package
run: poetry install --extras "complete testing"

- name: Install complete codex-africanus
run: |
source /tmp/complete/bin/activate
pip install .[complete] git+https://gitlab.mpcdf.mpg.de/ift/nifty_gridder.git#egg=nifty-gridder

- name: Run complete test suite
run: |
source /tmp/complete/bin/activate
py.test -s -vvv africanus/
- name: Test complete package
run: poetry run pytest -s -vvv africanus

deploy:
needs: [test]
Expand All @@ -124,16 +114,18 @@ jobs:
with:
python-version: '3.10'

- name: Install latest setuptools, wheel, pip
run: python3 -m pip install -U pip setuptools wheel
- name: Install poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}

- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Build distributions
run: python setup.py sdist bdist_wheel
run: poetry build

- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
Expand Down
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ History

0.3.8 (2024-09-29)
------------------
* Upgrade backend to poetry (:pr:`322`)
* Optimise the beam cube implementation (:pr:`320`)
* Support an `init_state` argument into both `Term.init_fields`
and `Transformer.init_fields` (:pr:`319`)
Expand Down
3 changes: 1 addition & 2 deletions africanus/util/tests/test_nvcc_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@


def test_nvcc_compiler(tmpdir):
from africanus.util.nvcc import compile_using_nvcc

cp = pytest.importorskip("cupy")
from africanus.util.nvcc import compile_using_nvcc

code = """
#include <cupy/carray.cuh>
Expand Down
8 changes: 2 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import os
import sys

sys.path.insert(0, os.path.abspath(".."))

import sphinx_rtd_theme
import africanus

Expand Down Expand Up @@ -62,17 +60,15 @@

# General information about the project.
project = "Codex Africanus"
copyright = "2018, Simon Perkins"
copyright = "2024, South African Radio Astronomy Observatory"
author = "Simon Perkins"

# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
# the built documents.
#
# The short X.Y version.
version = africanus.__version__
# The full version, including alpha/beta/rc tags.
release = africanus.__version__
release = "0.3.7"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
110 changes: 110 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[tool.poetry]
name = "codex-africanus"
version = "0.3.7"
description = "Radio Astronomy Building Blocks"
authors = ["Simon Perkins <[email protected]>"]
packages = [{include = "africanus"}]
readme = "README.rst"

[tool.poetry.dependencies]
python = "^3.10"
pytest = {version = "^8.0.0", optional = true}
flaky = {version = "^3.8.1", optional = true}
dask = {extras = ["array"], optional = true, version = "^2024.10.0"}
jax = {version = "^0.4.35", optional = true}
jaxlib = {version = "^0.4.35", optional = true}
scipy = {version = "^1.14.1", optional = true}
python-casacore = {version = "^3.6.1", optional = true}
ducc0 = {version = "^0.35.0", optional = true}
astropy = {version = "^6.1.4", optional = true}
cupy = {version = "^13.3.0", optional = true}
jinja2 = {version = "^3.1.4", optional = true}
appdirs = "^1.4.4"
decorator = "^5.1.1"
numpy = ">=2.0.0"
numba = "^0.60.0"

[tool.poetry.extras]
astropy = ["astropy"]
cuda = ["cupy", "jinja2"]
dask = ["dask"]
ducc0 = ["ducc0"]
jax = ["jax", "jaxlib"]
scipy = ["scipy"]
testing = ["flaky", "pytest"]
python-casacore = ["python-casacore"]
complete = ["astropy", "dask", "ducc0", "jax", "jaxlib", "python-casacore", "scipy"]
complete-cuda = ["astropy", "cuda", "cupy", "ducc0", "jax", "jaxlib", "python-casacore", "scipy"]

[tool.poetry.group.dev.dependencies]
tbump = "^6.11.0"
ruff = "^0.7.1"
pre-commit = "^4.0.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.ruff]
exclude = ["turbo-sim.py"]
line-length = 88
indent-width = 4
target-version = "py311"

[tool.ruff.lint]
extend-select = ["I"]
select = [
# flake8-builtins
"A",
# flake8-bugbear
"B",
# isort
"I001",
"I002",
# tidy imports
"TID"
]

[tool.tbump.version]
current = "0.3.7"

# Example of a semver regexp.
# Make sure this matches current_version before
# using tbump
regex = '''
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<patch>\d+)
'''

[tool.tbump.git]
message_template = "Bump to {new_version}"
tag_template = "{new_version}"

# For each file to patch, add a [[tool.tbump.file]] config
# section containing the path of the file, relative to the
# tbump.toml location.
[[tool.tbump.file]]
src = "pyproject.toml"

[[tool.tbump.file]]
src = "africanus/__init__.py"

[[tool.tbump.file]]
src = "doc/source/conf.py"

# You can specify a list of commands to
# run after the files have been patched
# and before the git commit is made

# [[tool.tbump.before_commit]]
# name = "check changelog"
# cmd = "grep -q {new_version} Changelog.rst"

# Or run some commands after the git tag and the branch
# have been pushed:
# [[tool.tbump.after_push]]
# name = "publish"
# cmd = "./publish.sh"
15 changes: 0 additions & 15 deletions ruff.toml

This file was deleted.

25 changes: 0 additions & 25 deletions setup.cfg

This file was deleted.

88 changes: 0 additions & 88 deletions setup.py

This file was deleted.