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.8.tar.gz
(4.7 kB
view details)
Built Distribution
File details
Details for the file compatibilityer-0.3.8.tar.gz
.
File metadata
- Download URL: compatibilityer-0.3.8.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.0rc2 Linux/5.15.0-52-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
0d7ee77e141af8a228dd39286c1657598498434d7515e51a5f114943982d610a
|
|
MD5 |
751457a612293214d5b855662cc43d40
|
|
BLAKE2b-256 |
3090b7294130976d7a8da70deae590dd0a3f70bbc12f3fbf5b8862c95f1feba2
|
File details
Details for the file compatibilityer-0.3.8-py3-none-any.whl
.
File metadata
- Download URL: compatibilityer-0.3.8-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.0rc2 Linux/5.15.0-52-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
fc91b247d27f713024b7dedd62d53ba71c20a2604827c404293db10b6ef5300e
|
|
MD5 |
c847fa113ba5f9eed1934c406fb90cd9
|
|
BLAKE2b-256 |
5d139d9c811b37f2535880851219bae0d4290e99b628adba53169ef62a393441
|