Skip to content

Convert legacy setuptools use to pyproject.toml #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions setup.cfg → .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ commit = True
tag = True
tag_name = {new_version}

[flake8]
max-line-length = 120
builtins = json
statistics = true
ignore = E202
exclude = ./data,./src,.svn,CVS,.bzr,.hg,.git,__pycache__

[bumpversion:file:setup.py]
[bumpversion:file:pyproject.toml]

[bumpversion:file:README.md]

Expand Down
44 changes: 11 additions & 33 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ on:

jobs:
build:

env:
DEFAULT_PYTHON: 3.12
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
architecture: ["x64"]
steps:
- uses: actions/checkout@v2
Expand All @@ -21,59 +22,36 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Cache pip 3.8
if: matrix.python-version == 3.8
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev3.8.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Cache pip
if: matrix.python-version != 3.8
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Upgrade setuptools
if: matrix.python-version >= 3.12
run: |
# workaround for 3.12, SEE: https://github.com/pypa/setuptools/issues/3661#issuecomment-1813845177
pip install --upgrade setuptools
- name: Install dependencies
if: matrix.python-version > 3.9
run: pip install -r requirements-dev.txt
- name: Install dependencies
if: matrix.python-version <= 3.9
run: pip install -r requirements-dev3.8.txt
- name: Lint with flake8
if: matrix.python-version == 3.12
if: matrix.python-version == ${{ env.DEFAULT_PYTHON }}
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 deepdiff --count --select=E9,F63,F7,F82 --show-source --statistics
nox -e flake8 -- deepdiff --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 deepdiff --count --exit-zero --max-complexity=26 --max-line-lengt=250 --statistics
nox -e flake8 -- deepdiff --count --exit-zero --max-complexity=26 --max-line-length=250 --statistics
- name: Test with pytest and get the coverage
if: matrix.python-version == 3.12
if: matrix.python-version == ${{ env.DEFAULT_PYTHON }}
run: |
pytest --benchmark-disable --cov-report=xml --cov=deepdiff tests/ --runslow
nox -e pytest -s -- --benchmark-disable --cov-report=xml --cov=deepdiff tests/ --runslow
- name: Test with pytest and no coverage report
if: matrix.python-version != 3.12
if: matrix.python-version != ${{ env.DEFAULT_PYTHON }}
run: |
pytest --benchmark-disable
nox -e pytest -s -- --benchmark-disable tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == 3.12
if: matrix.python-version == ${{ env.DEFAULT_PYTHON }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- [Extract](https://zepworks.com/deepdiff/current/extract.html): Extract an item from a nested Python object using its path.
- [commandline](https://zepworks.com/deepdiff/current/commandline.html): Use DeepDiff from commandline.

Tested on Python 3.8+ and PyPy3.
Tested on Python 3.9+ and PyPy3.

- **[Documentation](https://zepworks.com/deepdiff/8.4.2/)**

Expand Down
1 change: 0 additions & 1 deletion deepdiff/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Any
from deepdiff.helper import strings, numbers, SetOrdered


Expand Down
1 change: 0 additions & 1 deletion deepdiff/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
pydantic_base_model_type,
PydanticBaseModel,
NotPresent,
ipranges,
)
from deepdiff.model import DeltaResult

Expand Down
49 changes: 49 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""nox configuration file."""

# ruff: noqa: ANN001, D401

import nox


@nox.session
def flake8(session) -> None:
"""Run flake8."""
posargs = session.posargs if session.posargs else ["deepdiff"]
session.install(".[cli,dev,static]")
session.run(
"python",
"-m",
"flake8",
*posargs,
)


@nox.session
def mypy(session) -> None:
"""Run mypy."""
posargs = session.posargs if session.posargs else ["deepdiff"]
session.install(".[cli,dev,static]")
session.run(
"python",
"-m",
"mypy",
"--install-types",
"--non-interactive",
*posargs,
)


@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"])
def pytest(session) -> None:
"""Test with pytest."""
posargs = session.posargs if session.posargs else ["-vv", "tests"]
session.install(".[cli,dev,static,test]")
session.run(
"python",
"-m",
"pytest",
"--cov=deepdiff",
"--cov-report",
"term-missing",
*posargs,
)
104 changes: 104 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[build-system]
requires = ["flit_core >=3.11,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "deepdiff"
version = "8.4.2"
dependencies = [
"orderly-set>=5.3.0,<6",
]
requires-python = ">=3.9"
authors = [
{ name = "Seperman", email = "[email protected]" }
]
maintainers = [
{ name = "Seperman", email = "[email protected]" }
]
description = "Deep Difference and Search of any Python object/data. Recreate objects by adding adding deltas to each other."
readme = "README.md"
license = {file = "LICENSE"}
keywords = []
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Topic :: Software Development",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: PyPy",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License"
]

# `dependency-groups` would make this a lot cleaner, in theory.
[project.optional-dependencies]
coverage = [
"coverage~=7.6.0"
]
cli = [
"click~=8.1.0",
"pyyaml~=6.0.0"
]
dev = [
"bump2version~=1.0.0",
"jsonpickle~=4.0.0",
"ipdb~=0.13.0",
"numpy~=2.2.0; python_version >= '3.10'",
"numpy~=2.0; python_version < '3.10'",
"python-dateutil~=2.9.0",
"orjson~=3.10.0",
"tomli~=2.2.0",
"tomli-w~=1.2.0",
"pandas~=2.2.0",
"polars~=1.21.0",
]
docs = [
# We use the html style that is not supported in Sphinx 7 anymore.
"Sphinx~=6.2.0",
"sphinx-sitemap~=2.6.0",
"sphinxemoji~=0.3.0"
]
static = [
"flake8~=7.1.0",
"flake8-pyproject~=1.2.3",
"pydantic~=2.10.0",
"types-setuptools~=75.8.0",
]
test = [
"pytest~=8.3.0",
"pytest-benchmark~=5.1.0",
"pytest-cov~=6.0.0",
"python-dotenv~=1.0.0",
]

[project.scripts]
deep = "deepdiff.commands:cli"

[project.urls]
Homepage = "https://zepworks.com/deepdiff/"
Documentation = "https://zepworks.com/deepdiff/"
Repository = "https://github.com/seperman/deepdiff"
Issues = "https://github.com/seperman/deepdiff/issues"

[tool.coverage.run]
branch = true
source = ["."]

[tool.flake8]
max-line-length = 120
builtins = "json"
statistics = true
ignore = "E202"
exclude = "./data,./src,.svn,CVS,.bzr,.hg,.git,__pycache__"

[tool.pytest.ini_options]
addopts = "--pdbcls=IPython.terminal.debugger:Pdb"

[tool.setuptools]
packages = ["deepdiff"]

[tool.setuptools.package-metadata]
deepdiff = ["py.typed"]
2 changes: 0 additions & 2 deletions pytest.ini

This file was deleted.

2 changes: 0 additions & 2 deletions requirements-cli.txt

This file was deleted.

22 changes: 0 additions & 22 deletions requirements-dev.txt

This file was deleted.

20 changes: 0 additions & 20 deletions requirements-dev3.8.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements-docs.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements-optimize.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion run_tests.sh

This file was deleted.

Loading