Skip to main content

Base58UUID (Python版)

UUIDをBase58エンコード/デコードするPythonライブラリです。短く、URLセーフな文字列としてUUIDを表現できます。

インストール

pipを使用してインストールできます:

pip install base58uuid

必要条件

  • Python 3.7以上

使用方法

基本的な使い方

from base58uuid import Base58UUID

# 新しいUUIDを生成
b58 = Base58UUID()
uuid = b58.get_uuid()  # 例: "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"

# 既存のUUIDをBase58エンコード
b58 = Base58UUID('f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf')
encoded = b58.encode()  # 例: "XDY9dmBbcMBXqcRvYw8xJ2"

# Base58文字列をUUIDにデコード
decoded = b58.decode('XDY9dmBbcMBXqcRvYw8xJ2')  # 元のUUIDに戻る

エラーハンドリング

try:
    # 無効なUUID形式
    b58 = Base58UUID('invalid-uuid')
except ValueError as e:
    # "Invalid UUID format" エラー
    pass

try:
    # 無効なBase58文字列
    b58 = Base58UUID()
    b58.decode('invalid')
except ValueError as e:
    # "Invalid Base58 character" エラー
    pass

開発

セットアップ

# 仮想環境の作成と有効化
python -m venv venv
source venv/bin/activate  # Linuxの場合
# または
.\venv\Scripts\activate  # Windowsの場合

# 依存関係のインストール
pip install -e ".[dev]"

# テストの実行
pytest tests/

テスト

以下のテストケースが含まれています:

  • 既知のUUIDのエンコード
  • ハイフンなしUUIDのエンコード
  • Base58文字列のデコード
  • 無効な入力のエラーハンドリング
  • エンコード/デコードの一貫性
  • 複数回エンコードの結果の一貫性

ライセンス

MITライセンスの下で公開されています。詳細はLICENSEファイルを参照してください。

貢献

  1. このリポジトリをフォーク
  2. 新しいブランチを作成 (git checkout -b feature/amazing-feature)
  3. 変更をコミット (git commit -m 'Add some amazing feature')
  4. ブランチにプッシュ (git push origin feature/amazing-feature)
  5. プルリクエストを作成

作者

  • Yoshitake Hatada (@htpboost)

Metadata

Release files for base58uuid 0.1.0

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

Source distribution (sdist)

Source distribution for base58uuid 0.1.0
File Size Uploaded Provenance
base58uuid-0.1.0.tar.gz 6.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 11.8 kB

Release files / base58uuid-0.1.0.tar.gz

Download URL base58uuid-0.1.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
de25d3cebfd9fee26781f09165076f87c4bae6d34107ebdc5afdcb6e5a406dc2
BLAKE2b-256 checksum
How to use checksums
17da40ab32119ca91dca3e35d0d744f20fcdfd75ea53e82f1c8d870311ac935b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / base58uuid-0.1.0-py3-none-any.whl

Download URL base58uuid-0.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
141458a7dcaef7161bfacb9e11ac1ace1bb1db19395d0692fbef358afbe5ccd6
BLAKE2b-256 checksum
How to use checksums
e3bf5c6b9a9aff101e986a5ebd5832191aa21c7a2fca452171d2547039cacc77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for base58uuid 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 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