Skip to content

Commit

Permalink
Migrate to uv and modernize things
Browse files Browse the repository at this point in the history
  • Loading branch information
brainsik committed Sep 11, 2024
1 parent e4a8511 commit 34977bb
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 99 deletions.
74 changes: 17 additions & 57 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
name: json-store
on: [push, pull_request]

env:
pip-cache-key: 2023.02.03

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.job }}-${{ env.pip-cache-key }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install uv
uses: astral-sh/setup-uv@v2

- name: pre-commit cache
uses: actions/cache@v4
Expand All @@ -27,40 +19,20 @@ jobs:
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install ${{ github.job }} dependencies
run: pip install --disable-pip-version-check pre-commit

- name: Run pre-commit tests
run: pre-commit run -a
run: uv tool run pre-commit run -a

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.job }}-${{ env.pip-cache-key }}
restore-keys: |
${{ runner.os }}-pip-
- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Upgrade pip and setuptools
run: python -m pip install --upgrade pip setuptools

- name: Install ${{ github.job }} dependencies
run: pip --disable-pip-version-check install wheel build
- name: Install uv
uses: astral-sh/setup-uv@v2

- name: Build package
run: python -m build
run: uv build

- name: Store build artifacts
uses: actions/upload-artifact@v4
Expand All @@ -72,44 +44,32 @@ jobs:
needs: [lint, build]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.10"]
include:
- os: windows-latest
python-version: ["3.8", "3.12"]
- os: macos-latest
python-version: ["3.8", "3.12"]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.job }}-${{ env.pip-cache-key }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install uv
uses: astral-sh/setup-uv@v2

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

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Install ${{ github.job }} dependencies
run: |
pip install --disable-pip-version-check pytest
- name: Install json-store package
shell: bash # so this works on both Linux and Windows
run: |
pip install --disable-pip-version-check dist/json_store-*.whl
uv sync --dev
- name: Test with pytest
run: pytest
run: uv run pytest

- name: Test shelve2json
if: ${{ matrix.os != 'windows-latest' }} # shelve.open has an internal traceback on Windows
run: sh tests/test_shelve2json.sh
run: uv run sh tests/test_shelve2json.sh
51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[project]
dynamic = ["version"]
name = "json-store"
requires-python = ">=3.8"
dependencies = []

authors = [{name = "jeremy avnet", email = "[email protected]"}]
description = "A shelve-like store using JSON serialization."
readme = "README.md"
license = {file = "LICENSE.txt"}
keywords = ["json", "shelve"]

classifiers = [
"Development Status :: 5 - Production/Stable",

"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",

"License :: OSI Approved :: MIT License",

"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]

[project.urls]
Homepage = "https://github.com/brainsik/json-store"
Repository = "https://github.com/brainsik/json-store.git"
Issues = "https://github.com/brainsik/json-store/issues"
Changelog = "https://github.com/brainsik/json-store/releases"

[project.scripts]
shelve2json = "json_store.shelve2json:main"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "src/json_store/__init__.py"

[tool.uv]
dev-dependencies = [
"pytest >=8.3"
]
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

40 changes: 0 additions & 40 deletions setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 34977bb

Please sign in to comment.