Store project metadata in pyproject.toml (PEP 621) (#1952)

This commit is contained in:
Rob Hudson 2023-07-09 03:34:25 -07:00 committed by Selwin Ong
parent efd4bd82d7
commit 0935f47213
13 changed files with 109 additions and 134 deletions

View File

@ -33,13 +33,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
pip install redis==${{ matrix.redis-py-version }}
pip install -r requirements.txt -r dev-requirements.txt
pip install -e .
- name: Test with pytest
run: |
RUN_SLOW_TESTS_TOO=1 pytest --durations=5
RUN_SLOW_TESTS_TOO=1 hatch run test:pytest --durations=5
dependency-build:
name: Check development branches of dependencies
@ -68,13 +67,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/redis/redis-py
pip install git+https://github.com/pallets/click
pip install -r dev-requirements.txt
pip install -e .
pip install hatch
- name: Test with pytest
run: RUN_SLOW_TESTS_TOO=1 pytest --durations=5 > log.txt 2>&1
run: RUN_SLOW_TESTS_TOO=1 hatch run test:pytest --durations=5 > log.txt 2>&1
- uses: actions/upload-artifact@v3
with:

View File

@ -8,7 +8,7 @@ on:
permissions:
contents: read write # to fetch code (actions/checkout)
contents: write # to fetch code (actions/checkout)
packages: write
jobs:

View File

@ -25,7 +25,7 @@ jobs:
uses: addnab/docker-run-action@v3
with:
image: rqtest-image:latest
run: stunnel & redis-server & RUN_SSL_TESTS=1 tox run -e ssl
run: stunnel & redis-server & RUN_SSL_TESTS=1 hatch run tox run -e ssl
test:
name: Python${{ matrix.python-version }}/Redis${{ matrix.redis-version }}/redis-py${{ matrix.redis-py-version }}
@ -53,13 +53,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
pip install redis==${{ matrix.redis-py-version }}
pip install -r requirements.txt -r dev-requirements.txt
pip install -e .
- name: Test with pytest
run: |
RUN_SLOW_TESTS_TOO=1 pytest --cov=rq --cov-config=.coveragerc --cov-report=xml --durations=5
RUN_SLOW_TESTS_TOO=1 hatch run test:cov --durations=5
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

View File

@ -7,3 +7,7 @@ repos:
rev: "v0.0.267"
hooks:
- id: ruff
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 0.12.0
hooks:
- id: pyproject-fmt

View File

@ -1,4 +0,0 @@
include LICENSE
include *.toml
include requirements.txt
recursive-exclude tests *

View File

@ -1,6 +0,0 @@
packaging==21.3
coverage==6.2
psutil
pytest
pytest-cov
sentry-sdk

View File

@ -1,6 +0,0 @@
packaging
coverage
psutil
pytest
pytest-cov
sentry-sdk

View File

@ -1,6 +1,97 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"hatchling",
]
[project]
name = "rq"
description = "RQ is a simple, lightweight, library for creating background jobs, and processing them."
readme = "README.md"
license = "BSD-2-Clause"
maintainers = [
{name = "Selwin Ong"},
]
authors = [
{ name = "Vincent Driessen", email = "vincent@3rdcloud.com" },
]
requires-python = ">=3.7"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: BSD License",
"Operating System :: MacOS",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Internet",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Distributed Computing",
"Topic :: System :: Monitoring",
"Topic :: System :: Systems Administration",
]
dynamic = [
"version",
]
dependencies = [
"click>=5",
"redis>=3.5",
]
[project.urls]
changelog = "https://github.com/rq/rq/blob/master/CHANGES.md"
documentation = "https://python-rq.org/docs/"
homepage = "https://python-rq.org/"
repository = "https://github.com/rq/rq/"
[project.scripts]
rq = "rq.cli:main"
rqinfo = "rq.cli:info" # TODO [v2]: Remove
rqworker = "rq.cli:worker" # TODO [v2]: Remove
[tool.hatch.version]
path = "rq/version.py"
[tool.hatch.build.targets.sdist]
include = [
"/docs",
"/rq",
"/tests",
"CHANGES.md",
"LICENSE",
"pyproject.toml",
"README.md",
"requirements.txt",
"tox.ini",
]
[tool.hatch.envs.test]
dependencies = [
"black",
"coverage",
"packaging",
"psutil",
"pytest",
"pytest-cov",
"ruff",
"sentry-sdk",
"tox",
]
[tool.hatch.envs.test.scripts]
cov = "pytest --cov=rq --cov-config=.coveragerc --cov-report=xml {args:tests}"
[tool.black]
line-length = 120
target-version = ['py38']
target-version = ["py38"]
skip-string-normalization = true
[tool.ruff]
@ -13,7 +104,7 @@ select = [
"W", # pycodestyle warnings
]
line-length = 120 # To match black.
target-version = 'py38'
target-version = "py38"
[tool.ruff.isort]
known-first-party = ["rq"]

