Skip to main content

Python async wrapper around Siril astrophotography software.

Project description

uv image image image Actions status Static Badge

async-siril

Async Siril is an asyncio based python wrapper around Siril 1.4.0 used for processing astronomy data for astrophotography and science. The library provides a pythonic interface to the Siril command line interface and all of it's commands. Scripts, processes, and workflows can be built with modern async python.

Features

  • async/await based using asyncio
  • code generated Siril commands from free-astro/siril-doc
  • logging with structlog
  • example CLI commands built for calibration, registration & stacking workflows examples
  • some helpers for common logic (see async_siril.helpers)
  • minimal dependencies (asyncio, structlog, psutil, attrs)
  • Linux, Mac, & Windows support
  • Docker support (see Dockerfile.siril)
  • 93% test coverage

Requirements

Installation

uv add async-siril
# OR
pip install async-siril

Usage

Here is a simple example of how to create a master bias using the library:

import asyncio
import pathlib

from async_siril import SirilCli
from async_siril.command import setext, set32bits, convert, stack
from async_siril.command_types import fits_extension

async def main():
    current_dir = pathlib.Path(__file__).parent
    async with SirilCli(directory=current_dir) as siril:
        await siril.command(setext(fits_extension.FITS_EXT_FIT))
        await siril.command(set32bits())

        await siril.command(convert("bias"))
        await siril.command(stack("bias", out="bias_master"))

if __name__ == "__main__":
    asyncio.run(main())

For advanced use cases you can run the Siril commands directly as strings.

from async_siril import SirilCli

async def main():
    async with SirilCli() as siril:
        await siril.command("setext fits")
        await siril.command("set32bits")
        await siril.command("convert bias")
        await siril.command("stack bias bias_master")

if __name__ == "__main__":
    asyncio.run(main())

By default, any command that fails will throw an exception and shut things down. If you want to catch these types of errors and try again or handle a different way you can use the failable_command method.

from async_siril import SirilCli

async def main():
    async with SirilCli() as siril:
        await siril.command("setext fits")
        await siril.command("set32bits")
        await siril.command("convert bias")
        result = await siril.failable_command("stack bias bias_master")
        if not result:
            print("Stack failed, make a change and try again")

if __name__ == "__main__":
    asyncio.run(main())

Docker (example only)

You can use the example Dockerfile.siril to build a docker image with Siril installed. This is useful for running the examples or for running Siril commands in a container.

docker build -f Dockerfile.siril -t async-siril:latest .

Once built you can test the interface with this (runs uv run ./examples/test_siril.py):

docker run --rm -it --name siril-test async-siril:latest

Roadmap

Please see ROADMAP.md for more details.

Contributing

PRs are welcome & appreciated! See the contributing guide to get started.

FAQ

Why not use pysiril?

pysiril is a great library for interacting with Siril. However, it is not asyncio based and does not provide a pythonic interface to the Siril command line interface.

Siril just added python scripting, how is this different?

The new python scripting added to Siril is a great improvement for in-app scripts. However, sometimes you just need a simple interface for headless operations of Siril.

Acknowledgements

Siril is a fantastic piece of software and I am grateful to the free-astro team for their hard work. Special thanks to Vincent for answering questions and providing support.

License

async-siril is licensed under:

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in async-siril by you, as defined in the BSD-3-Clause license, shall be dually licensed as above, without any additional terms or conditions.

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

async_siril-0.3.0.tar.gz (119.4 kB view details)

Uploaded Source

Built Distribution

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

async_siril-0.3.0-py3-none-any.whl (62.2 kB view details)

Uploaded Python 3

File details

Details for the file async_siril-0.3.0.tar.gz.

File metadata

  • Download URL: async_siril-0.3.0.tar.gz
  • Upload date:
  • Size: 119.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for async_siril-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e1a2b6b50bcdfa6c3b837c9b9849aec4efa0ec053897fd27d4f646b73bb9b0d3
MD5 c678a1e9ff4d7f04448460659ac476ef
BLAKE2b-256 821f33209702af7d275f243bd1af2c9ac177b303b1a9357a04213f766e8dd31e

See more details on using hashes here.

File details

Details for the file async_siril-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for async_siril-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a07a962c4042c3c3ae54340aea2943a6006a374fb23826ec3f6ce5009d4e6c8
MD5 b0fddae118dce18b37ae06ad967e9261
BLAKE2b-256 922d1c1311356506f930e370cb260043c64240ce43eb1660cee76671e0eca908

See more details on using hashes here.

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