Skip to content

Commit

Permalink
switch to pyproject (#341)
Browse files Browse the repository at this point in the history
* switch to pyproject

* fix compatibility between requirements files

* add pointless setup.py, fix coverage
  • Loading branch information
samuelcolvin authored Aug 30, 2022
1 parent 593a61b commit dbb16b5
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 84 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
python-version: '3.10'

- run: pip install -r requirements/linting.txt -r requirements/setup.txt pre-commit
- run: pip install -r requirements/linting.txt -r requirements/pyproject.txt pre-commit

- run: pre-commit run -a

Expand All @@ -36,7 +36,7 @@ jobs:
with:
python-version: '3.10'

- run: pip install -r requirements/docs.txt -r requirements/setup.txt
- run: pip install -r requirements/docs.txt -r requirements/pyproject.txt
- run: pip install .

- run: make docs
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
with:
python-version: ${{ matrix.python }}

- run: pip install -r requirements/testing.txt -r requirements/setup.txt
- run: pip install -r requirements/testing.txt -r requirements/pyproject.txt

- run: make test

Expand All @@ -104,15 +104,16 @@ jobs:
python-version: '3.10'

- name: install
run: |
make install
pip install -U wheel twine
run: pip install -U twine build packaging

- name: set version
run: VERSION_PATH='arq/version.py' python <(curl -Ls https://git.io/JT3rm)
- name: check version
id: check-version
run: python <(curl -Ls https://gist.githubusercontent.com/samuelcolvin/4e1ad439c5489e8d6478cdee3eb952ef/raw/check_version.py)
env:
VERSION_PATH: 'arq/version.py'

- name: build
run: python setup.py sdist bdist_wheel
run: python -m build

- run: twine check dist/*

Expand All @@ -123,6 +124,7 @@ jobs:
TWINE_PASSWORD: ${{ secrets.pypi_token }}

- name: publish docs
if: '!fromJSON(steps.check-version.outputs.IS_PRERELEASE)'
run: make publish-docs
env:
NETLIFY: ${{ secrets.netlify_token }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017, 2018, 2019, 2020 Samuel Colvin and other contributors
Copyright (c) 2017 - 2022 Samuel Colvin and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ black = black arq tests

.PHONY: install
install:
pip install -U pip setuptools pre-commit
pip install -U pip pre-commit
pip install -r requirements/all.txt
pip install -e .[watch]
pre-commit install
Expand Down Expand Up @@ -51,7 +51,6 @@ clean:
rm -f .coverage.*
rm -rf build
make -C docs clean
python setup.py clean

.PHONY: docs
docs:
Expand Down
4 changes: 4 additions & 0 deletions arq/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .cli import cli

if __name__ == '__main__':
cli()
7 changes: 2 additions & 5 deletions arq/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
__all__ = ['VERSION']

# version is set automatically in CI before release,
# see https://gist.github.com/samuelcolvin/da2f521da5d2195fbfd65da3b8f58589
VERSION = '0.0.dev0'
# Version here is used for the package version via the `[tool.hatch.version]` section of `pyproject.toml`.
VERSION = '0.24.0'
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
[build-system]
requires = ['hatchling']
build-backend = 'hatchling.build'

[tool.hatch.version]
path = 'arq/version.py'

[project]
name = 'arq'
description = 'Job queues in python with asyncio and redis'
authors = [{name = 'Samuel Colvin', email = 's@muelcolvin.com'}]
license = {file = 'LICENSE'}
readme = 'README.md'
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Framework :: AsyncIO',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: Unix',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'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 :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Clustering',
'Topic :: System :: Distributed Computing',
'Topic :: System :: Monitoring',
'Topic :: System :: Systems Administration',
]
requires-python = '>=3.7'
dependencies = [
'redis[hiredis]>=4.2.0',
'click>=8.0',
'typing-extensions>=4.1.0',
]
optional-dependencies = {watch = ['watchfiles>=0.16'] }
dynamic = ['version']

[project.scripts]
arq = 'arq.cli:cli'

[project.urls]
Homepage = 'https://github.com/samuelcolvin/arq'
Documentation = 'https://arq-docs.helpmanual.io'
Funding = 'https://github.com/sponsors/samuelcolvin'
Source = 'https://github.com/samuelcolvin/arq'
Changelog = 'https://github.com/samuelcolvin/arq/releases'

[tool.pytest.ini_options]
testpaths = 'tests'
filterwarnings = ['error']
Expand All @@ -7,6 +64,7 @@ timeout = 10
[tool.coverage.run]
source = ['arq']
branch = true
omit = ['arq/__main__.py']

[tool.coverage.report]
precision = 2
Expand Down
2 changes: 1 addition & 1 deletion requirements/all.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r ./docs.txt
-r ./linting.txt
-r ./testing.txt
-r ./setup.txt
-r ./pyproject.txt
12 changes: 6 additions & 6 deletions requirements/setup.txt → requirements/pyproject.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile --extra=watch --output-file=requirements/setup.txt setup.py
# pip-compile --extra=watch --output-file=requirements/pyproject.txt pyproject.toml
#
anyio==3.6.1
# via watchfiles
async-timeout==4.0.2
# via redis
click==8.1.3
# via arq (setup.py)
# via arq (pyproject.toml)
deprecated==1.2.13
# via redis
hiredis==2.0.0
Expand All @@ -20,13 +20,13 @@ packaging==21.3
# via redis
pyparsing==3.0.9
# via packaging
redis[hiredis]==4.2.2
# via arq (setup.py)
redis[hiredis]==4.3.4
# via arq (pyproject.toml)
sniffio==1.2.0
# via anyio
typing-extensions==4.3.0
# via arq (setup.py)
# via arq (pyproject.toml)
watchfiles==0.16.1
# via arq (setup.py)
# via arq (pyproject.toml)
wrapt==1.14.1
# via deprecated
5 changes: 3 additions & 2 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ pytz==2022.2.1
# via
# -r requirements/testing.in
# dirty-equals
redis==4.2.2
# via redislite
# manually removed to avoid conflict with redis version from pyproject.toml
# redis==4.2.2
# # via redislite
redislite==6.2.805324
# via -r requirements/testing.in
termcolor==1.1.0
Expand Down
72 changes: 17 additions & 55 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,66 +1,28 @@
from pathlib import Path
import sys

sys.stderr.write(
"""
===============================
Unsupported installation method
===============================
arq no longer supports installation with `python setup.py install`.
Please use `python -m pip install .` instead.
"""
)
sys.exit(1)

from importlib.machinery import SourceFileLoader
from setuptools import setup

description = 'Job queues in python with asyncio and redis'
readme = Path(__file__).parent / 'README.md'
if readme.exists():
long_description = readme.read_text()
else:
long_description = description + '.\n\nSee https://arq-docs.helpmanual.io/ for documentation.'
# avoid loading the package before requirements are installed:
version = SourceFileLoader('version', 'arq/version.py').load_module()
# The below code will never execute, however GitHub is particularly
# picky about where it finds Python packaging metadata.
# See: https://github.com/github/feedback/discussions/6456
#
# To be removed once GitHub catches up.

setup(
name='arq',
version=version.VERSION,
description=description,
long_description=long_description,
long_description_content_type='text/markdown',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Framework :: AsyncIO',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: Unix',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'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 :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Clustering',
'Topic :: System :: Distributed Computing',
'Topic :: System :: Monitoring',
'Topic :: System :: Systems Administration',
],
python_requires='>=3.7',
author='Samuel Colvin',
author_email='s@muelcolvin.com',
url='https://github.com/samuelcolvin/arq',
license='MIT',
packages=['arq'],
package_data={'arq': ['py.typed']},
zip_safe=True,
entry_points="""
[console_scripts]
arq=arq.cli:cli
""",
install_requires=[
'redis[hiredis]>=4.2.0',
'click>=8.0',
'typing-extensions>=4.1.0',
],
extras_require={
'watch': ['watchfiles>=0.16'],
}
)

0 comments on commit dbb16b5

Please sign in to comment.