Skip to main content

Python library and CLI for the CERN ATLAS Glance/Fence API

Project description

stare

Python library and CLI for the CERN ATLAS Glance/Fence API.

Actions Status Documentation Status PyPI version

Installation

python -m pip install stare

Authentication

stare uses PKCE (no passwords stored). Run once to authenticate:

stare auth login

Your browser will open CERN SSO. After approval, tokens are stored locally and refreshed automatically.

CLI usage

# Search analyses — Rich table in terminal, JSON when piped
stare analysis search
stare analysis search --query 'referenceCode = ANA-HION-2018-01'
stare analysis search -q 'keywords contain Higgs' --limit 20
stare analysis search -q 'shortTitle = "Phase Closed"'

# Pipe to jq for field selection (JSON is auto-emitted)
stare analysis search | jq '.results[].referenceCode'
stare analysis search -q 'referenceCode contain HION' \
  | jq -r '.results[] | select(.status == "Active") | .referenceCode'

# Search papers
stare paper search --query 'referenceCode = HDBS-2018-33'

# Get individual resources
stare analysis get ANA-HION-2018-01
stare paper get HDBS-2018-33

# CONF notes / PUB notes
stare conf-note ATLAS-CONF-2024-001
stare pub-note ATL-PHYS-PUB-2024-001

# List metadata
stare groups
stare subgroups

# Auth management
stare auth login
stare auth logout
stare auth status

# Cache management
stare cache info
stare cache clear --yes

Output is a Rich table when stdout is a terminal and JSON when piped or redirected. Use --json / --no-json to override. Commands that expose --no-cache bypass the 8-hour on-disk response cache for that invocation.

Library usage

from stare import Glance

g = Glance()

# Search analyses (currently live)
result = g.analyses.search(query="referenceCode = ANA-HION-2018-01")
print(f"Found {result.total_rows} analyses")
for analysis in result.results:
    print(analysis.reference_code, analysis.short_title)

# Search papers (currently live)
paper_result = g.papers.search(query="referenceCode = HDBS-2018-33")
print(f"Found {paper_result.total_rows} papers")
for paper in paper_result.results:
    print(paper.reference_code, paper.short_title)

# Individual resource lookups (available as API endpoints go live)
analysis = g.analyses.get("ANA-HION-2018-01")
paper = g.papers.get("HDBS-2018-33")
groups = g.groups.list()

Use as a context manager for explicit connection lifecycle:

with Glance() as g:
    result = g.analyses.search(query="status = Active")

Inject a token directly (useful in CI/automated scripts):

g = Glance(token="your-access-token")

Configuration

Override defaults via environment variables:

Variable Default
STARE_BASE_URL https://atlas-glance.cern.ch/atlas/analysis/api
STARE_CLIENT_ID stare
STARE_AUTH_URL CERN Keycloak auth endpoint
STARE_TOKEN_URL CERN Keycloak token endpoint
STARE_CALLBACK_PORT 8182 (must match Keycloak registration)

Development

git clone https://github.com/kratsg/stare
cd stare
pixi install
pixi run pre-commit-install
pixi run stare auth login
pixi run test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stare-0.3.0rc1.tar.gz (152.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stare-0.3.0rc1-py3-none-any.whl (59.8 kB view details)

Uploaded Python 3

File details

Details for the file stare-0.3.0rc1.tar.gz.

File metadata

  • Download URL: stare-0.3.0rc1.tar.gz
  • Upload date:
  • Size: 152.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stare-0.3.0rc1.tar.gz
Algorithm Hash digest
SHA256 07d5fdcb26480d2d522d263f2bc07744df315f23c2e9d30f90b371a1ba40a305
MD5 4d3f79a156122a895a2205eb066481b6
BLAKE2b-256 36d87d0679caf20395372e2a76e60638b196ed5905112efb6726dcdb01035d3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for stare-0.3.0rc1.tar.gz:

Publisher: cd.yml on kratsg/stare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stare-0.3.0rc1-py3-none-any.whl.

File metadata

  • Download URL: stare-0.3.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 59.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stare-0.3.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 85cbba89c959e3ffd748c0df28aca72a46b1a64af5f411c65e962b26d31bb4b9
MD5 c16b10d3e5ba658c670ec41c3bb7d6e4
BLAKE2b-256 2b05d6d49596e0ce911c7a174ac0ca7a4551f2683f420142f255848596f8b432

See more details on using hashes here.

Provenance

The following attestation bundles were made for stare-0.3.0rc1-py3-none-any.whl:

Publisher: cd.yml on kratsg/stare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page