fiboa / cli

CLI for fiboa (validation, inspection, schema and file creation, etc.)
https://pypi.org/project/fiboa-cli/
Apache License 2.0
0 stars 5 forks source link
python tooling

fiboa CLI

A command-line interface (CLI) for working with fiboa.

Getting Started

In order to make working with fiboa easier we have developed command-line interface (CLI) tools such as inspection, validation and file format conversions.

Installation

You will need to have Python 3.9 or any later version installed.

Run pip install fiboa-cli in the CLI to install the validator.

Optional: To install additional dependencies for specific converters, you can for example run: pip install fiboa-cli[xyz] with xyz being the converter name.

Note on versions:

Execute a command

After the installation you should be able to run the following command: fiboa

You should see usage instructions and available commands for the CLI.

fiboa CLI supports various commands to work with the files:

Commands

Validation

To validate a fiboa GeoParquet or GeoJSON file, you can for example run:

Check fiboa validate --help for more details.

The validator also supports remote files.

Create fiboa GeoParquet from GeoJSON

To create a fiboa-compliant GeoParquet for a fiboa-compliant set of GeoJSON files containing Features or FeatureCollections, you can for example run:

Check fiboa create-geoparquet --help for more details.

Create fiboa GeoJSON from GeoParquet

To create one or multiple fiboa-compliant GeoJSON file(s) for a fiboa-compliant GeoParquet file, you can for example run:

Check fiboa create-geoparquet --help for more details.

Inspect fiboa GeoParquet file

To look into a fiboa GeoParquet file to get a rough understanding of the content, the following can be executed:

Check fiboa describe --help for more details.

Create JSON Schema from fiboa Schema

To create a JSON Schema for a fiboa Schema YAML file, you can for example run:

Check fiboa jsonschema --help for more details.

Validate a fiboa Schema

To validate a fiboa Schema YAML file, you can for example run:

Check fiboa validate-schema --help for more details.

Update an extension template with new names

Once you've created and git cloned a new extension, you can use the CLI to update all template placeholders with proper names.

For example, if your extension is meant to have

Then the following command could be used:

Check fiboa rename-extension --help for more details.

Converter for existing datasets

The CLI ships various converters for existing datasets.

To get a list of available converters/datasets with title, license, etc. run:

Use any of the IDs from the list to convert an existing dataset to fiboa:

See Implement a converter for details about how to

Development

To install in development mode run pip install -e . in this folder.

For the tests first run pip install -r requirements-dev.txt to install pytest. Then you can run pytest to execute the tests.

Implement a converter

The following high-level description gives an idea how to implement a converter in fiboa CLI:

  1. Create a new file in fiboa_cli/datasets based on the template.py
  2. Implement the convert() function / test it / run it
  3. Add missing dependencies into a separate dependency group in setup.py
  4. Add the converter to the list above
  5. Create a PR to submit your converter for review

An in-depth guide how to create a cloud-native fiboa dataset using fiboa CLI is available at: https://github.com/fiboa/data/blob/main/HOWTO.md