diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index b1807f78..241369bc 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -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: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7a9dda60..b4473767 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,7 +8,7 @@ on: permissions: - contents: read write # to fetch code (actions/checkout) + contents: write # to fetch code (actions/checkout) packages: write jobs: diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 1de525fa..8a3e532a 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d45026be..5bd0e359 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index cdd4ea5a..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -include LICENSE -include *.toml -include requirements.txt -recursive-exclude tests * diff --git a/dev-requirements-36.txt b/dev-requirements-36.txt deleted file mode 100644 index 7eae078a..00000000 --- a/dev-requirements-36.txt +++ /dev/null @@ -1,6 +0,0 @@ -packaging==21.3 -coverage==6.2 -psutil -pytest -pytest-cov -sentry-sdk diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index cbe9464c..00000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -packaging -coverage -psutil -pytest -pytest-cov -sentry-sdk diff --git a/pyproject.toml b/pyproject.toml index ebcd7e8d..7bb68c0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 3a14dffe..00000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -redis>=4.0.0 -click>=5.0.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index f873f9b9..00000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[bdist_rpm] -requires = redis >= 3.0.0 - click >= 3.0 - -[wheel] -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100644 index ceaf034d..00000000 --- a/setup.py +++ /dev/null @@ -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', - ], -) diff --git a/tests/Dockerfile b/tests/Dockerfile index d131b7e8..77408855 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -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 diff --git a/tox.ini b/tox.ini index a180d777..e89dcf18 100644 --- a/tox.ini +++ b/tox.ini @@ -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