semvec/pypi-packages huggingface dataset:
dkist-fits-validator 0.1rc1
DKIST data validator
License: MIT
Requires Python: >=3.7

DKIST Data Validator
===========================

An interface containing a validator, and a spec translator for DKIST specs:

- SPEC-0122 Rev C: Data received from the summit

- SPEC-0214 Rev ?: Data published by the Data Center (incomplete)

Features
--------

-  Uses `voluptuous <https://pypi.org/project/voluptuous/>`__ schemas to
   validate a given input header against dkist specifications

-  3 keyword validations: type validation, required-ness validation, and value validation

-  Failure exceptions include a dictionary of validation failure causes

-  SPEC-0122 to SPEC-0214 translation


Installation
------------

.. code:: bash

   pip install dkist-fits-validator


Usage
--------
Currently, this package can be used to validate SPEC122 data or SPEC214 data. Please import the
corresponding methods (spec122_validator and Spec122ValidationException, or spec214_validator, Spec214ValidationException).

This package can be used for validating data, or for validating and translating data (SPEC122 input only).

Input data can be one of:
    - string file path
    - File like object
    - HDUList object
    - fits.header.Header object
    - Dictionary of header keys and values

To validate data:

.. code:: python

    from dkist_fits_validator import spec122_validator, Spec122ValidationException

    spec122_validator.validate('dkist_rosa0181200000_observation.fits')

To validate and translate data:

.. code:: python

    from dkist_fits_validator import spec122_validator, Spec122ValidationException

    spec122_validator.validate_and_translate('dkist_rosa0181200000_observation.fits')

Within the validate and validate_and_translate methods, a series of flags can be set, otherwise they will take their default values:
    - extra: Default value is true (allow extra keys). This flag determines if extra keywords are allowed in the schema to be validated. Ingest validation should allow extra keys.
    - return_dict: Default value is false. If set to true, validation will return a dictionary of validated headers.


Examples
--------
1. Validate a file:

.. code:: python

    >>> from dkist_fits_validator import spec122_validator, Spec122ValidationException
    >>> spec122_validator.validate('dkist_rosa0181200000_observation.fits', return_dict=True)

2. Validate and translate a file:

.. code:: python

    >>> from dkist_fits_validator import spec122_validator, Spec122ValidationException
    >>> spec122_validator.validate_and_translate('dkist_rosa0181200000_observation.fits')

3. Validate headers:

.. code:: python

    >>> from dkist_fits_validator import spec122_validator, Spec122ValidationException
    >>> from astropy.io import fits
    >>> hdus = fits.open('dkist_rosa0181200000_observation.fits')
    >>> spec122_validator.validate(hdus[0].header, return_dict=True)


This project is Copyright (c) AURA/NSO.
ReAPI 0.0.1
A simple yet powerful API creation library.
License: MIT
Requires Python: >=3.7

# ReAPI
And easy to use, aiohttp based framework for creating APIs.

## Why ReAPI
ReAPI is a Python module that aims with the assistance of making simple APIs in Python. It's goal is to let you focus on the important
bits of an API, managing all of the HTTP and MySQL aspects for you.
It uses the modern async/await syntax for its handlers and aims to do as much as possible asyncronously.

## Basic Example
Getting started with ReAPI is trivial! Here you can view an easy to understand example of how the basics
of ReAPI work.

```py
# Import all of the necessary modules, including ReAPI.
import reapi
import asyncio

# Create the primary server object.
server = reapi.ReAPI()

# Create two simple handlers for the purpose of experimentation.
async def simple_home(req) -> str:
    """Simple hello world."""

    return "Hello, world!"

async def simple_json(req) -> dict:
    """Returns simple json."""

    return {
        "message": "Hello, world!"
    }

# The main function that starts up the server.
async def main():
    server.create_handler("/", simple_home)
    server.create_handler("/json", simple_json)

    server.config["log_conns"] = True

    await server.run()

asyncio.run(main())
```

## MySQL
ReAPI also provides a simple manner in which to use MySQL cleanly and efficiently.

In order to take advantage of this, you must first call the `create_pool` coroutine with the details of the MySQL server.
This will then allow you to create MySQL-enabled handlers. In order to create a MySQL handler, call the `create_handler`
with the arg `use_mysql` set to true. This means that from now on, the handler will also be passed another arg with the type
of `aiomysql.Connection`.

## Todo
Here are some of the planned features.
- Regex paths in handlers.
- Improved way of setting status.

## Notes
This project is in early development. Why it's usable in its current state, plenty of features are planning to be implemented.

Additionally, this Readme will be re-written to follow an improved format.