Skip to content

Commit

Permalink
tooling: use uv and set up publishing (#9)
Browse files Browse the repository at this point in the history
* refactor: migrate from rye to uv package manager and update tooling

The commit message reflects a significant change in the project's development
tooling, switching from rye to uv for package management, and replacing
multiple linting tools (pylint, flake8) with ruff for better performance
and maintainability.

* ci: add GitHub Actions workflows for continuous integration and deployment

* chore: remove tox configuration as it's no longer used for test automation
  • Loading branch information
rorybyrne authored Jan 14, 2025
1 parent 135e012 commit d8b0507
Show file tree
Hide file tree
Showing 8 changed files with 834 additions and 184 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# publish.yml

name: "Publish"

on:
release:
types: ["published"]

jobs:
run:
name: "Build and publish release"
runs-on: ubuntu-latest
permissions:
id-token: write # needed for Trusted Publishing on PyPi

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: uv.lock

- name: Set up Python
run: uv python install 3.12

- name: Build
run: uv build

- name: Publish
run: uv publish
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install just
uses: taiki-e/install-action@just

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Lint
run: just lint

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Install just
uses: taiki-e/install-action@just

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Test
run: just test
26 changes: 11 additions & 15 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
default:
@just --list

tox:
@tox

test:
@pytest -s
@uv run pytest

test-s:
@uv run pytest -s -o log_cli=True -o log_cli_level=DEBUG

pylint:
rye run pylint labfile
ruff-fix:
uv run ruff format labfile

flake8:
rye run flake8 labfile
ruff-check:
uv run ruff check labfile

pyright:
rye run pyright labfile
uv run pyright labfile

lint:
just pylint
just flake8
just ruff-check
just pyright


lint-file file:
- pylint {{file}}
- flake8 {{file}}
- ruff {{file}}
- pyright {{file}}

61 changes: 38 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,54 @@
[project]
name = "labfile"
version = "0.1.0"
description = "Add your description here"
description = "A declarative file format for scientific experiments."
authors = [
{ name = "Rory Byrne", email = "[email protected]" }
]
requires-python = ">=3.8"
dependencies = [
"pydantic>=2.9.2",
"pydantic-settings>=2.6.1",
"lark>=1.2.2",
"pydantic>=2.10.3",
]
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering",
"Intended Audience :: Developers",
'Intended Audience :: Information Technology',
"Typing :: Typed",
]
license = "MIT"
readme = "README.md"
requires-python = ">= 3.8"
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/flywhl/labfile"
Repository = "https://github.com/flywhl/labfile"
Documentation = "https://github.com/flywhl/labfile#readme"
"Bug Tracker" = "https://github.com/flywhl/labfile/issues"

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

[tool.rye]
managed = true
[tool.hatch.version]
source = "vcs"

[tool.uv]
dev-dependencies = [
"pytest>=8.3.3",
"black>=24.10.0",
"pylint>=3.3.1",
"isort>=5.13.2",
"flake8>=7.1.1",
"pyright>=1.1.388",
"flake8-pyproject>=1.2.3",
"tox>=4.23.2",
"coverage>=7.6.4",
"pre-commit>=4.0.1",
"coverage>=7.6.1",
"pre-commit>=3.5.0",
"pyright>=1.1.391",
"pytest>=8.3.4",
"ruff>=0.9.1",
]

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["labfile"]
100 changes: 0 additions & 100 deletions requirements-dev.lock

This file was deleted.

28 changes: 0 additions & 28 deletions requirements.lock

This file was deleted.

18 changes: 0 additions & 18 deletions tox.ini

This file was deleted.

Loading

0 comments on commit d8b0507

Please sign in to comment.