Pyaskalono

raw JSON →
0.2.0 verified Fri May 01 auth: no python

Python bindings for askalono, a Rust library for detecting open-source license texts in files. Current version 0.2.0, requires Python >=3.11. Pre-built wheels available for major platforms.

pip install pyaskalono
error ModuleNotFoundError: No module named 'askalono'
cause Installed the wrong package or import path is incorrect. The package is 'pyaskalono', not 'askalono'.
fix
Install pyaskalono: pip install pyaskalono, then import: from pyaskalono import detect_license
error ImportError: cannot import name 'detect_license' from 'pyaskalono'
cause The function may not exist in older versions, or there is a naming conflict. Current version 0.2.0 exposes it.
fix
Upgrade to latest: pip install --upgrade pyaskalono
error ValueError: License text too short
cause The input string is empty or too short (less than 50 characters) to detect any license.
fix
Provide a longer text snippet, at least a few lines from a known license.
gotcha The `detect_license` function expects the full license text as a single string, not file paths. If you pass a file path, it will be treated as license content and likely fail or return garbage.
fix Read the file contents before calling detect_license: `with open('LICENSE') as f: text = f.read()`
gotcha The function may raise a `ValueError` if the input text is empty or too short (< 50 characters).
fix Ensure input is a non-empty string of significant length. Check result is not None.
gotcha Pre-built wheels are only available for x86_64 Linux, Windows, and macOS. On other platforms (e.g., ARM Linux), pip will try to build from source, requiring Rust toolchain.
fix Install Rust via rustup, then retry. Alternatively, use a platform with pre-built wheel.

Detect license from a text string.

from pyaskalono import detect_license

license_text = """MIT License
Copyright (c) 2021
Permission is hereby granted...
"""
result = detect_license(license_text)
print(result.spdx_id)  # e.g., 'MIT'