Skip to content

Commit 0e8c82d

Browse files
authored
Merge pull request #58 from dimagi/gh/upgrade-build-tools
Upgrade build tools (pyproject.toml, pyverno, uv)
2 parents 654b8fa + 30958fb commit 0e8c82d

File tree

8 files changed

+694
-125
lines changed

8 files changed

+694
-125
lines changed

.github/workflows/pypi.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Publish Python distribution to PyPI and TestPyPI
2+
# Source:
3+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
4+
on:
5+
push:
6+
branches:
7+
- master
8+
tags:
9+
- 'v*'
10+
workflow_dispatch:
11+
jobs:
12+
build:
13+
name: Build distribution package
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: astral-sh/setup-uv@v6
18+
with:
19+
version: '>=0.7'
20+
- name: Check for version match in git tag and couchdb_cluster_admin.__version__
21+
if: startsWith(github.ref, 'refs/tags/v')
22+
run: uvx pyverno check couchdb_cluster_admin/__init__.py "${{ github.ref }}"
23+
- name: Add untagged version suffix
24+
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
25+
run: uvx pyverno update couchdb_cluster_admin/__init__.py
26+
- name: Build a binary wheel and a source tarball
27+
run: uv build
28+
- name: Store the distribution packages
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: python-package-distributions
32+
path: dist/
33+
pypi-publish:
34+
name: Upload release to PyPI
35+
needs: [build]
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: pypi
39+
url: https://pypi.org/p/couchdb-cluster-admin
40+
permissions:
41+
id-token: write
42+
steps:
43+
- name: Download all the dists
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
48+
- name: Publish package distributions to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
pypi-test-publish:
51+
name: Upload release to test PyPI
52+
needs: [build]
53+
runs-on: ubuntu-latest
54+
environment:
55+
name: testpypi
56+
url: https://test.pypi.org/p/couchdb-cluster-admin
57+
permissions:
58+
id-token: write
59+
steps:
60+
- name: Download all the dists
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: python-package-distributions
64+
path: dist/
65+
- name: Publish package distributions to PyPI
66+
uses: pypa/gh-action-pypi-publish@release/v1
67+
with:
68+
repository-url: https://test.pypi.org/legacy/

.github/workflows/tests.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,20 @@ on:
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615
strategy:
1716
fail-fast: false
1817
matrix:
1918
python-version: ["3.10"] # dimagi-memoized does not yet support later versions of python
2019

2120
steps:
22-
- uses: actions/checkout@v2
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
21+
- uses: actions/checkout@v4
22+
- uses: astral-sh/setup-uv@v6
2523
with:
26-
python-version: ${{ matrix.python-version }}
24+
version: '>=0.7'
25+
python-version: ${{ matrix.python }}
2726
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
python -m pip install -r requirements.txt
31-
python -m pip install -r test-requirements.txt
27+
run: uv sync --locked
3228
- name: Make data directory if needed
3329
run: |
3430
mkdir -p /home/runner/work/couchdb-cluster-admin/couchdb-cluster-admin/data
@@ -37,5 +33,4 @@ jobs:
3733
docker build -t couchdb-cluster - < docker-couchdb-cluster/Dockerfile
3834
docker run -d --name couchdb-cluster -v $(pwd)/data:/usr/src/couchdb/dev/lib/ -p 15984:15984 -p 15986:15986 -p 25984:25984 -p 25986:25986 -p 35984:35984 -p 35986:35986 -p 45984:45984 -p 45986:45986 -t couchdb-cluster --with-admin-party-please -n 4
3935
- name: Run tests
40-
run: |
41-
pytest tests.py
36+
run: .venv/bin/pytest tests.py

pyproject.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[project]
2+
name = "couchdb-cluster-admin"
3+
description = "Utility for managing multi-node couchdb clusters"
4+
authors = [{name = "Dimagi", email = "[email protected]"}]
5+
license = {file = "LICENSE"}
6+
readme = {file = "README.md", content-type = "text/markdown"}
7+
dynamic = ["version"]
8+
requires-python = ">= 3.10"
9+
classifiers = [
10+
'Development Status :: 3 - Alpha',
11+
'Environment :: Web Environment',
12+
'Intended Audience :: Developers',
13+
'License :: OSI Approved :: BSD License',
14+
'Operating System :: OS Independent',
15+
"Programming Language :: Python",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.10",
18+
'Topic :: Software Development :: Libraries :: Python Modules',
19+
]
20+
dependencies = [
21+
'argparse>=1.4',
22+
'dimagi-memoized',
23+
'gevent',
24+
'jsonobject',
25+
'PyYAML',
26+
'requests',
27+
]
28+
29+
[dependency-groups]
30+
dev = [
31+
'mock',
32+
'pytest',
33+
]
34+
35+
[project.urls]
36+
Home = "https://github.com/dimagi/couchdb-cluster-admin"
37+
38+
[build-system]
39+
requires = [
40+
"setuptools>=75",
41+
]
42+
build-backend = "setuptools.build_meta"
43+
44+
[tool.setuptools]
45+
packages = ["couchdb_cluster_admin"]
46+
47+
[tool.setuptools.dynamic]
48+
version = {attr = "couchdb_cluster_admin.__version__"}
49+
50+
[tool.distutils.bdist_wheel]
51+
universal = true
52+
53+
[tool.flake8]
54+
exclude = "./build"

requirements.txt

Lines changed: 0 additions & 28 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 8 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 76 deletions
This file was deleted.

test-requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)