semvec/pypi-packages huggingface dataset:
ckanext-datasetpreview 0.2.38
Preview for datasets
License: MIT
Keywords: CKAN chart preview

[![Travis (.org)](https://img.shields.io/travis/avdata99/ckanext-datasetpreview?style=for-the-badge)](https://travis-ci.org/github/avdata99/ckanext-datasetpreview)
[![GitHub All Releases](https://img.shields.io/github/downloads/avdata99/ckanext-datasetpreview/total?style=for-the-badge)](https://github.com/avdata99/ckanext-datasetpreview/releases)
[![GitHub Issues](https://img.shields.io/github/issues/avdata99/ckanext-datasetpreview?style=for-the-badge)](https://github.com/avdata99/ckanext-datasetpreview/issues)
[![GitHub PR](https://img.shields.io/github/issues-pr/avdata99/ckanext-datasetpreview?style=for-the-badge)](https://github.com/avdata99/ckanext-datasetpreview/pulls)
[![Licence](https://img.shields.io/github/license/avdata99/ckanext-datasetpreview?style=for-the-badge)](https://github.com/avdata99/ckanext-datasetpreview/blob/master/LICENSE)
[![Pypi py version](https://img.shields.io/pypi/pyversions/ckanext-datasetpreview?style=for-the-badge)](https://pypi.org/project/ckanext-datasetpreview/)
[![Last Commit](https://img.shields.io/github/last-commit/avdata99/ckanext-datasetpreview?style=for-the-badge)](https://github.com/avdata99/ckanext-datasetpreview/commits/master)

# CKAN dataset preview

Still in a develpment status

Adds automatically charts for all datasets in the dataset list.
Uses `messytables` to discover field types.

## How to set up?

### General extension config values

Available config options

```ini
# Define if the extension should draw chart for
# - 'ALL'    All datasets with a CSV resource
# - 'EXTRA' Just datasets with the 'dataset_preview' extra dictionary defined
# - 'NO'     No datasets with show any preview
ckanext.datasetpreview.draw = 'ALL'  # default draw all
ckanext.datasetpreview.chart_height = 300  # pixels

```
Each dataset could add and extra value with nthe key `dataset_preview`:

```js
extras["dataset_preview"] = {
    // field to use in the chart. Could be:
    // - A list of field names (valids in the CSV resource)
    // Default will be [0, 1] ( the first two columns in the CSV). You could use numbers instead of field names
    "fields": ["Field1", "Field2"],  
    "chart_type": "Bar", // Allows 'Pie', 'Bar', 'Column'
    // URL could be:
    // - A external url
    // - No use this value: will be "csv_resource" with pick the first CSV resource in the dataset
    // - Name of the resource in the datasets (must be a CSV one)
    "url": "csv_resource",
    "height": 450,  // pixels
    "chart_color": "#AA5521"
}
```
If you don't setup each dataset it will show the first CSV resource in the dataset (using the first two columns)


![dataset-list](ckanext/datasetpreview/captures/dataset-list.png)
![dataset-list](ckanext/datasetpreview/captures/chart-config.png)
typedstruct 0.1.0
A wrapper around the struct library with support for PEP 484 types.
License: MIT
Requires Python: >=3.7,<4.0
Keywords: typing,structs

# typedstruct

[![Build Status](https://travis-ci.com/luizribeiro/typedstruct.svg?branch=master)](https://travis-ci.com/luizribeiro/typedstruct)
[![codecov](https://codecov.io/gh/luizribeiro/typedstruct/branch/master/graph/badge.svg)](https://codecov.io/gh/luizribeiro/typedstruct)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)

A wrapper around the [`struct` built-in module](https://docs.python.org/3/library/struct.html)
with support for [typing](https://www.python.org/dev/peps/pep-0484/), on top of
Python 3.7 [`dataclasses`](https://docs.python.org/3/library/dataclasses.html).

## Example

For example, if you wanted to read the header of BMP files, you could write
this:

```python
from dataclasses import dataclass
from typedstruct import LittleEndianStruct, StructType


@dataclass
class BMPHeader(LittleEndianStruct):
    type: int = StructType.uint16()  # magic identifier: 0x4d42
    size: int = StructType.uint32()  # file size in bytes
    reserved1: int = StructType.uint16()  # not used
    reserved2: int = StructType.uint16()  # not used
    offset: int = StructType.uint32()  # image data offset in bytes
    dib_header_size: int = StructType.uint32()  # DIB header size in bytes
    width_px: int = StructType.int32()  # width of the image
    height_px: int = StructType.int32()  # height of the image
    num_planes_px: int = StructType.uint16()  # number of color planes
    bits_per_pixel: int = StructType.uint16()  # bits per pixel
    compression: int = StructType.uint32()  # compression type
    image_size_bytes: int = StructType.uint32()  # compression type
    x_resolution_ppm: int = StructType.int32()  # pixels per meter
    y_resolution_ppm: int = StructType.int32()  # pixels per meter
    num_colors: int = StructType.int32()  # number of colors
    important_colors_colors: int = StructType.int32()  # important colors


with open("some_file.bmp", "rb") as file:
    raw_data = file.read(BMPHeader.get_size())
    bmp_header = BMPHeader.unpack(raw_data)
    assert bmp_header.type == 0x4D42
    print(f"This image is {bmp_header.width_px}x{bmp_header.height_px}")
```