Registry / serialization / cligj
library0.7.2pypypi✓ verified 30d ago

cligj provides a collection of reusable Click parameter and option decorators specifically designed for building command-line interfaces that interact with GeoJSON data. It simplifies handling GeoJSON input/output, feature processing, and related geospatial concerns within Click applications. The current version is 0.7.2, and it maintains a stable release cadence typical for a mature utility library.

pip install cligj
INSTALL
IMPORT
SIG · CLIGJ
C
cligj
serializationpythonv0.7.2
Install
1.7s avg
Import
75ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.7.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.080s · 18.7MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.070s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

features_in_arg
✓ from cligj import features_in_arg
✗ from cligj import features_in_info

This quickstart demonstrates how to use `cligj.features_in_info` to create a Click command that reads GeoJSON features from standard input, adds a new property indicating the feature's index in the input stream, and writes the modified features as a GeoJSON sequence to standard output. It's a common pattern for processing streamable GeoJSON data.

import click import json import sys from cligj import features_in_info @click.command() @features_in_info def cli(src_features): """ Reads GeoJSON features from stdin, adds a feature index to properties, and writes the modified features to stdout as a GeoJSON sequence. Usage example: echo '{"type":"Feature","properties":{},"geometry":null}' | python your_script.py """ for f, i in src_features: f['properties']['f_idx'] = i['f_idx'] click.echo(json.dumps(f)) if __name__ == '__main__': cli()
cligj --version
Debug
Known issues
deprecatedThe `cligj.old_precision_opt` decorator is deprecated. While still functional, it's recommended to switch to `cligj.precision_opt` for explicit control over GeoJSON floating-point precision.
fix
Replace `cligj.old_precision_opt()` with `cligj.precision_opt()` in your Click commands to use the clearer and officially supported option.
affects: 0.5.0 and later
gotchaUsers often confuse `cligj.features_in_info` and `cligj.io_in_info`. `features_in_info` is for iterating individual GeoJSON features, typically from a FeatureCollection or a GeoJSON sequence. `io_in_info` provides file-like objects for the entire input/output stream, suitable for commands that read or write a single GeoJSON object or need byte-level control.
fix
Use `features_in_info` when your command processes GeoJSON features one by one. Use `io_in_info` when your command expects a single GeoJSON object or needs direct control over the input/output streams for tasks like validation or transformation of the entire GeoJSON structure.
affects: All versions
gotchaWhile `cligj` technically supports Python 2.7, Python 2 reached End-of-Life in 2020. New projects and ongoing development should exclusively target Python 3. Although the library's `requires_python` range supports 2.7, relying on it for new work is discouraged and may lead to compatibility issues with other modern dependencies.
fix
Develop new applications and maintain existing ones on Python 3 (preferably 3.8+). If you must interact with legacy Python 2 code, ensure thorough testing and be prepared for potential maintenance challenges.
affects: All versions
Upgrade
Version history
0.7.2latest on PyPI · released May 28, 2021
Audit
Dependencies
clickrequiredCore dependency for creating command-line interfaces.
geojsonrequiredUsed for parsing and serializing GeoJSON data structures.
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
cligj — pip install cligj · libregistry