Skip to main content

antares-devkit

Provides tools and utility methods to write and debug ANTARES filters with Python.

ANTARES is an Alert Broker developed by the NSF NOIRLab for ZTF and LSST.

If you want to write and submit a filter to ANTARES please follow the steps to submit a filter in our documentation. If you wrote a filter for antares and is not in the devkit repository, contact us and we'll send you your code from our backup.

Installation

The ANTARES DevKit supports Python version 3.9 and up and can be installed with pip:

pip install antares-devkit

Basic Usage

The DevKit can be used in a local environment and also on NSF NOIRLab’s Astro Data Lab Jupyter environment.

A basic example of creating and executing a filter is provided below.

Create a HelloWorld filter:

from antares_devkit.models import BaseFilter


class HelloWorld(BaseFilter):
    OUTPUT_LOCUS_TAGS = [
        {"name": "hello_world", "description": "hello!"},
    ]

    def _run(self, locus):
        print("Hello Locus ", locus.locus_id)

Run the filter on a random ANTARES locus:

from antares_client import search
from antares_devkit.models import DevKitLocus
from antares_devkit.utils import filter_report

# fetch a random locus from the antares database using the antares-client
client_locus = search.get_random_locus()
devkit_locus = DevKitLocus.model_validate(client_locus.to_devkit())

# execute the filter
HelloWorld().run(devkit_locus)

For more information and additional examples visit our DevKit guide.

Development

How does this work?

This repository can be shipped as a python package on pip and also can be used in installations using the repository with tags. Then the filter_runner docker image in the antares main repository is going to install all the filters and required packages, then we use a gcp bucket to know which filters are enabled or disabled.

How to test filters using Docker (Recommended)

docker build -t antares_devkit:3.9 -f test/Dockerfile .
docker run -v $(pwd)/antares_devkit:/usr/src/app/antares_devkit -v $(pwd)/test:/usr/src/app/test -it antares_devkit:3.9
uv run pytest test

How to setup local environment (with conda)

conda create -n devkit python=3.9 -y
conda activate devkit
pip install uv
uv sync --all-groups --all-extras

How to add a filter dependency

uv add "{package_name}" --optional filter-dependencies

or for jupyter lab libraries use:

uv add "{package_name}" --optional jupyter

How to add a dev dependency

uv add "{package_name}" --group dev

or for docs libraries use:

uv add "{package_name}" --group docs

How to run a jupyter notebook

uv run --with jupyter jupyter lab

How to write documentation

Add md files and update mkdocs.yml to add them in the nav.

How to update filters src

  1. Execute uv run python scripts/update_filters_src.py
  2. Paste the output in mkdocs.yml within the nav.Filters replacing the entire section.

How to view the documentation locally

Install necessary dependencies:

uv sync --group docs

Serve the docs:

uv run mkdocs serve

Download files

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

Source Distribution

antares_devkit-0.10.1.tar.gz (13.9 MB view details)

Uploaded Source

Built Distribution

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

antares_devkit-0.10.1-py3-none-any.whl (14.3 MB view details)

Uploaded Python 3

File details

Details for the file antares_devkit-0.10.1.tar.gz.

File metadata

  • Download URL: antares_devkit-0.10.1.tar.gz
  • Upload date:
  • Size: 13.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for antares_devkit-0.10.1.tar.gz
Algorithm Hash digest
SHA256 17fc0e6b7661de2f7c9bb99c152bb74be4ebbbec836938d708e3ad9e80e5e4b4
MD5 805a9384e99fcaf7d3fcf166a440a280
BLAKE2b-256 77ed23efe9cfc8e20c2f150db6c9a2942acab7e00896b1f63ced4a2f3627a0be

See more details on using hashes here.

File details

Details for the file antares_devkit-0.10.1-py3-none-any.whl.

File metadata

File hashes

Hashes for antares_devkit-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c5a97c03b658ee7b853fec2dbf3615e6f3c0eb9f2cc3a6314a0cda14ffa2e3d
MD5 a02354ccf893ba44ea2b4d2413bc9bf0
BLAKE2b-256 126d3fdb125bde238a146b5a8698c47ab371ba0940b3195ced10bdd64f97977b

See more details on using hashes here.

Release history Release notifications | RSS feed

0.11.0

2 files

This release

0.10.1 This release

2 files

0.10.0

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

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