Skip to content

YarynaRachkevych1/python-logo

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

python-logo

Python Logo interpreter with frontend made in Svelte.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License

About The Project

python-logo screenshot

This project is created for the Innovative Projects by Nokia subject on UWR studies. It features a Logo language interpreter, a Flask backend and a Svelte frontend.

Features

  • Logo parser using Lark.
  • Custom interpreter for Logo commands.
  • Frontend made in Svelte.

(back to top)

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

Make sure you have the following installed:

  • Python: Version 3.10 or higher
  • Node.js (optional, for web application): Version 18 or higher
  • Poetry (optional): For dependency management

Installation

You can install the project in two ways: using pip or poetry.

Using pip

  1. Clone the repository:

    git clone https://github.com/YarynaRachkevych1/python-logo.git
    cd python-logo
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate
  3. Install the project with dependencies:

    pip install .

Using Poetry

  1. Clone the repository:

    git clone https://github.com/YarynaRachkevych1/python-logo.git
    cd python-logo
  2. Install the project with dependencies:

    poetry install

(back to top)

Usage

You can use the project in two ways: as a Python module or as a web application. For more information about the frontend, see the frontend/README.md file.

As a Python module

import python_logo

sample_code = "fd 10 bk 20"

# Generate commands to execute them one by one.
logo_runner = python_logo.run(sample_code)
for command in logo_runner:
    print(command)
    # {'command': 'forward', 'value': 10}
    # {'command': 'backward', 'value': 20}

# Or get them all at once.
logo_runner = python_logo.run(sample_code)
commands = list(logo_runner)
print(commands)
# [{'command': 'forward', 'value': 10}, {'command': 'backward', 'value': 20}]

As a web application

  1. Build the frontend:

    npm install --prefix frontend/
    npm run build --prefix frontend/
  2. Run the application:

    python app.py  # Using pip
    poetry run python app.py  # Using Poetry

(back to top)

Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Before commiting, please ensure you've installed pre-commit hooks:

pre-commit install
pre-commit install --hook-type commit-msg

Top contributors:

contrib.rocks image

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5