From 34b1c50b2c4f172a1de26f4debdbd829b30dc548 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:31:20 +0200 Subject: [PATCH 1/6] update setup.py to pyproject.toml Signed-off-by: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Signed-off-by: C. Bo --- pyproject.toml | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 62 ---------------------------------------------- 2 files changed, 67 insertions(+), 62 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..74f1f1b4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,67 @@ +[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"] + +[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/setup.py b/setup.py deleted file mode 100644 index 500272c3..00000000 --- a/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -from setuptools import find_packages, 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"], - }, -) From 3c4169a9bf2de0ff7a0948ed99834e1da51cf823 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:07:06 +0200 Subject: [PATCH 2/6] Update invocations of setup.py Signed-off-by: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Signed-off-by: C. Bo --- .github/workflows/pypi-publish.yaml | 3 +-- INSTALL | 4 ++-- tasks.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml index f07fdbd4..ddc32c4c 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -27,8 +27,7 @@ jobs: - 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/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/tasks.py b/tasks.py index 8e5e094e..4769a035 100644 --- a/tasks.py +++ b/tasks.py @@ -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") From 063138a0bbde356332f3bd8dd3a5c181079bda41 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:09:18 +0200 Subject: [PATCH 3/6] Move requirements into pyproject.toml Signed-off-by: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Signed-off-by: C. Bo --- .github/workflows/docs.yaml | 2 +- .github/workflows/install_and_test.sh | 2 +- .github/workflows/integration.yaml | 6 ++---- .github/workflows/pypi-publish.yaml | 2 +- .readthedocs.yml | 5 ----- CONTRIBUTING.md | 7 +++---- dev_requirements.txt | 17 ---------------- docs/requirements.txt | 8 -------- pyproject.toml | 29 +++++++++++++++++++++++++++ requirements.txt | 1 - tasks.py | 2 +- 11 files changed, 38 insertions(+), 43 deletions(-) delete mode 100644 dev_requirements.txt delete mode 100644 docs/requirements.txt delete mode 100644 requirements.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 ddc32c4c..f2cf0fab 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -22,7 +22,7 @@ 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 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..74ccfe3f 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/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 index 74f1f1b4..3243f0ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,35 @@ dependencies =[ [project.optional-dependencies] libvalkey = ["libvalkey>=4.0.0"] ocsp = ["cryptography>=36.0.1", "pyopenssl==23.2.1", "requests>=2.31.0"] +dev = [ + "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", +] +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" 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/tasks.py b/tasks.py index 4769a035..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") From c2f282aad715891f4cb385378de2b51e063b1d00 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:50:31 +0200 Subject: [PATCH 4/6] re-add setup.py Signed-off-by: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Signed-off-by: C. Bo --- setup.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..60684932 --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() From 5effc396fd40340471c46a98222ec90c6a8bbaaa Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:51:21 +0200 Subject: [PATCH 5/6] update dictionary Signed-off-by: ds-cbo <82801887+ds-cbo@users.noreply.github.com> --- .github/wordlist.txt | 2 ++ CONTRIBUTING.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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/CONTRIBUTING.md b/CONTRIBUTING.md index 74ccfe3f..93bafb82 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -105,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 pyproject.toml. 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. From fcb7b67289efdc3b3dae3df1eff434d8ddda3049 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:09:05 +0200 Subject: [PATCH 6/6] add build as dependency Signed-off-by: ds-cbo <82801887+ds-cbo@users.noreply.github.com> --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 3243f0ac..0b1e3223 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ 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",