diff --git a/.github/wordlist.txt b/.github/wordlist.txt index 36b8b386..16cab0dd 100644 --- a/.github/wordlist.txt +++ b/.github/wordlist.txt @@ -127,6 +127,7 @@ pubsub punsubscribe py pypi +pyproject quickstart readonly readwrite @@ -148,6 +149,7 @@ subcommands thevalueofmykey timeseries toctree +toml topk triaging txt diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index e1ed369a..96e6df66 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -36,7 +36,7 @@ jobs: sudo apt-get install -yqq pandoc make - name: run code linters run: | - pip install -r requirements.txt -r dev_requirements.txt -r docs/requirements.txt + pip install '.[dev,docs]' invoke build-docs - name: upload docs diff --git a/.github/workflows/install_and_test.sh b/.github/workflows/install_and_test.sh index 99852513..539fa915 100755 --- a/.github/workflows/install_and_test.sh +++ b/.github/workflows/install_and_test.sh @@ -20,7 +20,7 @@ fi python -m venv ${DESTENV} source ${DESTENV}/bin/activate pip install --upgrade --quiet pip -pip install --quiet -r dev_requirements.txt +pip install --quiet '.[dev]' invoke devenv invoke package diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 207aa4ba..ef154014 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -32,7 +32,6 @@ jobs: - uses: actions/checkout@v4 - uses: pypa/gh-action-pip-audit@v1.1.0 with: - inputs: requirements.txt dev_requirements.txt ignore-vulns: | GHSA-w596-4wvx-j9j6 # subversion related git pull, dependency for pytest. There is no impact here. @@ -47,7 +46,7 @@ jobs: cache: 'pip' - name: run code linters run: | - pip install -r dev_requirements.txt + pip install '.[dev]' invoke linters populate-cache: @@ -105,8 +104,7 @@ jobs: - name: run tests run: | pip install -U setuptools wheel - pip install -r requirements.txt - pip install -r dev_requirements.txt + pip install '.[dev]' if [ "${{matrix.connection-type}}" == "libvalkey" ]; then pip install "libvalkey>=4.0.0" fi diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml index f07fdbd4..f2cf0fab 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -22,13 +22,12 @@ jobs: python-version: 3.9 - name: Install dev tools run: | - pip install -r dev_requirements.txt + pip install '.[dev]' pip install twine wheel - name: Build package run: | - python setup.py build - python setup.py sdist bdist_wheel + python -m build -sw - name: Basic package test prior to upload run: | diff --git a/.readthedocs.yml b/.readthedocs.yml index 800cb148..6a0e79f3 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,10 +1,5 @@ version: 2 -python: - install: - - requirements: ./docs/requirements.txt - - requirements: requirements.txt - build: os: ubuntu-20.04 tools: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 939b3da1..93bafb82 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,12 +89,11 @@ Here's how to get started with your code contribution: 1. Create your own fork of valkey-py 2. Do the changes in your fork 3. - *Create a virtualenv and install the development dependencies from the dev_requirements.txt file:* + *Create a virtualenv and install the development dependencies:* a. python -m venv .venv b. source .venv/bin/activate - c. pip install -r dev_requirements.txt - c. pip install -r requirements.txt + c. pip install '.[dev]' 4. If you need a development environment, run `invoke devenv`. Note: this relies on docker-compose to build environments, and assumes that you have a version supporting [docker profiles](https://docs.docker.com/compose/profiles/). 5. While developing, make sure the tests pass by running `invoke tests` @@ -106,7 +105,7 @@ To see what else is part of the automation, run `invoke -l` ## The Development Environment Running `invoke devenv` installs the development dependencies specified -in the dev_requirements.txt. It starts all of the dockers used by this +in `pyproject.toml`. It starts all of the dockers used by this project, and leaves them running. These can be easily cleaned up with `invoke clean`. NOTE: it is assumed that the user running these tests, can execute docker and its various commands. diff --git a/INSTALL b/INSTALL index c72fbe11..94d3a7a7 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ Please use - python setup.py install + pip install . -and report errors to via https://github.com/valkey-io/valkey-py/issues/new +and report errors to us via https://github.com/valkey-io/valkey-py/issues/new diff --git a/dev_requirements.txt b/dev_requirements.txt deleted file mode 100644 index c56d2483..00000000 --- a/dev_requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -black -cachetools -click -flake8-isort -flake8 -flynt -invoke -mock -packaging>=20.4 -pytest -pytest-asyncio -pytest-cov -pytest-timeout -ujson>=4.2.0 -uvloop -vulture>=2.3.0 -wheel>=0.30.0 diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 5b15c092..00000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -sphinx>=5.0,<7.0 -docutils<0.18 -nbsphinx -sphinx_gallery -ipython -sphinx-autodoc-typehints -furo -pandoc diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..0b1e3223 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,97 @@ +[project] +name = "valkey" +description = "Python client for Valkey forked from redis-py" +readme = "README.md" +keywords = ["Valkey", "key-value store", "database"] +license = { text = "MIT License" } +version = "6.0.2" + +authors = [ + { name = "valkey-py authors", email = "valkey-py@lists.valkey.io" } +] + +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] + +requires-python = ">=3.8" + +dependencies =[ + 'async-timeout>=4.0.3; python_version<"3.11.3"', +] + +[project.optional-dependencies] +libvalkey = ["libvalkey>=4.0.0"] +ocsp = ["cryptography>=36.0.1", "pyopenssl==23.2.1", "requests>=2.31.0"] +dev = [ + "black", + "build", + "cachetools", + "click", + "flake8-isort", + "flake8", + "flynt", + "invoke", + "mock", + "packaging>=20.4", + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-timeout", + "ujson>=4.2.0", + "uvloop", + "vulture>=2.3.0", + "wheel>=0.30.0", +] +docs = [ + "sphinx>=5.0,<7.0", + "docutils<0.18", + "nbsphinx", + "sphinx_gallery", + "ipython", + "sphinx-autodoc-typehints", + "furo", + "pandoc", +] + +[project.urls] +Homepage = "https://github.com/valkey-io/valkey-py" +Documentation = "https://valkey-py.readthedocs.io/en/latest/" +Changes = "https://github.com/valkey-io/valkey-py/releases" +Code = "https://github.com/valkey-io/valkey-py" +"Issue tracker" = "https://github.com/valkey-io/valkey-py/issues" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +include = [ + "valkey", + "valkey._parsers", + "valkey.asyncio", + "valkey.commands", + "valkey.commands.bf", + "valkey.commands.json", + "valkey.commands.search", + "valkey.commands.timeseries", + "valkey.commands.graph", + "valkey.parsers", +] + +[tool.setuptools.package-data] +valkey = ["py.typed"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c919607e..00000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -async-timeout>=4.0.3; python_version<"3.11.3" diff --git a/setup.py b/setup.py index 500272c3..60684932 100644 --- a/setup.py +++ b/setup.py @@ -1,62 +1,3 @@ -#!/usr/bin/env python -from setuptools import find_packages, setup +from setuptools import setup -setup( - name="valkey", - description="Python client for Valkey forked from redis-py", - long_description=open("README.md").read().strip(), - long_description_content_type="text/markdown", - keywords=["Valkey", "key-value store", "database"], - license="MIT", - version="6.0.2", - packages=find_packages( - include=[ - "valkey", - "valkey._parsers", - "valkey.asyncio", - "valkey.commands", - "valkey.commands.bf", - "valkey.commands.json", - "valkey.commands.search", - "valkey.commands.timeseries", - "valkey.commands.graph", - "valkey.parsers", - ] - ), - package_data={"valkey": ["py.typed"]}, - include_package_data=True, - url="https://github.com/valkey-io/valkey-py", - project_urls={ - "Documentation": "https://valkey-py.readthedocs.io/en/latest/", - "Changes": "https://github.com/valkey-io/valkey-py/releases", - "Code": "https://github.com/valkey-io/valkey-py", - "Issue tracker": "https://github.com/valkey-io/valkey-py/issues", - }, - author="valkey-py authors", - author_email="valkey-py@lists.valkey.io", - python_requires=">=3.8", - install_requires=[ - 'async-timeout>=4.0.3; python_version<"3.11.3"', - ], - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - ], - extras_require={ - "libvalkey": ["libvalkey>=4.0.0"], - "ocsp": ["cryptography>=36.0.1", "pyopenssl==23.2.1", "requests>=2.31.0"], - }, -) +setup() diff --git a/tasks.py b/tasks.py index 8e5e094e..f138966f 100644 --- a/tasks.py +++ b/tasks.py @@ -20,7 +20,7 @@ def devenv(c): @task def build_docs(c): """Generates the sphinx documentation.""" - run("pip install -r docs/requirements.txt") + run("pip install '.[docs]'") run("make -C docs html") @@ -91,4 +91,4 @@ def clean(c): @task def package(c): """Create the python packages""" - run("python setup.py sdist bdist_wheel") + run("python -m build -sw")