Skip to content

Commit

Permalink
Migrate to uv builds (#126)
Browse files Browse the repository at this point in the history
* Migrate to `uv` builds

* Ignore example-files

* ruff fix

* Address @cbrnr PR review.

* Put pytest and ruff into single group.

* rm uv.lock

* ignore uv.lock

* CI - Don't cache uv install
  • Loading branch information
cboulay authored Dec 6, 2024
1 parent 0df1599 commit b718033
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 124 deletions.
34 changes: 9 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,15 @@ jobs:

build:
needs: style
name: Build package
runs-on: ubuntu-22.04
name: Build and publish package
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.12'
- name: Build sdist and wheel
run: |
pip install build
python -m build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist

upload-pypi:
name: Upload to PyPI
needs: build
runs-on: ubuntu-22.04
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: pypa/[email protected]
python-version: "3.12"
- name: Build Package
run: uv build
- name: Publish package distributions to PyPI
run: uv publish
26 changes: 13 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Test

on: [push, pull_request]
on:
push:
branches: [main]
pull_request:
branches:
- main
workflow_dispatch:

jobs:
style:
Expand All @@ -17,22 +23,16 @@ jobs:
needs: style
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ["3.9", "3.10", "3.11", "3.12"]
name: Run tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build sdist and wheel
run: |
pip install build
python -m build
- name: Install wheel
run: pip install "$(pwd)/$(echo dist/pyxdf*.whl)[dev]"
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Build
run: uv sync --all-extras
- name: Run tests
run: |
git clone https://github.com/xdf-modules/example-files.git
pip install pytest
pytest
uv run pytest
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ venv/
ENV/
env.bak/
venv.bak/
uv.lock

# Spyder project settings
.spyderproject
Expand All @@ -107,5 +108,11 @@ venv.bak/
.idea

# cython temporaries
/pyxdf/pyxdf.c
/pyxdf/pyxdf.html
/src/pyxdf/pyxdf.c
/src/pyxdf/pyxdf.html

# Dynamic version file
/src/pyxdf/__version__.py

# Test files
example-files/
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[project]
name = "pyxdf"
description = "Python library for importing XDF (Extensible Data Format)"
authors = [
{ name = "Christian Kothe", email = "[email protected]" },
{ name = "Chadwick Boulay", email = "[email protected]" },
{ name = "Clemens Brunner", email = "[email protected]" }
]
license = {file = "LICENSE"}
readme = "README.md"
requires-python = ">=3.9"
dynamic = ["version"]
keywords = [
"XDF",
"pyxdf",
"LSL",
"Lab Streaming Layer",
"file format",
"biosignals",
"stream",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: BSD License",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"numpy>=2.0.2",
]

[project.urls]
Repository = "https://github.com/xdf-modules/pyxdf"
Issues = "https://github.com/xdf-modules/pyxdf/issues"
Changelog = "https://github.com/xdf-modules/pyxdf/blob/main/CHANGELOG.md"

[dependency-groups]
dev = [
"pytest>=8.3.4",
"ruff>=0.8.2",
]

[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/pyxdf/__version__.py"

[tool.hatch.build.targets.wheel]
packages = ["src/pyxdf"]
15 changes: 0 additions & 15 deletions pyxdf/__init__.py

This file was deleted.

7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

61 changes: 0 additions & 61 deletions setup.py

This file was deleted.

4 changes: 4 additions & 0 deletions src/pyxdf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .__version__ import __version__ as __version__
from .pyxdf import load_xdf, match_streaminfos, resolve_streams

__all__ = ["load_xdf", "resolve_streams", "match_streaminfos"]
Empty file added src/pyxdf/cli/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pyxdf/test/test_data.py → test/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pyxdf import load_xdf

# requires git clone https://github.com/xdf-modules/example-files.git
# into the root xdf-python folder
# into the root pyxdf folder
path = Path("example-files")
extensions = ["*.xdf", "*.xdfz", "*.xdf.gz"]
files = []
Expand Down
File renamed without changes.

0 comments on commit b718033

Please sign in to comment.