| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Interactive command-line tool for creating and managing geometric shapes. Built with clean architecture.
Shape Management:
Persistent Storage:
Clean Architecture:
Enterprise Logging:
Production Ready:
# Clone the repository
git clone https://github.com/script-logic/vector-editor-cli.git
cd vector-editor-cli
# Install with uv
uv venv
uv pip install -e .# Start interactive CLI
uv run python main.py
# Using Docker
docker-compose up
# Using Makefile
make run├── database/ # Persistent storage (JSON files) │ └── shapes.json # Default shape file ├── logs/ # Application logs ├── src/ │ └── vector_editor/ │ ├── application/ # Application layer │ │ └── services/ # ShapeService (use cases) │ ├── cli/ # CLI interface │ │ ├── app.py # Click commands │ │ └── formatting.py # Console output │ ├── config/ # Configuration │ │ └── config.py # Pydantic settings │ ├── domain/ # Core business logic │ │ ├── definitions/ # Shape definitions │ │ ├── geometry/ # Geometric representations │ │ ├── interfaces/ # Repository protocol │ │ ├── primitives/ # Coordinates, Transform │ │ └── placed_shape.py # Shape with ID & transform │ ├── infrastructure/ # External concerns │ │ ├── repositories/ # InMemoryShapeRepository │ │ └── serialization.py # JSON serialization │ ├── logger/ # Structured logging system │ └── utils/ # Helpers (Singleton) ├── tests/ # Unit tests ├── main.py # Entry point ├── pyproject.toml # Project configuration ├── docker-compose.yml # Docker setup └── Makefile # Development tasks
| Command | Description | Example |
|---|---|---|
| point <x> <y> [--angle <degrees>] | Create a point | point 10.5 -20 --angle 45 |
| line <start_x> <start_y> <end_x> <end_y> [--angle <degrees>] | Create a line from coordinates | line 0 0 10 10 |
| line-polar <start_x> <start_y> <length> <angle_degrees> [--angle <additional_degrees>] | Create a line by polar method | line 0 0 10 60 |
| circle <center_x> <center_y> <radius> [--angle <degrees>] | Create a circle | circle 5 -5 3 |
| square <center_x> <center_y> <side_size> [--angle <degrees>] | Create a square | square 1 1 4 -a 45 |
| rectangle <center_x> <center_y> <width> <height> [--angle <degrees>] | Create a rectangle | rectangle 2 3 4 5 |
| ellipse <center_x> <center_y> <radius_x> <radius_y> [--angle <degrees>]" | Create an ellipse | ellipse 3 4 2 3 |
| list | List all shapes | list |
| delete <id> | Delete shape by ID | delete 123e4567 |
| clear | Delete all shapes | clear |
| count | Show total shapes | count |
| save [<filename>] | Save shapes to file | save my_shapes.json |
| load [<filename>] | Load shapes from file | load my_shapes.json |
| help [command] | Show help | help circle |
| q, quit, exit | Exit CLI | q |
This design ensures you never lose data unintentionally and have full control over merging.
A sophisticated, production-ready logging system built with structlog.
Via config.py or .env(optional):
LoggingConfig(
debug=True, # False for JSON output
app_name="Vector Editor",
log_level="INFO",
enable_file_logging=False,
)
FileSystem(
db_dir=Path("database"),
db_json_file_name="shapes.json",
logs_dir=Path("logs"),
logs_file_name="app.log",
max_log_file_size_mb=10,
log_backup_count=5,
)# Install with dev dependencies
uv pip install -e . --group dev
# Activate venv
source .venv/bin/activate # or .venv\Scripts\activate
# Install pre-commit hooks
pre-commit install
# Run tests
make test
# Run linter
make lint
# Fix formatting
make fix
# Clean cache
make clean# Build and run
make docker-run
# Rebuild
make docker-rebuild
# Or manually
docker-compose run --rm vector-editor
docker-compose down# Run all tests
uv run pytest
# With coverage
uv run pytest --cov=src --cov-report=html
# Specific test
uv run pytest tests/unit/cli/test_cli.pyMIT License – free to use and modify.
Интерактивный инструмент командной строки для создания и управления геометрическими фигурами. Построен на принципах чистой архитектуры.
Управление фигурами:
Постоянное хранилище:
Чистая архитектура:
Промышленное логирование:
Готовность к продакшену:
# Клонировать репозиторий
git clone https://github.com/script-logic/vector-editor-cli.git
cd vector-editor-cli
# Установка с помощью uv
uv venv
uv pip install -e .# Запуск интерактивного CLI
uv run python main.py
# С использованием Docker
docker-compose up
# С использованием Makefile
make run├── database/ # Постоянное хранилище (JSON-файлы) │ └── shapes.json # Файл хранения по умолчанию ├── logs/ # Логи приложения ├── src/ │ └── vector_editor/ │ ├── application/ # Слой приложения │ │ └── services/ # ShapeService │ ├── cli/ # Интерфейс командной строки │ │ ├── app.py # Команды Click │ │ └── formatting.py # Вывод в консоль │ ├── config/ # Конфигурация │ │ └── config.py # Настройки Pydantic │ ├── domain/ # Основная бизнес-логика │ │ ├── definitions/ # Определения фигур │ │ ├── geometry/ # Геометрические представления │ │ ├── interfaces/ # Протокол репозитория │ │ ├── primitives/ # Координаты, трансформация │ │ └── placed_shape.py # Фигура с ID и трансформацией │ ├── infrastructure/ # Внешние зависимости │ │ ├── repositories/ # InMemoryShapeRepository │ │ └── serialization.py # JSON-сериализация │ ├── logger/ # Система структурированного логирования │ └── utils/ # Вспомогательные утилиты (Singleton) ├── tests/ # Модульные тесты ├── main.py # Точка входа ├── pyproject.toml # Метаданные проекта ├── docker-compose.yml # Настройки Docker └── Makefile # Задачи разработки
| Команда | Описание | Пример |
|---|---|---|
| point <x> <y> [--angle <degrees>] | Создать точку | point 10.5 -20 --angle 45 |
| line <start_x> <start_y> <end_x> <end_y> [--angle <degrees>] | Создать линию по координатам | line 0 0 10 10 |
| line-polar <start_x> <start_y> <length> <angle_degrees> [--angle <additional_degrees>] | Создать линию полярным методом | line 0 0 10 60 |
| circle <center_x> <center_y> <radius> [--angle <degrees>] | Создать круг | circle 5 -5 3 |
| square <center_x> <center_y> <side_size> [--angle <degrees>] | Создать квадрат | square 1 1 4 -a 45 |
| rectangle <center_x> <center_y> <width> <height> [--angle <degrees>] | Создать прямоугольник | rectangle 2 3 4 5 |
| ellipse <center_x> <center_y> <radius_x> <radius_y> [--angle <degrees>]" | Создать эллипс | ellipse 3 4 2 3 |
| list | Показать все фигуры | list |
| delete <id> | Удалить фигуру по ID | delete 123e4567 |
| clear | Удалить все фигуры | clear |
| count | Показать общее количество фигур | count |
| save [<filename>] | Сохранить фигуры в файл | save my_shapes.json |
| load [<filename>] | Загрузить фигуры из файла | load my_shapes.json |
| help [command] | Показать справку | help circle |
| q, quit, exit | Выйти из CLI | q |
Такое поведение гарантирует, что вы никогда не потеряете данные случайно и сохраняете полный контроль над слиянием.
Сложная, готовая к продакшену система логирования на базе structlog.
Через config.py или .env (опционально):
LoggingConfig(
debug=True, # False для JSON-вывода
app_name="Vector Editor",
log_level="INFO",
enable_file_logging=False,
)
FileSystem(
db_dir=Path("database"),
db_json_file_name="shapes.json",
logs_dir=Path("logs"),
logs_file_name="app.log",
max_log_file_size_mb=10,
log_backup_count=5,
)# Установка с dev-зависимостями
uv pip install -e . --group dev
# Активировать виртуальное окружение
source .venv/bin/activate # или .venv\Scripts\activate
# Установить pre-commit хуки
pre-commit install
# Запустить тесты
make test
# Запустить линтер
make lint
# Исправить форматирование
make fix
# Очистить кеш
make clean# Собрать и запустить
make docker-run
# Пересобрать
make docker-rebuild
# Или вручную
docker-compose run --rm vector-editor
docker-compose down# Запустить все тесты
uv run pytest
# С отчётом о покрытии
uv run pytest --cov=src --cov-report=html
# Конкретный тест
uv run pytest tests/unit/cli/test_cli.pyЛицензия MIT – можно свободно использовать и модифицировать.
| Back | FazBrowse Home | New Git URL |