https://github.com/exercism/python-representer
https://github.com/exercism/python-representer
community-contributions-paused exercism-representer exercism-tooling maintained-autonomous
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/exercism/python-representer
- Owner: exercism
- License: agpl-3.0
- Created: 2019-11-21T12:29:08.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-09-05T06:54:20.000Z (over 1 year ago)
- Last Synced: 2025-04-29T06:23:14.104Z (8 months ago)
- Topics: community-contributions-paused, exercism-representer, exercism-tooling, maintained-autonomous
- Language: Python
- Size: 1.28 MB
- Stars: 6
- Watchers: 10
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Exercism Python Representer
An [automated analysis][analysis] tool that parses a Python file to create a normalized `representation.txt` file per the [representer interface][interface].
# Creating A Representation
The Representer is run with `./bin/run.sh` `` `` and will read the source code from `` and write a representation to``.
For example:
```bash
./bin/run.sh two_fer ~/solution-238382y7sds7fsadfasj23j/ ~/solution-238382y7sds7fsadfasj23j/output/
```
**Please Note**: When using the `run-in-docker.sh` script, the paths `` and `` need to be _**relative**_ to the location of this repo in your local environment.
For example:
```bash
./bin/run-in-docker.sh acronym ../python/exercises/practice/acronym/ ../python/exercises/practice/acronym/
```
Either of these commands/methods should produce the following three files in ``:
1. `mapping.json`, which maps the variable names to their placeholder values.
2. `representation.out` - an AST representation of the solution code.
3. `representation.txt` - the transformed solution code with placeholders.
# Running the Tests for the Representer
To run all of the current tests:
1. Ensure you have a copy of `pytest 7.2.2` installed globally, or in a virtual env.
2. Ensure you have Python 3.11.2 installed globally, or in a virtual env.
3. Open a terminal in the root of your local copy of this project.
4. Run `pytest` or `pytest -v`
[analysis]: https://github.com/exercism/automated-analysis
[interface]: https://github.com/exercism/automated-analysis/blob/master/docs/representers/interface.md