The repository contains examples of using the fun-with-ast library.
We assume you use python > 3.6
- Create an empty directory: e.g.,
mkdir ~/example_fun_with_ast
- Change directory into the new directory:
cd ~/example_fun_with_ast
- Create and activate a virtual environment:
- Create a virtual environment:
python3 -m venv environment
- Activate the virtual environment:
source environment/bin/activate
- Create a virtual environment:
- Download the test-fun-with-ast project:
git clone https://github.com/shairubin/test-fun-with-ast
- Install the fun-with-ast library:
pip install fun-with-ast
- Run the example rewrite programs:
cd test-fun-with-ast/source_manipulation_examples/
PYTHONPATH=../ python rewrite_if_examples.py
PYTHONPATH=../ python swap_if_else_examples.py
- Run the example source match programs
cd ../preserve_source_examples
PYTHONPATH=../ python source_code_preserve_tests.py
- Deactivate the virtual environment:
deactivate
- Optional: delete the directory:
rm -rf ~/example_fun_with_ast
- See open issues - or open a new one.
- Have fun.