Skip to content

Commit 9316623

Browse files
committed
New build system.
1 parent e2b91ff commit 9316623

11 files changed

Lines changed: 86 additions & 114 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
15+
python-version: [3.8, "3.10", "3.12", "3.14"]
1616
steps:
1717
- uses: actions/checkout@v2
1818
- uses: actions/setup-python@v2
1919
with:
2020
python-version: ${{ matrix.python-version }}
21-
- name: pip deps
22-
run: pip install -r requirements.txt
23-
- name: pypa is a joke
24-
run: pip install packaging
21+
- name: deps
22+
run: pip install .
2523
- name: runtests
2624
run: python runtests.py

.github/workflows/wheels.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build wheels
2+
on:
3+
push:
4+
tags:
5+
- "[0-9]+.[0-9]+.[0-9]+"
6+
- "[0-9]+.[0-9]+.[0-9]+-**"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.12"
17+
18+
- name: Install build tools
19+
run: |
20+
python -m pip install -U pip
21+
pip install setuptools build
22+
23+
- name: Build sdist and wheel
24+
run: |
25+
python -m build .
26+
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: package
30+
path: dist/huey*
31+
32+
publish:
33+
needs: [build]
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/download-artifact@v4
37+
with:
38+
name: package
39+
path: dist
40+
merge-multiple: true
41+
42+
- uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
user: __token__
45+
password: ${{ secrets.PYPI_API_TOKEN }}

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ This document describes changes to the APIs.
44

55
### master
66

