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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for compatibilityer-0.3.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59f837cb22162bd409b894f5c0dfd4d3712056092ba4e3b2445c68b6a35fd4f1 |
|
MD5 | e80b29b23ddc4b9876026b9fc48950d2 |
|
BLAKE2b-256 | d5b34662a379bd9e63081d06a748c82f4260b7ba1efd152336330cfb84de9e10 |