nvbn/py-backwards is one of the server-side repositories TopGit tracks, currently at 313 stars, written primarily in Python. Python to python compiler that allows you to use Python 3.6 features in older versions.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
First of all, you need to inherit from BaseTransformer, BaseNodeTransformer (if you want to use
NodeTransfromer interface),
or BaseImportRewrite (if you want just to change import).
If you use BaseTransformer, override class method def transform(cls, tree: ast.AST) -> TransformationResult, like:
from ..types import TransformationResult
from .base import BaseTransformer
class MyTransformer(BaseTransformer):
@classmethod
def transform(cls, tree: ast.AST) -> TransformationResult:
return TransformationResult(tree=tree,
tree_changed=True,
dependencies=[])
If you use BaseNodeTransformer, override visit_* methods, for simplification this class
have a whole tree in self._tree, you should also set self._tree_changed = True if the tree
was changed:
from .base import BaseNodeTransformer
class MyTransformer(BaseNodeTransformer):
dependencies = [] # additional dependencies
def visit_FunctionDef(self, node: ast.FunctionDef) -> ast.FunctionDef:
self._tree_changed = True # Mark that transformer changed tree
return self.generic_visit(node)
If you use BaseImportRewrite, just override rewrites, like:
from .base import BaseImportRewrite
class MyTransformer(BaseImportRewrite):
dependencies = ['pathlib2']
rewrites = [('pathlib', 'pathlib2')]
After that you need to add your transformer to transformers.__init__.transformers.
It's hard to write code in AST, because of that we have snippets:
from ..utils.snippet import snippet, let, extend
@snippet
def my_snippet(class_name, class_body):
class class_name: # will be replaced with `class_name`
extend(class_body) # body of the class will be extended with `class_body`
def fn(self):
let(x) # x will be replaced everywhere with unique name, like `_py_backwards_x_1`
x = 10
return x
No homepage URL was recorded for nvbn/py-backwards in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
How active is development on nvbn/py-backwards?
The most recent commit recorded on nvbn/py-backwards was 5.7 years ago, based on the GitHub push timestamp. The repository has 17 forks — one of the better signals of community interest.
Is nvbn/py-backwards open source?
TopGit's metadata for nvbn/py-backwards does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
What topics is nvbn/py-backwards associated with?
GitHub's repository topics for nvbn/py-backwards: "compiler", "python". TopGit's editorial category is Backend.
Where do I read more about nvbn/py-backwards?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/nvbn/py-backwards is the definitive source.
Read full README in the tab above.
Still deciding about py-backwards?
One click hands the question to an AI along with this page — see what it says about py-backwards.