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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 4 additions & 18 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,36 @@ jobs:
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
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 deepdiff --count --select=E9,F63,F7,F82 --show-source --statistics
tox -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
tox -e flake8 -- deepdiff --count --exit-zero --max-complexity=26 --max-line-lengt=250 --statistics
- name: Test with pytest and get the coverage
if: matrix.python-version == 3.12
run: |
pytest --benchmark-disable --cov-report=xml --cov=deepdiff tests/ --runslow
tox -s -- --benchmark-disable --cov-report=xml --cov=deepdiff tests/ --runslow
- name: Test with pytest and no coverage report
if: matrix.python-version != 3.12
run: |
pytest --benchmark-disable
tox -s -- --benchmark-disable tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == 3.12
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
149 changes: 149 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
[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.8"
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.8",
"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; python_version > '3.8'",
]
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"]

[tool.tox]
legacy_tox_ini = """
[tox]
min_version = 4.0
env_list =
flake8
# XXX: this needs work.
#mypy
py38
py39
py310
py311
py312
py313

[testenv]
deps =
.[cli]
.[coverage]
.[dev]
.[static]
.[test]
commands =
python -m pytest --cov=deepdiff --cov-report term-missing {posargs:-vv tests}

[testenv:flake8]
deps =
.[cli]
.[dev]
.[static]
commands =
python -m flake8 {posargs:deepdiff}

[testenv:mypy]
deps =
.[cli]
.[dev]
.[static]
.[test]
mypy
commands =
python -m mypy --install-types --non-interactive {posargs:deepdiff}
"""
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.

69 changes: 0 additions & 69 deletions setup.py

This file was deleted.