--- id: graycode version: "1.0.5" license: unclear license_treatment: permissive maintenance: abandoned --- # graycode — Convert two's complement integer to gray code and vice versa License: permissive · Maintenance: abandoned · Downloads: 97.8K/mo ## What it is and what it does Graycode is a small utility library for converting between standard two's complement integers and gray code (reflected binary code), a binary numeral system where consecutive values differ by exactly one bit. This property makes gray codes useful in applications where bit transitions need to be minimized, such as digital electronics, error correction, and certain optimization problems. The library provides three main functions: conversion from integers to gray code, conversion from gray code back to integers, and generation of all n-bit gray codes in sequence. It has no external dependencies and works with Python 3.5 and later. However, the package has been abandoned since late 2020 and receives no maintenance or updates. Use it for: - Digital circuit design where minimizing bit transitions reduces power consumption or glitches. - Rotary encoder applications where gray code naturally represents mechanical position changes. - Error detection and correction systems that exploit the single-bit-change property. - Algorithm development or teaching that requires gray code sequences or conversions. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts between two's complement integers and gray code (reflected binary code), where successive values differ by only one bit. Yes, if you need gray code conversion for a stable, self-contained use case. The library is small, dependency-free, and has no known vulnerabilities. However, the abandoned maintenance status means no bug fixes or Python version updates are forthcoming—install only if the current functionality meets your needs and you can maintain a local fork if necessary. ## Install pip install graycode uv add graycode poetry add graycode ## Installing graycode Before you install: High install friction due to source distribution format. Package is abandoned (last release November 2020, over 5 years ago) with no maintenance activity, though it has no runtime dependencies. License in practice: MIT license permits commercial and private use with minimal restrictions, requiring only license and copyright notice retention. Quickstart: pip install graycode import graycode # Convert integer to gray code graycode.tc_to_gray_code(5) # Convert gray code back to integer graycode.gray_code_to_tc(0b110) # Generate all n-bit gray codes graycode.gen_gray_codes(3) Requires Python 3.5 or later; source distribution may require a C compiler on some systems. Verify before relying: - Whether the source distribution requires compilation or has platform-specific build requirements. - Current state of the GitLab repository and whether it accepts contributions or bug reports. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: high - Maintenance: abandoned - Downloads: 97.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags gray code conversion, reflected binary code, bit manipulation, integer to gray code, gray code generator, bit-manipulation, encoding [View on SkillFed](https://skillfed.io/packages/graycode) · [View on PyPI](https://pypi.org/project/graycode/)