Metadata-Version: 2.4
Name: py3logo
Version: 0.8.0
Summary: A Logo interpreter written in Python 3
Author-email: Ian Bicking <ianb@colorstudy.com>
Maintainer-email: Chuck Finch <chuckcodes4cash@gmail.com>
License: MIT
Keywords: logo,interpreter,education,programming,learning
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Logo
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Education
Classifier: Topic :: Software Development :: Interpreters
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# Py3Logo

[![Python Version](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Py3Logo is a Logo interpreter written in Python 3, based on the UCBLogo dialect. Logo is an educational programming language designed for children and beginners, emphasizing simplicity and accessibility.

## Features

- **Complete Logo Implementation**: Based on UCBLogo with most primitives implemented
- **Python 3 Native**: Fully migrated to Python 3.7+
- **Easy Python Integration**: Write Logo primitives in Python and call Python from Logo
- **Turtle Graphics**: Built-in turtle graphics with Tkinter GUI
- **Multi-threading Support**: Run multiple Logo processes simultaneously
- **Interactive & Scripted**: Use as REPL or run Logo script files
- **Educational Focus**: Perfect for teaching programming concepts

## Installation

### From PyPI (recommended)

```bash
pip install py3logo
```

That's it - console/scripted use, embedding Py3Logo as a library, and
the turtle-graphics GUI all work out of the box, no extras needed. The
GUI is built on stdlib `tkinter`, which ships with most Python installs;
on Debian/Ubuntu, install it separately if needed with
`sudo apt install python3-tk`.

### From Source

```bash
cd py3logo  # this repository
pip install -e .
```

(Not yet published to a public repository — clone/copy this directory
directly for now.)

## Quick Start

### Interactive Mode

Start the Logo interpreter:

```bash
py3logo
```

This launches the turtle-graphics GUI - a basic editor/console/REPL/
turtle-canvas window, intentionally kept simple (for a fuller-featured
Logo IDE built on Py3Logo, see the separate CLASP project). If `tkinter`
isn't available, it prints a short notice and falls back to console mode
automatically. To always use console mode regardless of whether the GUI
is available:

```bash
py3logo --console
```

### Running Logo Scripts

```bash
py3logo examples/squares.logo
```

Or from Python:

```bash
python3 -m py3logo.script examples/squares.logo
```

### Using as a Python Module

```python
from py3logo import Logo

# Execute Logo code
Logo.run("repeat 4 [fd 100 rt 90]")

# Define and call Logo functions
Logo.run("""
to square :size
  repeat 4 [fd :size rt 90]
end
""")
Logo.run("square 50")
```

## Example Logo Code

```logo
; Draw a square
to square :size
  repeat 4 [
    fd :size
    rt 90
  ]
end

square 100

; Recursive spiral
to spiral :size
  if :size > 100 [stop]
  fd :size
  rt 90
  spiral :size + 5
end

spiral 0
```

## Documentation

Full documentation can be found in the `docs/` directory:
- [Py3Logo Manual](docs/PyLogo.md) - Complete language reference
- [Logo Language Description](docs/LogoLanguage.md) - Language overview
- [UCBLogo Manual](http://www.cs.berkeley.edu/~bh/usermanual) - Original UCBLogo reference

## Requirements

- Python 3.7 or higher
- `tkinter`, only if you want the turtle-graphics GUI (usually included
  with Python already; on Debian/Ubuntu, `sudo apt install python3-tk`
  if it's missing) — not required for console/scripted use

## Development

### Installing Development Dependencies

```bash
pip install -e ".[dev]"
```

### Building Distribution

```bash
python -m build
```

### Running Tests

```bash
pytest
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Credits

- **Original Author**: Ian Bicking
- **Based on**: [UCBLogo](http://www.cs.berkeley.edu/~bh/logo.html) by Brian Harvey

## Contributing

Contributions are welcome! There is no public repository yet, so for now,
reach out directly rather than filing a pull request.

## Links

- **Documentation**: [docs/](docs/)
- **Examples**: [examples/](examples/)
