diff --git a/README.md b/README.md index 59ff7f9..023657b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,12 @@ pip install git+https://github.com/WFP-VAM/DataBridgesAPI.git ``` (you may need to run `pip` with root permission: `sudo pip install git+https://github.com/WFP-VAM/DataBridgesAPI.git`) +For local development, install from the project metadata in `pyproject.toml`: + +```sh +pip install . +``` + Then import the package: ```python import data_bridges_client @@ -29,12 +35,11 @@ import data_bridges_client ### Setuptools -Install via [Setuptools](http://pypi.python.org/pypi/setuptools). +The package metadata is declared in `pyproject.toml`. `setup.py` remains only as a compatibility wrapper for older tooling. ```sh -python setup.py install --user +pip install . ``` -(or `sudo python setup.py install` to install the package for all users) Then import the package: ```python @@ -281,4 +286,3 @@ Authentication schemes defined for the API: wfp.economicanalysis@wfp.org - diff --git a/pyproject.toml b/pyproject.toml index ba1dd7c..627857a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,36 +1,50 @@ -[tool.poetry] -name = "data_bridges_client" +[build-system] +requires = ["setuptools>=61"] +build-backend = "setuptools.build_meta" + +[project] +name = "data-bridges-client" version = "7.0.0" description = "VAM-Data-Bridges" -authors = ["VAM-INFO "] -license = "Affero GPL 3.0" readme = "README.md" -repository = "https://github.com/WFP-VAM/DataBridgesAPI" +requires-python = ">=3.10" +license = { text = "Affero GPL 3.0" } +authors = [ + { name = "VAM-INFO", email = "wfp.economicanalysis@wfp.org" }, +] keywords = ["OpenAPI", "OpenAPI-Generator", "VAM-Data-Bridges"] -include = ["data_bridges_client/py.typed"] +dependencies = [ + "urllib3 >= 1.25.3, < 2.1.0", + "python-dateutil >= 2.8.2", + "pydantic >= 2", + "typing-extensions >= 4.7.1", + "httpx >= 0.23", +] -[tool.poetry.dependencies] -python = "^3.10" +[project.optional-dependencies] +test = [ + "pytest~=7.1.3", + "pytest-cov>=2.8.1", + "pytest-randomly>=3.12.0", +] +dev = [ + "pytest>=7.2.1", + "tox>=3.9.0", + "flake8>=4.0.0", + "types-python-dateutil>=2.8.19.14", + "mypy==1.4.1", +] -urllib3 = ">= 1.25.3" -python-dateutil = ">=2.8.2" -pydantic = ">=2" -typing-extensions = ">=4.7.1" -httpx = ">=0.23" +[project.urls] +Repository = "https://github.com/WFP-VAM/DataBridgesAPI" -[tool.poetry.dev-dependencies] -pytest = ">=7.2.1" -tox = ">=3.9.0" -flake8 = ">=4.0.0" -types-python-dateutil = ">=2.8.19.14" -mypy = "1.4.1" +[tool.setuptools.packages.find] +exclude = ["test", "tests"] +[tool.setuptools.package-data] +data_bridges_client = ["py.typed"] -[build-system] -requires = ["setuptools"] -build-backend = "setuptools.build_meta" - -[tool.pylint.'MESSAGES CONTROL'] +[tool.pylint."MESSAGES CONTROL"] extension-pkg-whitelist = "pydantic" [tool.mypy] @@ -39,34 +53,12 @@ files = [ "test", # auto-generated tests # "tests", # hand-written tests ] -# TODO: enable "strict" once all these individual checks are passing -# strict = true - -# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options warn_unused_configs = true warn_redundant_casts = true warn_unused_ignores = true - -## Getting these passing should be easy strict_equality = true strict_concatenate = true - -## Strongly recommend enabling this one as soon as you can check_untyped_defs = true - -## These shouldn't be too much additional work, but may be tricky to -## get passing if you use a lot of untyped libraries disallow_subclassing_any = true disallow_untyped_decorators = true disallow_any_generics = true - -### These next few are various gradations of forcing use of type annotations -#disallow_untyped_calls = true -#disallow_incomplete_defs = true -#disallow_untyped_defs = true -# -### This one isn't too hard to get passing, but return on investment is lower -#no_implicit_reexport = true -# -### This one can be tricky to get passing if you use a lot of untyped libraries -#warn_return_any = true diff --git a/requirements.txt b/requirements.txt index 7d22e04..9514127 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,3 @@ -python_dateutil >= 2.5.3 -setuptools >= 21.0.0 -urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 2 -typing-extensions >= 4.7.1 -httpx >= 0.23 +# Deprecated compatibility shim. +# Runtime dependencies are declared in pyproject.toml. +. diff --git a/setup.py b/setup.py index 78019dd..b024da8 100644 --- a/setup.py +++ b/setup.py @@ -1,51 +1,4 @@ -# coding: utf-8 +from setuptools import setup -""" - VAM-Data-Bridges - API Documentation of the **DataBridges** platform: https://databridges.vam.wfp.org/. For API discussions and details: #api-integration-vam-data-bridges on Slack, [Teams channel](https://teams.microsoft.com/l/team/19%3a4ca595f7681f4ffa8a86b7af58832e8d%40thread.skype/conversations?groupId=cbd1e508-c6e8-459d-96b7-6cac3039c42c&tenantId=462ad9ae-d7d9-4206-b874-71b1e079776f) **API Integration** - This endpoint uses [Hey Jude](https://docs.api.wfp.org/providers/#api-patterns) pattern - - The version of the OpenAPI document: 7.0.0 - Contact: wfp.economicanalysis@wfp.org - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from setuptools import setup, find_packages # noqa: H301 - -# To install the library, run the following -# -# python setup.py install -# -# prerequisite: setuptools -# http://pypi.python.org/pypi/setuptools -NAME = "data-bridges-client" -VERSION = "7.0.0" -PYTHON_REQUIRES = ">=3.10" -REQUIRES = [ - "urllib3 >= 1.25.3, < 2.1.0", - "python-dateutil", - "pydantic >= 2", - "typing-extensions >= 4.7.1", - "httpx >= 0.23", -] - -setup( - name=NAME, - version=VERSION, - description="VAM-Data-Bridges", - author="VAM-INFO", - author_email="wfp.economicanalysis@wfp.org", - url="", - keywords=["OpenAPI", "OpenAPI-Generator", "VAM-Data-Bridges"], - install_requires=REQUIRES, - packages=find_packages(exclude=["test", "tests"]), - include_package_data=True, - long_description_content_type='text/markdown', - long_description="""\ - API Documentation of the **DataBridges** platform: https://databridges.vam.wfp.org/. For API discussions and details: #api-integration-vam-data-bridges on Slack, [Teams channel](https://teams.microsoft.com/l/team/19%3a4ca595f7681f4ffa8a86b7af58832e8d%40thread.skype/conversations?groupId=cbd1e508-c6e8-459d-96b7-6cac3039c42c&tenantId=462ad9ae-d7d9-4206-b874-71b1e079776f) **API Integration** - This endpoint uses [Hey Jude](https://docs.api.wfp.org/providers/#api-patterns) pattern - """, # noqa: E501 - package_data={"data_bridges_client": ["py.typed"]}, -) +setup() diff --git a/test-requirements.txt b/test-requirements.txt index 8e6d8cb..65511e0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,3 @@ -pytest~=7.1.3 -pytest-cov>=2.8.1 -pytest-randomly>=3.12.0 -mypy>=1.4.1 -types-python-dateutil>=2.8.19 +# Deprecated compatibility shim. +# Test dependencies are declared in pyproject.toml under [project.optional-dependencies]. +.[test] diff --git a/tox.ini b/tox.ini index fac7a49..aaebb72 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,7 @@ envlist = py3 [testenv] -deps=-r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +extras = test commands= pytest --cov=data_bridges_client