Skip to content

Commit 1f648f4

Browse files
authored
Switch to pyproject.toml from setup.py (#73)
* Switch to pyproject.toml from setup.py Fixes #66
1 parent 57ef9fe commit 1f648f4

File tree

6 files changed

+56
-51
lines changed

6 files changed

+56
-51
lines changed

.github/workflows/ci.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install Linting Tools
1818
run: |
1919
python -m pip install --upgrade pip
20-
pip install --user pylint==3.1.0 pytest ruff
20+
pip install --user pylint==3.1.0 pytest ruff validate-pyproject[all]
2121
2222
- name: Install Partition Manager
2323
run: |
@@ -35,6 +35,10 @@ jobs:
3535
run: |
3636
python -m ruff --output-format=github
3737
38+
- name: Checking pyproject
39+
run: |
40+
validate-pyproject pyproject.toml
41+
3842
test:
3943
runs-on: ubuntu-latest
4044

.github/workflows/release.yaml

+7-22
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@ on:
1010
push:
1111
tags:
1212
- "v*"
13+
workflow_dispatch:
1314

1415
jobs:
1516
release:
1617
name: release
1718
runs-on: ubuntu-latest
1819

1920
steps:
20-
- name: Setup Go
21-
uses: actions/setup-go@v2
22-
with:
23-
go-version: 1.17
24-
2521
- name: Setup python
2622
uses: actions/setup-python@v2
2723
with:
@@ -31,9 +27,8 @@ jobs:
3127
- name: Install packages
3228
run: |
3329
sudo apt-get update
34-
sudo apt-get upgrade -y
35-
sudo apt-get install -y build-essential python-setuptools python3-pip
36-
pip3 install setuptools
30+
sudo apt-get install -y build-essential python3-pip
31+
pip3 install build
3732
3833
- name: Checkout
3934
uses: actions/checkout@v2
@@ -44,26 +39,16 @@ jobs:
4439
id: get_version
4540
uses: battila7/get-version-action@v2
4641

47-
- name: Install nFPM
48-
run: |
49-
go install github.com/goreleaser/nfpm/v2/cmd/[email protected]
50-
5142
- name: Build partition-manager
5243
run: |
53-
mkdir install
54-
python3 setup.py install --root "install/" --prefix "/usr/local" --install-lib "/usr/lib/python3/dist-packages"
55-
56-
- name: Build deb
57-
run: |
58-
SEMVER=${{ steps.get_version.outputs.version }}
59-
mkdir nfpm-pkg
60-
nfpm package -p deb --target "nfpm-pkg/"
44+
python3 -m build
6145
6246
- name: "Publish release"
63-
uses: "marvinpinto/action-automatic-releases@d68defdd11f9dcc7f52f35c1b7c236ee7513bcc1"
47+
uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0"
6448
with:
6549
repo_token: "${{ secrets.GITHUB_TOKEN }}"
6650
automatic_release_tag: "${{ steps.get_version.outputs.version }}"
6751
title: "partition-manager ${{ steps.get_version.outputs.version }}"
6852
files: |
69-
nfpm-pkg/*.deb
53+
dist/*.whl
54+
dist/*.tar.gz

.pre-commit-config.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ repos:
2626
- pyyaml
2727
- pytest
2828
- setuptools
29-
29+
- repo: https://github.com/abravalheri/validate-pyproject
30+
rev: v0.16
31+
hooks:
32+
- id: validate-pyproject
3033
- repo: local
3134
hooks:
3235
- id: pytest

pyproject.toml

+36
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "mariadb-sequential-partition-manager"
7+
maintainers = [
8+
{name = "J.C. Jones", email = "[email protected]"},
9+
]
10+
version = "0.4.0"
11+
description = "Manage DB partitions based on sequential IDs"
12+
license = {file = "LICENSE.txt"}
13+
classifiers = [
14+
"Development Status :: 4 - Beta",
15+
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
16+
"Programming Language :: Python :: 3",
17+
]
18+
keywords = ["database", "mariadb"]
19+
dependencies = [
20+
"pyyaml"
21+
]
22+
requires-python = ">=3.8"
23+
readme = "README.md"
24+
25+
[tool.hatch.build.targets.wheel]
26+
packages = ["partitionmanager"]
27+
28+
[project.optional-dependencies]
29+
pymysql = ["PyMySQL >= 1.0.2"]
30+
31+
[project.urls]
32+
Repository = "http://github.com/letsencrypt/mariadb-sequential-partition-manager"
33+
34+
[project.scripts]
35+
partition-manager = "partitionmanager.cli:main"
36+
137
[tool.ruff]
238
line-length = 99 # default is 88
339
target-version = "py38"

setup.py

-27
This file was deleted.

wheel2deb.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mariadb-sequential-partition-manager:
2+
maintainer_name: "Let's Encrypt"
3+
maintainer_email: "[email protected]"
4+
extended_desc: "Manage DB partitions based on sequential IDs"

0 commit comments

Comments
 (0)