Skip to main content

icpc-api

An unofficial Python client and CLI for icpc.global API. Supports authentication and customizable search over contest data.

Note: This project is aimed for regional contest organizers. If you want to compete, please use Regional Finder to find nearest regional competition to you and its schedule.

Install

Use Python 3.12+ and uv.

# add library to your project
uv add icpc-api

# run your script that uses `import icpc`
uv run --with icpc-api script.py

# install CLI into PATH
uv tool install 'icpc-api[cli]'

If you don't have uv, feel free to use pip or any other convenient Python package manager.

Quick start

CLI:

icpc auth login
icpc whoami
icpc contest teams 1234 --status ACCEPTED
icpc search teams 1234 --proj id,name,status --sort name:asc -o csv > teams.csv

Python synchronous API:

from icpc import Icpc
from icpc.search import contest_teams
from icpc.models import TeamStatus

with Icpc.from_store() as icpc:
    # Use DSL to build the request
    teams = contest_teams(1234)
    f = teams.fields
    q = teams.query(
        proj=[f.id.name, f.name.name, f.inst_short_name.name],
        filters=[f.status.eq(TeamStatus.ACCEPTED)],
        sort=[f.name.asc()],
    )
    # `icpc.all` executes search request
    for row in icpc.all(teams, q):
        print(row.id, row.name, row.inst_short_name)

Python asynchronous API:

import asyncio
from icpc import AsyncIcpc, Include


async def main() -> None:
    async with AsyncIcpc.from_store() as icpc:
        view = await icpc.load_contest(1234, Include.DEFAULT)
        for team in view.teams:
            print(team.name, len(team.contestants), team.institution.inst_name)


asyncio.run(main())

load_contest is the unified search: it fetches the team, team-member, institution and contest tables concurrently, then joins them — teams indexed by id, rosters bucketed by team, institutions attached by instId, participants by personId, and the JSON-in-a-string teamMembers and extraField columns parsed into real objects.

Authentication

Icpc.from_password("me@example.com", "…")  # SRP login
Icpc.from_store()  # use `icpc auth login` to authenticate
Icpc.from_token("eyJ…")  # a borrowed id token from localStorage
Icpc.anonymous()  # /contest/public/* only

When using store, token and credentials are written to ~/.config/icpc/credentials.json. You can also use ICPC_USERNAME and ICPC_PASSWORD or ICPC_ID_TOKEN environment variables. ID Token is valid only for one hour.

Documentation

Read detailed guides on how to use:

  • Python API — guide, with worked examples
  • CLI — every command, with worked examples
  • API reference — every endpoint this client wraps

Development

uv sync --extra cli
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run ty check icpc tests

Metadata

Release files for icpc-api 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for icpc-api 0.6.0
File Size Uploaded Provenance Actions
icpc_api-0.6.0.tar.gz 156.7 kB With provenance Details for icpc_api-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for icpc-api 0.6.0
File Interpreter ABI Platform Actions
icpc_api-0.6.0-py3-none-any.whl Python 3 none any Details for icpc_api-0.6.0-py3-none-any.whl

Total release size: 282.2 kB

Release files / icpc_api-0.6.0.tar.gz

Download URL icpc_api-0.6.0.tar.gz
Size 156.7 kB
Tags Source
SHA-256 checksum
How to use checksums
270c21d4825185a2ce05214410b87c7059444ab939922f45c8bd5061d293f267
BLAKE2b-256 checksum
How to use checksums
4d0482447896850fd5aba3e3e2e9cbb731df68ed5176e3f89a176bb672bada8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / icpc_api-0.6.0-py3-none-any.whl

Download URL icpc_api-0.6.0-py3-none-any.whl
Size 125.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d549d19ae4e3cebe4b11d0ff41a2ab19f517936b32c6d3584d4ba46c82e1d547
BLAKE2b-256 checksum
How to use checksums
dcb4359a52748b56763db624b15fb2d7f920739dd9ee8472d68c059b8f13e797
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for icpc-api 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for icpc_api-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page