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
6 changes: 3 additions & 3 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions doc_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx==7.1.2
sphinx-rtd-theme==2.0.0
sphinxcontrib-apidoc==0.4.0
sphinx==8.1.3
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sphinx 9.0 requires 3.12+.

sphinx-rtd-theme==3.1.0
sphinxcontrib-apidoc==0.6.0
64 changes: 64 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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",
]

18 changes: 7 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
55 changes: 0 additions & 55 deletions setup.py

This file was deleted.

10 changes: 5 additions & 5 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_citrine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated pyjwt was warning about this key being too short.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to have this be a shared import, rather than a magic string that appears twice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. I'll include that adjustment on some other PR.

)
return {'access_token': token}

Expand Down
21 changes: 12 additions & 9 deletions tests/test_session.py
Original file line number Diff line number Diff line change
@@ -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}

Expand Down
Loading