View File

@ -1,2 +0,0 @@
redis>=4.0.0
click>=5.0.0

View File

@ -1,6 +0,0 @@
[bdist_rpm]
requires = redis >= 3.0.0
click >= 3.0
[wheel]
universal = 1

View File

@ -1,88 +0,0 @@
"""
rq is a simple, lightweight, library for creating background jobs, and
processing them.
"""
import os
from setuptools import find_packages, setup
def get_version():
basedir = os.path.dirname(__file__)
try:
with open(os.path.join(basedir, 'rq/version.py')) as f:
locals = {}
exec(f.read(), locals)
return locals['VERSION']
except FileNotFoundError:
raise RuntimeError('No version info found.')
def get_requirements():
basedir = os.path.dirname(__file__)
try:
with open(os.path.join(basedir, 'requirements.txt')) as f:
return f.readlines()
except FileNotFoundError:
raise RuntimeError('No requirements info found.')
setup(
name='rq',
version=get_version(),
url='https://github.com/nvie/rq/',
license='BSD',
author='Vincent Driessen',
author_email='vincent@3rdcloud.com',
description='RQ is a simple, lightweight, library for creating background jobs, and processing them.',
long_description=__doc__,
packages=find_packages(exclude=['tests', 'tests.*']),
package_data={"rq": ["py.typed"]},
include_package_data=True,
zip_safe=False,
platforms='any',
install_requires=get_requirements(),
python_requires='>=3.6',
entry_points={
'console_scripts': [
'rq = rq.cli:main',
# NOTE: rqworker/rqinfo are kept for backward-compatibility,
# remove eventually (TODO)
'rqinfo = rq.cli:info',
'rqworker = rq.cli:worker',
],
},
classifiers=[
# As from http://pypi.python.org/pypi?%3Aaction=list_classifiers
# 'Development Status :: 1 - Planning',
# 'Development Status :: 2 - Pre-Alpha',
# 'Development Status :: 3 - Alpha',
# 'Development Status :: 4 - Beta',
'Development Status :: 5 - Production/Stable',
# 'Development Status :: 6 - Mature',
# 'Development Status :: 7 - Inactive',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Operating System :: MacOS',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
'Topic :: Scientific/Engineering',
'Topic :: System :: Distributed Computing',
'Topic :: System :: Systems Administration',
'Topic :: System :: Monitoring',
],
)

View File

@ -41,11 +41,8 @@ WORKDIR /tmp/rq
RUN set -e && \
python3 -m pip install --upgrade pip && \
python3 -m pip install --no-cache-dir tox && \
pip3 install -r /tmp/rq/requirements.txt -r /tmp/rq/dev-requirements.txt && \
python3 /tmp/rq/setup.py build && \
python3 /tmp/rq/setup.py install
python3 -m pip install --no-cache-dir hatch tox
CMD stunnel \
& redis-server \
& RUN_SLOW_TESTS_TOO=1 RUN_SSL_TESTS=1 tox
& RUN_SLOW_TESTS_TOO=1 RUN_SSL_TESTS=1 hatch run tox

View File

@ -4,11 +4,11 @@ envlist=py36,py37,py38,py39,py310
[testenv]
commands=pytest --cov rq --cov-config=.coveragerc --durations=5 {posargs}
deps=
codecov
psutil
pytest
pytest-cov
sentry-sdk
codecov
psutil
passenv=
RUN_SSL_TESTS