Socket
Socket
Sign inDemoInstall

cjvalpy

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cjvalpy

The Python bindings of the official CityJSON validator


Maintainers
1

Readme

cjvalpy

GitHub license PyPI version

Python bindings of cjval, the official validator for CityJSON files.

Installation

pip

To install the latest release: pip install cjvalpy

If you want to compile it yourself

  1. install latest Rust
  2. install maturin
  3. maturin build --release
  4. cd ./target/wheels/
  5. pip install [name-wheel].whl will install it to your local Python

Development

  1. install Rust (v1.39+)
  2. install maturin
  3. maturin develop
  4. move to another folder, and import cjvalpy shouldn't return any error

Usage

Made to be used with cjio:

cjio myfile.city.json validate

but can be used directly in python:

import cjvalpy
import json
import urllib.request

f = open("~/data/noise.city.json")
fj = json.loads(f.read())
js = []
js.append(json.dumps(fj))
print("Downloading the Extension JSON schema file(s):")
if "extensions" in fj:
    for ext in fj["extensions"]:
        theurl = fj["extensions"][ext]["url"]
        try:
            with urllib.request.urlopen(fj["extensions"][ext]["url"]) as f:
                sf = f.read().decode('utf-8')
                js.append(sf)
        except:
            s = "'%s' cannot be downloaded\nAbort" % fj["extensions"][ext]["url"]
            raise Exception(s)
val = cjvalpy.CJValidator(js)
val.validate()
re = val.get_report()
print(val.get_report())

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc