Skip to main content

ucd Module

Summary

A wrapper module around the Unicode Character Database which dynamically caches the latest data, compresses and gives access to nearly all the UCD data

This module contains most of the ucd information for every character in Unicode.

Usage

    from ucdinfo import get_ucd, get_info, find_ucd, get_enums
    print(get_ucd(0x0041, 'scx'))
    print(get_info(0x0041))
    print(get_enums("indic position"))
    print(find_ucd("indic position", "Bottom")

Note cjk properties are not supported for space reasons.

If you want to use your own data file (perhaps the module data is stale) the use the object interface:

    from ucdinfo import UCD
    myucd = UCD(localfile="ucd.nounihan.flat.zip")   # localfile falls back to bundled data
    print(myucd.get(0x0041, 'scx'))

The second parameter specifies the property to be queried and can either be a property from https://www.unicode.org/reports/tr42, especially section 4.4 Properties, or the start of a full property name from that list.

For characters not yet in Unicode, data for additional characters can be temporarily appended to the bundled data:

    from ucdinfo import get_ucd, loadxml
    loadxml("extra-ucd.xml")

or, with the object interface:

    from ucdinfo import UCD
    myucd = UCD().loadxml("extra-ucd.xml")

The named file must be coded in the same form as the "flat" UCD XML data, though the only required character attributes are "cp" and anything needed by the calling process. For example:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <ucd xmlns="http://www.unicode.org/ns/2003/ucd/1.0">
        <description>Some additional characters</description>
        <repertoire>
            <char cp="10EC2" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER DAL WITH TWO DOTS VERTICALLY BELOW"></char>
            <char cp="10EC3" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER TAH WITH TWO DOTS VERTICALLY BELOW"></char>
            <char cp="10EC4" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER KAF WITH TWO DOTS VERTICALLY BELOW"></char>
        </repertoire>
    </ucd>

Metadata

Release files for ucdinfo 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ucdinfo 0.2
File Size Uploaded Provenance Actions
ucdinfo-0.2.tar.gz 13.6 kB Without provenance Details for ucdinfo-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ucdinfo 0.2
File Interpreter ABI Platform Actions
ucdinfo-0.2-py3-none-any.whl Python 3 none any Details for ucdinfo-0.2-py3-none-any.whl

Total release size: 299.6 kB

Release files / ucdinfo-0.2.tar.gz

Download URL ucdinfo-0.2.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c983c931ded2404a29e069cbb13bba150dcc86a4d7e0ea4d8056b1d81a8712d5
BLAKE2b-256 checksum
How to use checksums
63e96d6585b538138f5aa3bb87ef0105d432218cb6200e88fdfdcfab3b494740
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / ucdinfo-0.2-py3-none-any.whl

Download URL ucdinfo-0.2-py3-none-any.whl
Size 286.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e74b71d6e6edab9fd5137021ee2c428b6721bc87fd95dedafb7da073cc4886de
BLAKE2b-256 checksum
How to use checksums
cfaa325b271a892a548b4c1722d27e3c0cfbe3a73d3c8da269526337c426d915
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for ucdinfo 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page