Skip to content
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
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Tests

on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: |
uv sync --all-extras

- name: Run tests with pytest
run: |
uv run pytest tests/ --cov=src/jsonapi_client --cov-report=term-missing

- name: Upload coverage to Codecov
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ dist
/build/
.venv
.vscode
.pytest_cache
.pytest_cache

# UV
.python-version
*.egg-info/
59 changes: 57 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ JSON API ( http://jsonapi.org )
Installation
============

From Pypi::
From PyPI::

pip install jsonapi-client

Or using uv (recommended)::

uv pip install jsonapi-client

Or from sources::

./setup.py install
uv pip install .


Usage
Expand Down Expand Up @@ -333,6 +337,57 @@ Credits
- Author and package maintainer: Tuomas Airaksinen (https://github.com/tuomas2/).


Development
===========

This project uses `UV <https://docs.astral.sh/uv/>`_ for package management and supports Python 3.9+.

Quick Start
-----------

1. Install UV::

pip install uv

2. Clone the repository::

git clone https://github.com/h3r2on/jsonapi-client.git
cd jsonapi-client

3. Create a virtual environment and install dependencies::

uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv sync --all-extras

4. Run tests::

uv run pytest tests/

Running Tests
-------------

With UV::

uv run pytest tests/ --cov=src/jsonapi_client

With traditional pip (still supported)::

pip install -e ".[test]"
pytest tests/ --cov=src/jsonapi_client

Development with All Dependencies
----------------------------------

To install all dependencies (test + docs)::

# With UV
uv sync --all-extras

# Or with pip
pip install -e ".[all]"


License
=======

Expand Down
97 changes: 97 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "jsonapi-client"
version = "0.9.10"
description = "Comprehensive, yet easy-to-use, pythonic, ORM-like access to JSON API services"
readme = "README.rst"
license = {text = "BSD-3-Clause"}
authors = [
{name = "Tuomas Airaksinen", email = "tuomas.airaksinen@qvantel.com"},
]
keywords = ["JSONAPI", "JSON API", "client"]
classifiers = [
"Programming Language :: Python",
"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",
"Topic :: Software Development :: Libraries",
"License :: OSI Approved :: BSD License",
]
requires-python = ">=3.9"
dependencies = [
"requests",
"jsonschema",
"aiohttp",
]

[project.urls]
Homepage = "https://github.com/h3r2on/jsonapi-client"
Repository = "https://github.com/h3r2on/jsonapi-client"

[project.optional-dependencies]
test = [
"pytest>=8.0",
"pytest-asyncio>=0.23.0",
"pytest-mock>=3.12",
"pytest-aiohttp>=1.0",
"pytest-cov>=4.0",
"asynctest>=0.13.0",
"aiodns>=3.0",
"coveralls>=4.0",
]
docs = [
"sphinx>=7.0",
"sphinx-autodoc-annotation>=1.0",
]
# Development includes all test and documentation dependencies
all = [
"pytest>=8.0",
"pytest-asyncio>=0.23.0",
"pytest-mock>=3.12",
"pytest-aiohttp>=1.0",
"pytest-cov>=4.0",
"asynctest>=0.13.0",
"aiodns>=3.0",
"coveralls>=4.0",
"sphinx>=7.0",
"sphinx-autodoc-annotation>=1.0",
]

[tool.hatch.build.targets.wheel]
packages = ["src/jsonapi_client"]

[tool.hatch.build.targets.sdist]
include = [
"/src",
"/tests",
"/docs",
"README.rst",
"CHANGES.rst",
"LICENSE.txt",
]

[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
addopts = "--cov=src/jsonapi_client --cov-report=term-missing"

[tool.coverage.run]
source = ["src/jsonapi_client"]
omit = ["*/tests/*", "*/test_*"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
]
24 changes: 11 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
requests
pytest-asyncio
pytest-mock
pytest
pytest-aiohttp
asynctest
jsonschema
aiohttp>=3.0
aiodns
sphinx
sphinx-autodoc-annotation
pytest-cov
coveralls
# DEPRECATED: This file is no longer used.
# Project now uses pyproject.toml with UV for package management.
#
# For development, use:
# uv sync --all-extras
#
# Or with pip:
# pip install -e ".[test,dev,docs]"
#
# The dependencies are now defined in pyproject.toml under [project.dependencies]
# and [project.optional-dependencies]
35 changes: 7 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
from setuptools import setup, find_packages
# This project now uses pyproject.toml for configuration.
# This file is kept for backward compatibility only.
# Please use: uv pip install -e .
# Or: pip install -e .

setup(
name="jsonapi_client",
version='0.9.10',
description="Comprehensive, yet easy-to-use, pythonic, ORM-like access to JSON API services",
long_description=(open("README.rst").read() + "\n" +
open("CHANGES.rst").read()),
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development :: Libraries",
"License :: OSI Approved :: BSD License",
],
author="Tuomas Airaksinen",
author_email="tuomas.airaksinen@qvantel.com",
url="https://github.com/h3r2on/jsonapi-client",
keywords="JSONAPI JSON API client",
license="BSD-3",
package_dir={"": "src"},
packages=find_packages("src"),
include_package_data=True,
zip_safe=False,
install_requires=[
"requests",
"jsonschema",
"aiohttp",
],
)
from setuptools import setup

setup()
7 changes: 5 additions & 2 deletions src/jsonapi_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
import pkg_resources
from importlib.metadata import version, PackageNotFoundError

from .session import Session
from .filter import Filter, Inclusion, Modifier, Sort, SparseField
from .common import ResourceTuple

__version__ = pkg_resources.get_distribution("jsonapi-client").version
try:
__version__ = version("jsonapi-client")
except PackageNotFoundError:
__version__ = "0.9.10"
Loading
Loading