diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db39929..3dc298d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,6 @@ name: json-store on: [push, pull_request] -env: - pip-cache-key: 2023.02.03 - jobs: lint: runs-on: ubuntu-latest @@ -11,13 +8,8 @@ jobs: 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 @@ -27,14 +19,8 @@ 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 @@ -42,25 +28,11 @@ jobs: 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 @@ -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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8d8ecfa --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,51 @@ +[project] +dynamic = ["version"] +name = "json-store" +requires-python = ">=3.8" +dependencies = [] + +authors = [{name = "jeremy avnet", email = "json-store@theory.org"}] +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" +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 3c6e79c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal=1 diff --git a/setup.py b/setup.py deleted file mode 100644 index 140f10b..0000000 --- a/setup.py +++ /dev/null @@ -1,40 +0,0 @@ -# encoding: utf-8 -import setuptools - -import json_store - -setuptools.setup( - name="json-store", - version=json_store.__version__, - packages=["json_store"], - entry_points={ - "console_scripts": [ - "shelve2json=json_store.shelve2json:main", - ], - }, - description="A shelve-like store using JSON serialization.", - long_description=( - "JSON store is a simple replacement for shelve. It writes" - " JSON serialized files, accepts unicode keys, and tracks" - " whether the store has been changed since last sync." - " It has no dependencies." - ), - author="jeremy avnet", - author_email="json-store@theory.org", - license="MIT License", - url="https://github.com/brainsik/json-store", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "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", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - ], -) diff --git a/json_store/__init__.py b/src/json_store/__init__.py similarity index 100% rename from json_store/__init__.py rename to src/json_store/__init__.py diff --git a/json_store/json_store.py b/src/json_store/json_store.py similarity index 100% rename from json_store/json_store.py rename to src/json_store/json_store.py diff --git a/json_store/shelve2json.py b/src/json_store/shelve2json.py similarity index 100% rename from json_store/shelve2json.py rename to src/json_store/shelve2json.py