Tool to convert Python code to work with older versions
Project description
Python3.11などの新しいバージョンのコードを、古いバージョンで動作するように変換するツールです。
あくまでも動作するように小手先の変換を施すだけであって、複雑なパターンの変換や厳密な等価性が必要な場合には使用できません。 また、当然ですが可読性はある程度失われます。
具体的には、以下のような変換を行います。
- 代入や関数定義の型アノテーションを文字列リテラルに置き換える
- 旧バージョンに存在しない要素の
from typing import
を削除する alias: TypeAlias = SomeType
という形のTypeAlias
の定義をする代入文の右辺を文字列リテラルに置き換える- match文をif文に変換する(複雑なものには未対応)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
compatibilityer-0.3.6.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for compatibilityer-0.3.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0224f490d439138020f4c8137bd0acf66b8473bdad03f672a753d4f312e867ef |
|
MD5 | c26df4700c9bf239cd1a5cfc84e9892a |
|
BLAKE2b-256 | 8812b95e2c0fc3aec0319b5348675363f0aace299c8d337a0b9836c7bd21be0e |