diff --git a/.github/wordlist.txt b/.github/wordlist.txt index a62df860..3d5a7490 100644 --- a/.github/wordlist.txt +++ b/.github/wordlist.txt @@ -90,6 +90,7 @@ firsttimersonly fo genindex gmail +hatchling html http https @@ -128,6 +129,7 @@ pubsub punsubscribe py pypi +pyproject quickstart readonly readwrite @@ -149,6 +151,7 @@ subcommands thevalueofmykey timeseries toctree +toml topk triaging txt diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index a2a280dd..b27f4531 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -38,7 +38,8 @@ 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 -r dev_requirements.txt -r docs/requirements.txt + pip install . invoke build-docs - name: upload docs diff --git a/.github/workflows/install_and_test.sh b/.github/workflows/install_and_test.sh index edb2e7fe..63a9a7c8 100755 --- a/.github/workflows/install_and_test.sh +++ b/.github/workflows/install_and_test.sh @@ -19,8 +19,8 @@ if [ -d ${DESTENV} ]; then fi python -m venv ${DESTENV} source ${DESTENV}/bin/activate -pip install --upgrade --quiet pip setuptools wheel -pip install --quiet -r dev_requirements.txt +pip install --upgrade --quiet pip +pip install --quiet -r dev_requrements.txt invoke devenv invoke package diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 80a90734..68463654 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -32,7 +32,12 @@ jobs: - uses: actions/checkout@v5 - uses: pypa/gh-action-pip-audit@v1.1.0 with: - inputs: requirements.txt dev_requirements.txt + inputs: . + ignore-vulns: | + GHSA-w596-4wvx-j9j6 # subversion related git pull, dependency for pytest. There is no impact here. + - uses: pypa/gh-action-pip-audit@v1.1.0 + with: + inputs: dev_requirements.txt ignore-vulns: | GHSA-w596-4wvx-j9j6 # subversion related git pull, dependency for pytest. There is no impact here. @@ -115,9 +120,8 @@ jobs: - name: run tests run: | - pip install -U setuptools wheel - pip install -r requirements.txt pip install -r dev_requirements.txt + pip install . if [ "${{matrix.connection-type}}" == "libvalkey" ]; then pip install "libvalkey>=4.0.1" fi diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml index 940115fd..bba25301 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -23,12 +23,11 @@ jobs: - name: Install dev tools run: | pip install -r dev_requirements.txt - pip install twine wheel + pip install twine - name: Build package run: | - python setup.py build - python setup.py sdist bdist_wheel + hatchling build - name: Basic package test prior to upload run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30880dec..356fb595 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,7 +94,6 @@ Here's how to get started with your code contribution: a. python -m venv .venv b. source .venv/bin/activate c. pip install -r dev_requirements.txt - c. pip install -r requirements.txt 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` diff --git a/INSTALL b/INSTALL index c72fbe11..a7aa4e74 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,5 @@ Please use - python setup.py install - -and report errors to via https://github.com/valkey-io/valkey-py/issues/new + pip install . +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 index a015cd46..72783105 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -4,6 +4,7 @@ click flake8-isort flake8 flynt +hatchling invoke mock packaging>=20.4 @@ -14,4 +15,3 @@ pytest-timeout ujson>=4.2.0 uvloop; implementation_name != "pypy" vulture>=2.3.0 -wheel>=0.30.0 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..08d9bdd4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "valkey" +version = "6.1.1" +description = "Python client for Valkey forked from redis-py" +readme = "README.md" +license = { file = "LICENSE" } +keywords = ["Valkey", "key-value store", "database"] + +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.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] + +requires-python = ">=3.10" + +dependencies = [ + 'async-timeout>=4.0.3; python_full_version<"3.11.3"', +] + +[project.optional-dependencies] +libvalkey = ["libvalkey>=4.0.1"] +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" + +[tool.hatch.build.targets.sdist] +include = [ + "/tests", + "/valkey", + "dev_requirements.txt", +] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7b5745c8..00000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -async-timeout>=4.0.3; python_full_version<"3.11.3" diff --git a/setup.py b/setup.py deleted file mode 100644 index 11b1dcd1..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.1.1", - 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.10", - install_requires=[ - 'async-timeout>=4.0.3; python_full_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.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3.14", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - ], - extras_require={ - "libvalkey": ["libvalkey>=4.0.1"], - "ocsp": ["cryptography>=36.0.1", "pyopenssl==23.2.1", "requests>=2.31.0"], - }, -) diff --git a/tasks.py b/tasks.py index 457f605d..38beeb70 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("hatchling build")