Skip to content

Commit

Permalink
packaging: switch back to requirements.txt
Browse files Browse the repository at this point in the history
The pyproject.toml spec is highly opinionated about installing
dependencies. As such, locally development is unpleasant when running
pip install . since it will always install the package, not just our
depends. This complicates testing "the right changes".

To promote a better experience, return to using requirements files and
make pyproject.toml depend on them dynamically so we don't have to
maintain the information in multiple places.

Signed-off-by: Cory Todd <cory.todd@canonical.com>
  • Loading branch information
Cory Todd committed Jun 20, 2023
1 parent a5d4bbe commit 07abb93
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
23 changes: 23 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,26 @@ Examples:
$ jdiff a.json b.json -i 2 -s symmetric
$ jdiff a.yaml b.yaml -f yaml -s symmetric
Development
-----------

Install development dependencies and test locally with

.. code-block:: bash
pip install -r requirements-dev.txt
# ... do your work ... add tests ...
pytest
Installing From Source
----------------------

To install from source run

.. code-block:: bash
pip install .
This will install the library and cli for `jsondiff` as well as its runtime
dependencies.
15 changes: 5 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "jsondiff"
description = "Diff JSON and JSON-like structures in Python"
dynamic = ["version"]
dynamic = ["version", "dependencies", "optional-dependencies"]
readme = "README.rst"
license= {file = "LICENSE" }
requires-python = ">=3.8"
Expand All @@ -17,15 +17,6 @@ classifiers = [
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
]
dependencies = [
"pyyaml"
]

[project.optional-dependencies]
test = [
"hypothesis",
"pytest"
]

[project.urls]
"Homepage" = "https://github.com/xlwings/jsondiff"
Expand All @@ -40,3 +31,7 @@ exclude = ["tests*"]

[tool.setuptools.dynamic]
version = {attr = "jsondiff.__version__"}
dependencies = {file=["requirements.txt"]}

[tool.setuptools.dynamic.optional-dependencies]
dev = {file=["requirements-dev.txt"]}
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hypothesis
pytest
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyyaml

0 comments on commit 07abb93

Please sign in to comment.