From 4f5af2c76f1cb1c24174b015da41a708510ec190 Mon Sep 17 00:00:00 2001 From: Austin Noto-Moniz Date: Thu, 5 Feb 2026 14:31:22 -0500 Subject: [PATCH] Add TOML file. --- .github/workflows/pr-tests.yml | 6 ++-- doc_requirements.txt | 6 ++-- pyproject.toml | 64 ++++++++++++++++++++++++++++++++++ requirements.txt | 18 ++++------ scripts/run_tests.sh | 7 ++-- setup.py | 55 ----------------------------- test_requirements.txt | 10 +++--- tests/test_citrine.py | 2 +- tests/test_session.py | 21 ++++++----- 9 files changed, 99 insertions(+), 90 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index fa8041488..ef4381cfe 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -10,8 +10,8 @@ on: jobs: pr-tests: - uses: CitrineInformatics/common-gh-actions/.github/workflows/run-tests.yml@v1.1 + uses: CitrineInformatics/common-gh-actions/.github/workflows/run-tests.yml@v2.0 with: src: src/citrine - include_313: true - skip_38: false + skip_39: true + include_314: true diff --git a/doc_requirements.txt b/doc_requirements.txt index f7674b274..e715d365c 100644 --- a/doc_requirements.txt +++ b/doc_requirements.txt @@ -1,3 +1,3 @@ -sphinx==7.1.2 -sphinx-rtd-theme==2.0.0 -sphinxcontrib-apidoc==0.4.0 +sphinx==8.1.3 +sphinx-rtd-theme==3.1.0 +sphinxcontrib-apidoc==0.6.0 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..349a0a31c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,64 @@ +[project] +name = "citrine-python" +dynamic = ["version"] +dependencies = [ + "requests>=2.32.2,<3", + "pyjwt>=2,<3", + "arrow>=1.0.0,<2", + "gemd>=2.1.9,<3", + "boto3>=1.34.35,<2", + "deprecation>=2.1.0,<3", + "urllib3>=2.5.0,<3", + "tqdm>=4.27.0,<5", +] +requires-python = ">=3.10" +authors = [ + {name = "Citrine Informatics"} +] +description = "Python library for the Citrine Platform" +readme = "README.md" +license-files = ["LICENSE"] +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] + +[project.urls] +Homepage = "http://github.com/CitrineInformatics/citrine-python" + +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.dynamic] +version = {attr = "citrine.__version__.__version__"} + +[tool.setuptools.packages.find] +where = ["src"] + +[dependency-groups] +dev = [ + "flake8==7.0.0", + "flake8-docstrings==1.7.0", + "pandas==2.3.0", + "pytest==8.4.2", + "pytest-cov==7.0.0", + "derp==0.1.1", + "tomli>=2.2.1", + "factory-boy==3.3.3", + "mock==5.2.0", + "requests-mock==1.12.1" +] +docs = [ + "sphinx==8.1.3", + "sphinx-rtd-theme==3.1.0", + "sphinxcontrib-apidoc==0.6.0", +] + +[tool.pytest.ini_options] +testpaths = [ + "tests", +] + diff --git a/requirements.txt b/requirements.txt index ebabfb729..114c1921d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,8 @@ -arrow==1.3.0 -boto3==1.34.35 +arrow==1.4.0 +boto3==1.42.42 deprecation==2.1.0 -gemd==2.1.9 -pyjwt==2.8.0 -requests==2.32.4 -tqdm==4.66.3 - -# boto3 (through botocore) depends on urllib3. Version 1.34.35 requires -# urllib3 < 1.27 when using Python 3.9 or less, and urllib3 < 2.1 otherwise. -urllib3==1.26.18; python_version < "3.10" -urllib3==2.5.0; python_version >= "3.10" +gemd==2.2.0 +pyjwt==2.11.0 +requests==2.32.5 +tqdm==4.67.3 +urllib3==2.6.3 diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 36c3ba183..3fbd20be1 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -37,7 +37,8 @@ fi flake8 $REPO_DIR/src || exit 1; derp $REPO_DIR/src $REPO_DIR/src/citrine/__version__.py || exit 1; -pytest $QUIET $EXITFIRST --cov=$REPO_DIR/src \ - --cov-report term-missing:skip-covered \ - --cov-config=$REPO_DIR/tox.ini --no-cov-on-fail --cov-fail-under=100 \ +pytest $QUIET $EXITFIRST --cov=$REPO_DIR/src \ + --cov-report term-missing:skip-covered \ + --cov-config=$REPO_DIR/pyproject.toml \ + --no-cov-on-fail --cov-fail-under=100 \ $REPO_DIR/tests || exit 1; diff --git a/setup.py b/setup.py deleted file mode 100644 index f7ae61b91..000000000 --- a/setup.py +++ /dev/null @@ -1,55 +0,0 @@ -from os import path - -from setuptools import find_packages, setup - -# read the contents of your README file -this_directory = path.abspath(path.dirname(__file__)) -with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: - long_description = f.read() - -about = {} -with open(path.join(this_directory, "src", "citrine", "__version__.py"), "r") as f: - exec(f.read(), about) - -setup( - name="citrine", - # Update this in src/citrine/__version__.py - version=about["__version__"], - python_requires=">=3.8", - url="http://github.com/CitrineInformatics/citrine-python", - description="Python library for the Citrine Platform", - long_description=long_description, - long_description_content_type="text/markdown", - author="Citrine Informatics", - package_dir={"": "src"}, - packages=find_packages(where="src"), - install_requires=[ - "requests>=2.32.2,<3", - "pyjwt>=2,<3", - "arrow>=1.0.0,<2", - "gemd>=2.1.9,<3", - "boto3>=1.34.35,<2", - "deprecation>=2.1.0,<3", - "urllib3>=1.26.18,<3; python_version < '3.10'", - "urllib3>=2.5.0,<3; python_version >= '3.10'", - "tqdm>=4.27.0,<5", - ], - extras_require={ - "tests": [ - "factory-boy>=3.3.0,<4", - "mock>=5.1.0,<6", - "pandas>=2.0.3,<3", - "pytest>=8.0.0,<9", - "requests-mock>=1.11.0,<2", - ] - }, - classifiers=[ - "Programming Language :: Python :: 3", - "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", - ], -) diff --git a/test_requirements.txt b/test_requirements.txt index 52c85c417..68fdbe5bb 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,11 +1,11 @@ derp==0.1.1 -factory-boy==3.3.0 +factory-boy==3.3.3 flake8==7.0.0 flake8-docstrings==1.7.0 -mock==5.1.0 -pytest==8.0.0 -pytest-cov==4.1.0 -requests-mock==1.11.0 +mock==5.2.0 +pytest==8.4.2 +pytest-cov==7.0.0 +requests-mock==1.12.1 pandas>=2.0.3,<3 # faker is a dependency of factory-boy, but factory-boy sets a very low floor diff --git a/tests/test_citrine.py b/tests/test_citrine.py index 539ce2a26..1b24c9221 100644 --- a/tests/test_citrine.py +++ b/tests/test_citrine.py @@ -11,7 +11,7 @@ def refresh_token(expiration: datetime = None) -> dict: token = jwt.encode( payload={'exp': expiration.timestamp()}, - key='garbage' + key='Actually_Triangle_Perhaps_Finally' ) return {'access_token': token} diff --git a/tests/test_session.py b/tests/test_session.py index f1e105bb3..e85e83d69 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -1,27 +1,30 @@ import jwt +from datetime import datetime, timedelta, timezone + +import mock +import requests +import requests_mock import pytest +from citrine._session import Session from citrine.exceptions import ( BadRequest, Conflict, NonRetryableException, + NotFound, + RetryableException, WorkflowNotReadyException, - RetryableException) + Unauthorized, + UnauthorizedRefreshToken, +) -from datetime import datetime, timedelta, timezone - -import mock -import requests -import requests_mock -from citrine._session import Session -from citrine.exceptions import UnauthorizedRefreshToken, Unauthorized, NotFound from tests.utils.session import make_fake_cursor_request_function def refresh_token(expiration: datetime = None) -> dict: token = jwt.encode( payload={'exp': expiration.timestamp()}, - key='garbage' + key='Actually_Triangle_Perhaps_Finally' ) return {'access_token': token}