A python client library for the Indico IPA Platform.
See the full Documentation.
Required: Python 3.9+
From PyPI:
pip3 install indico-clientFrom source:
Using UV (recommended):
# Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone https://github.com/IndicoDataSolutions/indico-client-python.git
cd indico-client-python
uv pip install -e ".[all]"Or using pip:
git clone https://github.com/IndicoDataSolutions/indico-client-python.git
cd indico-client-python
pip install -e ".[all]"Running in a Docker container:
docker build -t indico-client .
docker run -it indico-client bash
The Indico Platform and Client Libraries use JSON Web Tokens (JWT) for user authentication. Details on acquiring this token can be found at this documentation
The following environment variables are used for authentication in the default IndicoClient object
INDICO_HOST: URL of the IPA instanceINDICO_API_TOKEN: user token downloaded from these directions
from indico import IndicoClient, IndicoConfig
config = IndicoConfig(
host='try.indico.io', # or your custom app location
api_token_path='./indico_api_token.txt' # path to your API token
)
client = IndicoClient(config=config)from indico import IndicoClient
from indico.client.request import GraphQLRequest
client = IndicoClient()
response = client.call(GraphQLRequest(
query="""
query modelGroupQueries($ids: [Int]) {
modelGroups(modelGroupIds: $ids){
modelGroups{
id
}
}
}
""",
variables={"ids": [1]}
))
model_groups = response["model_groups"]["model_groups"]
To run the tests associated with this repo perform the following:
Ensure you have set the environment variables detailed here
You will also need the following env variables set for the Exchange integration tests:
EXCH_TENANT_IDEXCH_CLIENT_IDEXCH_CLIENT_SECRETEXCH_USER_ID
Using UV (recommended):
- Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh - Install the client and test dependencies
uv pip install -e ".[all]" "pytest<8" "requests-mock>=1.8.0" "pytest-asyncio>0.21" - Run tests
pytest -sv --host <indico_host> tests/_ Only run unit testspytest -sv --host <indico_host> tests/unit/_ Only run integration testspytest -sv --host <indico_host> tests/integration/ - Check typing
uv pip install "mypy==1.8" typing_extensions pandas-stubs types-requests types-pytz types-openpyxl mypy --config-file=pyproject.toml
Or using pip:
- Create a virtual environment
python3 -m venv venv - Activate the virtual environment
source venv/bin/activate - Install the client
pip3 install --editable .[all] - Install test deps
pip3 install "pytest<8" "requests-mock>=1.8.0" "pytest-asyncio>0.21" - Run tests
pytest -sv --host <indico_host> tests/_ Only run unit testspytest -sv --host <indico_host> tests/unit/_ Only run integration testspytest -sv --host <indico_host> tests/integration/ - Check typing
pip3 install "mypy==1.8" typing_extensions pandas-stubs types-requests types-pytz types-openpyxl mypy --config-file=pyproject.toml
Alternatively, run all the unit tests via docker compose run --rm tester
Pushing a version tag runs .github/workflows/release.yml. It runs the tests, builds, checks the built version equals the tag, waits for approval, and publishes to PyPI through trusted publishing.
# Check everything without tagging or pushing
scripts/release.sh 7.11.0 --dry-run
# Tag HEAD and push the tag, after a confirmation prompt
scripts/release.sh 7.11.0
# Skip the confirmation prompt (required when not run from a terminal)
scripts/release.sh 7.11.0 --yes
# Allow a version below the highest X.Y.Z tagged on origin
scripts/release.sh 7.10.1 --allow-olderManual equivalent:
git tag 7.11.0
git push origin refs/tags/7.11.0- No
vprefix, lowercase, no leading zeros. Accepted shapes:7.11.0release7.11.0-alpha1publishes as7.11.0a17.11.0-beta1publishes as7.11.0b17.11.0-rc1publishes as7.11.0rc17.11.0-a1publishes as7.11.0a17.11.0-b1publishes as7.11.0b17.11.0.post1post release7.11.0.dev1dev release
- The script refuses a version whose
X.Y.Zis below the highestX.Y.Zalready tagged on origin.--allow-olderoverrides this. - A
.postNrelease needs its base version tag (7.11.0for7.11.0.post1) to exist on origin. - A version already published under another spelling is refused (
7.11.0-a1when7.11.0-alpha1exists). - Tag the exact commit to release. It must already be on origin; it need not be the tip of master.
- One tag per commit.
- Push one tag at a time, never
git push --tags. - A PyPI version cannot be reused.
- Two teams own releases. Their members push version tags and approve publishing:
- QA:
qa@indicodata.ai, GitHub teamqa-indicodata-ai - Intake:
intake@indicodata.ai, GitHub teamintake-indicodata-ai
- QA:
- This is a deployment approval on the
pypienvironment, not a pull request review. - After the tests and build pass, the publish job pauses. A member of either team opens the workflow run in the Actions tab and chooses "Review deployments".
- The approver confirms the tag is on the intended commit and the version is right.
- If the environment has "Prevent self-review" on, the approver must be someone other than the person who pushed the tag.
- Before upload nothing is published. Cancel the workflow run first if it is still running or waiting for approval, because deleting the tag does not cancel it. Then delete the tag and tag again:
git tag -d 7.11.0
git push origin :refs/tags/7.11.0- At upload, re-run the failed job.
- If the re-run fails with "File already exists", part of the release is already on PyPI. Publish a
.postNrelease instead.
This repository adheres (as best as possible) to the following standards:
- Python formatting with
ruff format- Line Width=88
- Google Docstrings