7-
[View changes](https://github.com/coleifer/walrus/compare/0.9.2...HEAD)
7+
[View changes](https://github.com/coleifer/walrus/compare/0.9.3...HEAD)
8+
9+
### 0.9.3
10+
11+
Update build system to use pyproject.toml and github actions.
812

913
### 0.9.2
1014

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include README.md
2-
include stopwords.txt
3-
recursive-include scripts *
2+
include walrus/stopwords.txt
3+
include walrus/scripts/*.lua

pyproject.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[build-system]
2+
requires = ["setuptools>=60", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "walrus"
7+
dynamic = ["version"]
8+
description = "a set of utilities for working with redis"
9+
dependencies = ["redis"]
10+
readme = "README.md"
11+
license = { file = "LICENSE" }
12+
authors = [
13+
{ name = "Charles Leifer", email = "coleifer@gmail.com" }
14+
]
15+
classifiers = [
16+
"Programming Language :: Python :: 2",
17+
"Programming Language :: Python :: 3",
18+
"Topic :: Software Development :: Libraries :: Python Modules",
19+
]
20+
21+
[project.urls]
22+
Repository = "https://github.com/coleifer/walrus"
23+
Documentation = "https://walrus.readthedocs.io/"
24+
Changelog = "https://github.com/coleifer/walrus/blob/master/CHANGELOG.md"
25+
26+
[tool.setuptools.dynamic]
27+
version = { attr = "walrus.__version__" }

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,7 @@
1-
import os
2-
31
from setuptools import find_packages
42
from setuptools import setup
53

6-
7-
cur_dir = os.path.dirname(__file__)
8-
readme = os.path.join(cur_dir, 'README.md')
9-
if os.path.exists(readme):
10-
with open(readme) as fh:
11-
long_description = fh.read()
12-
else:
13-
long_description = ''
14-
15-
setup(
16-
name='walrus',
17-
version=__import__('walrus').__version__,
18-
description='walrus',
19-
long_description=long_description,
20-
author='Charles Leifer',
21-
author_email='coleifer@gmail.com',
22-
url='http://github.com/coleifer/walrus/',
23-
install_requires=['redis>=3.0.0'],
24-
packages=find_packages(),
25-
package_data={
26-
'walrus': [
27-
'scripts/*',
28-
'stopwords.txt',
29-
],
30-
},
31-
classifiers=[
32-
'Development Status :: 5 - Production/Stable',
33-
'Intended Audience :: Developers',
34-
'License :: OSI Approved :: MIT License',
35-
'Operating System :: OS Independent',
36-
'Programming Language :: Python',
37-
'Programming Language :: Python :: 2',
38-
'Programming Language :: Python :: 2.7',
39-
'Programming Language :: Python :: 3',
40-
'Programming Language :: Python :: 3.4',
41-
'Programming Language :: Python :: 3.5',
42-
'Programming Language :: Python :: 3.6',
43-
'Programming Language :: Python :: 3.7',
44-
'Programming Language :: Python :: 3.8',
45-
'Programming Language :: Python :: 3.9',
46-
'Programming Language :: Python :: 3.10',
47-
'Programming Language :: Python :: 3.11',
48-
'Programming Language :: Python :: 3.12',
49-
'Programming Language :: Python :: 3.13',
50-
'Programming Language :: Python :: 3.14',
51-
],
52-
project_urls={
53-
'Documentation': 'https://walrus.readthedocs.io/',
54-
'Source': 'https://github.com/coleifer/walrus'},
55-
test_suite='walrus.tests',
56-
)
4+
setup(name='walrus',
5+
install_requires=['redis>=3.0.0'],
6+
packages=find_packages(),
7+
package_data={'walrus': ['scripts/*', 'stopwords.txt']})

walrus/scripts/__init__.py

Whitespace-only changes.

walrus/tests/base.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import os
22
import unittest
3-
try:
4-
from packaging.version import Version
5-
except ImportError:
6-
try:
7-
from distutils.version import StrictVersion as Version
8-
except ImportError:
9-
from setuptools._distutils.version import StrictVersion as Version
103

114
from walrus import Database
125

@@ -20,33 +13,6 @@
2013
REDIS_VERSION = None
2114

2215

23-
def requires_version(min_version):
24-
def decorator(fn):
25-
global REDIS_VERSION
26-
if REDIS_VERSION is None:
27-
REDIS_VERSION = db.info()['redis_version']
28-
too_old = Version(REDIS_VERSION) < Version(min_version)
29-
return unittest.skipIf(too_old,
30-
'redis too old, requires %s' % min_version)(fn)
31-
return decorator
32-
33-
34-
def stream_test(fn):
35-
test_stream = os.environ.get('TEST_STREAM')
36-
if not test_stream:
37-
return requires_version('4.9.101')(fn)
38-
else:
39-
return unittest.skipIf(not test_stream, 'skipping stream tests')(fn)
40-
41-
42-
def zpop_test(fn):
43-
test_zpop = os.environ.get('TEST_ZPOP')
44-
if not test_zpop:
45-
return requires_version('4.9.101')(fn)
46-
else:
47-
return unittest.skipIf(not test_zpop, 'skipping zpop* tests')(fn)
48-
49-
5016
class WalrusTestCase(unittest.TestCase):
5117
def setUp(self):
5218
db.flushdb()

walrus/tests/containers.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from walrus.containers import _normalize_stream_keys
55
from walrus.tests.base import WalrusTestCase
66
from walrus.tests.base import db
7-
from walrus.tests.base import stream_test
8-
from walrus.tests.base import zpop_test
97
from walrus.utils import decode
108
from walrus.utils import decode_dict
119
from walrus.utils import encode
@@ -211,7 +209,6 @@ def test_basic_apis(self):
211209
self.assertEqual(self.zs.popmax_compat(), [])
212210
self.assertEqual(len(self.zs), 0)
213211

214-
@zpop_test
215212
def test_popmin_popmax(self):
216213
for i in range(10):
217214
self.zs.add({'i%s' % i: i})
@@ -470,7 +467,6 @@ def _create_test_data(self):
470467
db.xadd('sb', {'k': 'b2'}, b'4'),
471468
db.xadd('sb', {'k': 'b3'}, b'5'))
472469

473-
@stream_test
474470
def test_stream_group_info(self):
475471
sa = db.Stream('sa')
476472
ra1 = sa.add({'k': 'a1'})
@@ -522,7 +518,6 @@ def test_stream_group_info(self):
522518
self.assertEqual(len(sa.groups_info()), 1)
523519
self.assertEqual(len(sb.groups_info()), 0)
524520

525-
@stream_test
526521
def test_consumer_group_create(self):
527522
cg = db.consumer_group('cg', ['sa'])
528523
self.assertEqual(cg.create(), {'sa': True})
@@ -535,7 +530,6 @@ def test_consumer_group_create(self):
535530
cg = db.consumer_group('cg', ['sa', 'sb'])
536531
self.assertEqual(cg.create(), {'sa': False, 'sb': True})
537532

538-
@stream_test
539533
def test_consumer_group_stream_creation(self):
540534
cg = db.consumer_group('cg1', ['stream-a', 'stream-b'])
541535
self.assertFalse(db.exists('stream-a'))
@@ -575,7 +569,6 @@ def test_consumer_group_stream_creation(self):
575569
cg = db.consumer_group('cg-%s' % key, keys=[key])
576570
self.assertRaises(ValueError, cg.create)
577571

578-
@stream_test
579572
def test_consumer_group_streams(self):
580573
ra1, rb1, ra2, rb2, rb3 = self._create_test_data()
581574
cg = db.consumer_group('g1', ['sa', 'sb'])
@@ -611,7 +604,6 @@ def assertMessages(resp, expected):
611604
assertMessages(list(cg.sa), [ra2])
612605
assertMessages(list(cg.sb), [rb2])
613606

614-
@stream_test
615607
def test_consumer_group_container(self):
616608
ra1, rb1, ra2, rb2, rb3 = self._create_test_data()
617609
cg1 = db.consumer_group('g1', {'sa': '1', 'sb': '0'})
@@ -639,7 +631,6 @@ def test_consumer_group_container(self):
639631
self.assertEqual(cg1.destroy(), {'sa': 1, 'sb': 1})
640632
self.assertEqual(cg2.destroy(), {'sb': 1})
641633

642-
@stream_test
643634
def test_consumer_group_consumers(self):
644635
ra1, rb1, ra2, rb2, rb3 = self._create_test_data()
645636
cg11 = db.consumer_group('g1', {'sa': '0', 'sb': '0'}, consumer='cg11')
@@ -666,7 +657,6 @@ def test_consumer_group_consumers(self):
666657
self.assertEqual(pb2['message_id'], rb2)
667658
self.assertEqual(pb2['consumer'], b'cg12')
668659

669-
@stream_test
670660
def test_read_api(self):
671661
sa = db.Stream('a')
672662
sb = db.Stream('b')
@@ -754,7 +744,6 @@ def assertData(ret, idxs, is_multi=False):
754744
count=1, block=1)
755745
self.assertEqual(res, [])
756746

757-
@stream_test
758747
def test_set_id_stream(self):
759748
stream = db.Stream('my-stream')
760749
stream.add({'k': 'v1'}, id='3')
@@ -765,7 +754,6 @@ def test_set_id_stream(self):
765754
(b'3-0', {b'k': b'v1'}),
766755
(b'6-0', {b'k': b'v3'})])
767756

768-
@stream_test
769757
def test_basic_apis(self):
770758
stream = db.Stream('my-stream')
771759

0 commit comments

Comments
 (0)