Skip to main content

grikod2 (Grikod, Gri Kod, Gray Code, GrayCode): binary ↔ grikod


DOI

WorkflowHub DOI

Anaconda-Server Badge Anaconda-Server Badge Anaconda-Server Badge Anaconda-Server Badge Open Source MIT License

Python CI codecov Documentation Status Binder PyPI version PyPI Downloads Linted with Ruff


PyPI PyPI version
Conda conda-forge version
DOI DOI
License: MIT License


A Python library for converting binary numbers to Gray Code with ease.


Tanım (Türkçe)

Gri Kod: grikod2 İkili sayıları Gri Koda çevirir.

Description (English)

Gri Kod: grikod2 converts binary numbers to Gray Code.


Kurulum (Türkçe) / Installation (English)

Python ile Kurulum / Install with pip, conda, mamba

pip install grikod2 -U
python -m pip install -U grikod2
conda install bilgi::grikod2 -y
mamba install bilgi::grikod2 -y
- pip uninstall grikod2 -y
+ pip install -U grikod2
+ python -m pip install -U grikod2

PyPI

Test Kurulumu / Test Installation

pip install -i https://test.pypi.org/simple/ grikod2 -U

Github Master Kurulumu / GitHub Master Installation

Terminal:

pip install git+https://github.com/KuantumBS/grikod2.git

Jupyter Lab, Notebook, Visual Studio Code:

!pip install git+https://github.com/KuantumBS/grikod2.git
# or
%pip install git+https://github.com/KuantumBS/grikod2.git

Kullanım (Türkçe) / Usage (English)

import grikod2
grikod2.__version__
import grikod2
grikod2.ikili_2_gri_kod("1010")
import grikod2

def main():
    # Binary numbers: ikili sayılar
    binary_numbers = ["0", "1", "10", "11", "100", "101", "1111"]

    for binary in binary_numbers:
        try:
            gray_code = grikod2.ikili_2_gri_kod(binary)
            print(f"Binary: İkili: {binary} -> Gri Kod: {gray_code}")
        except grikod2.InvalidBinaryError as e:
            print(f"İkili: {binary} -> Hata: {e}")

if __name__ == "__main__":
    main()
Binary: İkili: 0 -> Gri Kod: 0
Binary: İkili: 1 -> Gri Kod: 1
Binary: İkili: 10 -> Gri Kod: 11
Binary: İkili: 11 -> Gri Kod: 10
Binary: İkili: 100 -> Gri Kod: 110
Binary: İkili: 101 -> Gri Kod: 111
Binary: İkili: 1111 -> Gri Kod: 1000


#Input: 100
#Output example
#000:000
#001:001
#010:011
#011:010
#100:110
#101:111
#110:101
#111:100
import grikod2

def main():
    print("🌟 Gri Kod Dönüştürücü - grikod2 Paketi ile")
    print("Geçerli bir ikili sayı girin (örneğin: 1101)")
    print("Çıkmak için 'q' yazın.\n")

    while True:
        user_input = input("İkili sayı: ").strip()

        if user_input.lower() == 'q':
            print("👋 Çıkılıyor. İyi günler!")
            break

        try:
            gray_code = grikod2.ikili_2_gri_kod(user_input)
            print(f"✅ Gri Kod: {gray_code}\n")
        except grikod2.InvalidBinaryError as e:
            print(f"❌ Giriş Hatası: {e}\n")
        except Exception as e:
            print(f"⚠️ Beklenmeyen hata: {e}\n")

if __name__ == "__main__":
    main()
import grikod2

if __name__ == "__main__":
    print("🚀 GriKod2 Etkileşimli Moduna Hoş Geldiniz!")
    grikod2.run_interactive_converter()

Development

# Clone the repository
git clone https://github.com/KuantumBS/grikod2.git
cd grikod2

# Install in development mode
python -m pip install -ve . # Install package in development mode

# Run tests
pytest

Notebook, Jupyterlab, Colab, Visual Studio Code
!python -m pip install git+https://github.com/KuantumBS/grikod2.git

Citation

If this library was useful to you in your research, please cite us. Following the GitHub citation standards, here is the recommended citation.

BibTeX

APA

Keçeci, M. (2025). Grikod2 [Data set]. WorkflowHub. https://doi.org/10.48546/workflowhub.datafile.13.1

Keçeci, M. (2025). Grikod2. GitHub, PYPI, Anaconda, Zenodo. https://doi.org/10.5281/zenodo.15352206

Chicago

Keçeci, Mehmet. Grikod2 [Data set]. WorkflowHub. https://doi.org/10.48546/workflowhub.datafile.13.1

Keçeci, Mehmet. "Grikod2". Zenodo, 06 Mayıs 2025. https://doi.org/10.5281/zenodo.15352206

Lisans (Türkçe) / License (English)

This project is licensed under the MIT License.

FOSSA Status

Pixi:

Pixi

pixi init grikod2

cd grikod2

pixi workspace channel add https://repo.prefix.dev/bilgi --prepend

✔ Added https://repo.prefix.dev/bilgi

pixi add grikod2

✔ Added grikod2 >=1.1.4,<2

pixi install

pixi shell

pixi run python -c "import grikod2; print(grikod2.version)"

Çıktı: 1.1.4

pixi remove grikod2

conda install -c https://prefix.dev/bilgi grikod2

pixi run python -c "import grikod2; print(grikod2.version)"

Çıktı: 1.1.4

pixi run pip list | grep grikod2

grikod2 1.1.4

pixi run pip show grikod2

Name: grikod2

Version: 1.1.4

Summary: Converts binary numbers to Gray Code. Grikod2 (Gray Code, Grey Code)

Home-page: https://github.com/KuantumBS/grikod2

Author: Mehmet Keçeci

Author-email: Mehmet Keçeci <...>

License: MIT License

Copyright (c) 2025 Mehmet Keçeci

Metadata

Release files for grikod2 1.1.6

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

Source distribution (sdist)

Source distribution for grikod2 1.1.6
File Size Uploaded
grikod2-1.1.6.tar.gz 8.5 kB Details

Built distribution (wheel)

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

Total release size: 15.7 kB

Release files / grikod2-1.1.6.tar.gz

Download URL grikod2-1.1.6.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
eccf136ec09719c3027f2c76527d09982285779e559a942b82b85b64f38b8588
BLAKE2b-256 checksum
How to use checksums
d289ec5ea775e70438ed9a0ee6b3111729597ff53138147bf0709a78d51097a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / grikod2-1.1.6-py3-none-any.whl

Download URL grikod2-1.1.6-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b90d2a0855012da4a6a2f01b47d7684d77a0cfd5d11dbb4ba4c0970ddbfb7e92
BLAKE2b-256 checksum
How to use checksums
c9d547f8a9300cd15768c9e8f823ec4efde40c9e5300c08c4e340288d095fa97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.6 This release

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

0.1.5

2 release files

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