fastmock-api 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,59 @@
1
+ name: CI Pipeline
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ tags: [ "v*.*.*" ]
7
+ pull_request:
8
+ branches: [ "main" ]
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ build-and-test:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout Code
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Install Dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install hatch
27
+ pip install -e ".[dev]"
28
+
29
+ - name: Run Ruff (Linter & Formatter)
30
+ run: |
31
+ ruff check .
32
+
33
+ - name: Run Pytest
34
+ run: |
35
+ pytest tests/ -v
36
+
37
+ publish:
38
+ name: Publish to PyPI
39
+ needs: build-and-test
40
+ if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - name: Checkout Code
44
+ uses: actions/checkout@v4
45
+
46
+ - name: Set up Python
47
+ uses: actions/setup-python@v5
48
+ with:
49
+ python-version: "3.12"
50
+
51
+ - name: Build package
52
+ run: |
53
+ python -m pip install build
54
+ python -m build
55
+
56
+ - name: Publish to PyPI
57
+ uses: pypa/gh-action-pypi-publish@release/v1
58
+ with:
59
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,19 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ .pytest_cache/
5
+ .coverage
6
+ htmlcov/
7
+ .venv/
8
+ venv/
9
+ env/
10
+ .env
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ build/
14
+ dist/
15
+ *.egg-info/
16
+
17
+ # Local mock specifications
18
+ openapi.yaml
19
+ openapi.json
@@ -0,0 +1,19 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Отключаем создание байт-кода и буферизацию
6
+ ENV PYTHONDONTWRITEBYTECODE=1
7
+ ENV PYTHONUNBUFFERED=1
8
+
9
+ # Установка зависимостей (используем pip, так как pyproject.toml поддерживает PEP 621)
10
+ COPY pyproject.toml README.md ./
11
+ COPY src/ ./src/
12
+
13
+ RUN pip install --no-cache-dir -e .
14
+
15
+ # Ожидается, что пользователь примонтирует openapi.yaml в /app/openapi.yaml
16
+ # или загрузит его через API
17
+ EXPOSE 8000
18
+
19
+ CMD ["fastmock"]
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.5
2
+ Name: fastmock-api
3
+ Version: 0.1.0
4
+ Summary: A lightweight, local Mock server on FastAPI for frontend and mobile teams.
5
+ Requires-Python: >=3.12
6
+ Requires-Dist: faker>=19.0.0
7
+ Requires-Dist: fastapi>=0.100.0
8
+ Requires-Dist: jsonref>=1.1.0
9
+ Requires-Dist: pydantic-settings>=2.0.0
10
+ Requires-Dist: pydantic>=2.0.0
11
+ Requires-Dist: python-multipart>=0.0.9
12
+ Requires-Dist: pyyaml>=6.0
13
+ Requires-Dist: typer>=0.9.0
14
+ Requires-Dist: uvicorn>=0.23.0
15
+ Requires-Dist: websockets>=12.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: httpx; extra == 'dev'
18
+ Requires-Dist: mypy; extra == 'dev'
19
+ Requires-Dist: pytest-asyncio; extra == 'dev'
20
+ Requires-Dist: pytest>=7.0; extra == 'dev'
21
+ Requires-Dist: ruff; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ <div align="right">
25
+ <a href="README_RU.md">🇷🇺 Русский</a> | <b>🇬🇧 English</b>
26
+ </div>
27
+
28
+ # ⚡ FastMock API Engine
29
+
30
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
31
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688.svg?logo=fastapi)](https://fastapi.tiangolo.com)
32
+ [![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?logo=docker&logoColor=white)](https://www.docker.com/)
33
+ [![Build Status](https://github.com/Artem-SPb/fastmock/actions/workflows/ci.yml/badge.svg)](https://github.com/Artem-SPb/fastmock/actions)
34
+
35
+ **FastMock** is a lightweight, local Mock server built on FastAPI. It's designed for frontend and mobile developers who need a reliable, realistic REST API instantly, without waiting for the backend team.
36
+
37
+ ![FastMock Preview](docs/assets/preview.png) *(You can place the generated image here)*
38
+
39
+ ## 🚀 Features at a glance
40
+ 1. **Dynamic OpenAPI Ingestion**: Drop your `openapi.yaml` in the folder or upload via Admin API. The endpoints are generated on the fly.
41
+ 2. **Realistic Payload Generation**: Automatically generates realistic data (names, emails, UUIDs, dates) based on JSON Schema types using `Faker`.
42
+ 3. **In-Memory CRUD**: Remembers what you `POST` and returns it on `GET`.
43
+ 4. **Chaos Engineering**: Simulate slow 3G networks or random server crashes (HTTP 500, 503) globally or per-request using HTTP headers.
44
+
45
+ ## 📖 Detailed Documentation
46
+ For deep-dive instructions, check the full usage guide:
47
+ 👉 **[Read the Full Documentation (English)](docs/USAGE_EN.md)**
48
+
49
+ ## 🛠 Quick Start (Docker)
50
+
51
+ The easiest way to run FastMock is via Docker.
52
+
53
+ 1. Clone the repository:
54
+ ```bash
55
+ git clone https://github.com/Artem-SPb/fastmock.git
56
+ cd fastmock
57
+ ```
58
+ 2. Place your `openapi.yaml` in the root directory (optional).
59
+ 3. Run the container:
60
+ ```bash
61
+ docker compose up
62
+ ```
63
+ 4. Open **http://127.0.0.1:8000/docs** in your browser!
64
+
65
+ ## 👨‍💻 Author
66
+ **Artem-SPb**
67
+ - GitHub: [@Artem-SPb](https://github.com/Artem-SPb)
68
+
69
+ Created as a portfolio project showcasing modern Python architecture, FastAPI ecosystem, and Developer Experience (DX) best practices.
70
+
71
+ *Feel free to star ⭐ this repository if you found it helpful!*
@@ -0,0 +1,48 @@
1
+ <div align="right">
2
+ <a href="README_RU.md">🇷🇺 Русский</a> | <b>🇬🇧 English</b>
3
+ </div>
4
+
5
+ # ⚡ FastMock API Engine
6
+
7
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
8
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688.svg?logo=fastapi)](https://fastapi.tiangolo.com)
9
+ [![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?logo=docker&logoColor=white)](https://www.docker.com/)
10
+ [![Build Status](https://github.com/Artem-SPb/fastmock/actions/workflows/ci.yml/badge.svg)](https://github.com/Artem-SPb/fastmock/actions)
11
+
12
+ **FastMock** is a lightweight, local Mock server built on FastAPI. It's designed for frontend and mobile developers who need a reliable, realistic REST API instantly, without waiting for the backend team.
13
+
14
+ ![FastMock Preview](docs/assets/preview.png) *(You can place the generated image here)*
15
+
16
+ ## 🚀 Features at a glance
17
+ 1. **Dynamic OpenAPI Ingestion**: Drop your `openapi.yaml` in the folder or upload via Admin API. The endpoints are generated on the fly.
18
+ 2. **Realistic Payload Generation**: Automatically generates realistic data (names, emails, UUIDs, dates) based on JSON Schema types using `Faker`.
19
+ 3. **In-Memory CRUD**: Remembers what you `POST` and returns it on `GET`.
20
+ 4. **Chaos Engineering**: Simulate slow 3G networks or random server crashes (HTTP 500, 503) globally or per-request using HTTP headers.
21
+
22
+ ## 📖 Detailed Documentation
23
+ For deep-dive instructions, check the full usage guide:
24
+ 👉 **[Read the Full Documentation (English)](docs/USAGE_EN.md)**
25
+
26
+ ## 🛠 Quick Start (Docker)
27
+
28
+ The easiest way to run FastMock is via Docker.
29
+
30
+ 1. Clone the repository:
31
+ ```bash
32
+ git clone https://github.com/Artem-SPb/fastmock.git
33
+ cd fastmock
34
+ ```
35
+ 2. Place your `openapi.yaml` in the root directory (optional).
36
+ 3. Run the container:
37
+ ```bash
38
+ docker compose up
39
+ ```
40
+ 4. Open **http://127.0.0.1:8000/docs** in your browser!
41
+
42
+ ## 👨‍💻 Author
43
+ **Artem-SPb**
44
+ - GitHub: [@Artem-SPb](https://github.com/Artem-SPb)
45
+
46
+ Created as a portfolio project showcasing modern Python architecture, FastAPI ecosystem, and Developer Experience (DX) best practices.
47
+
48
+ *Feel free to star ⭐ this repository if you found it helpful!*
@@ -0,0 +1,48 @@
1
+ <div align="right">
2
+ <b>🇷🇺 Русский</b> | <a href="README.md">🇬🇧 English</a>
3
+ </div>
4
+
5
+ # ⚡ FastMock API Engine
6
+
7
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
8
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688.svg?logo=fastapi)](https://fastapi.tiangolo.com)
9
+ [![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?logo=docker&logoColor=white)](https://www.docker.com/)
10
+ [![Build Status](https://github.com/Artem-SPb/fastmock/actions/workflows/ci.yml/badge.svg)](https://github.com/Artem-SPb/fastmock/actions)
11
+
12
+ **FastMock** — это легковесный, локальный Mock-сервер на базе FastAPI. Он создан для фронтенд- и мобильных разработчиков, которым нужен работающий, реалистичный REST API "здесь и сейчас", без ожидания бэкенд-команды.
13
+
14
+ ![FastMock Preview](docs/assets/preview.png) *(Здесь будет ваше превью)*
15
+
16
+ ## 🚀 Ключевые возможности
17
+ 1. **Динамическая загрузка OpenAPI**: Просто положите `openapi.yaml` в папку с проектом или загрузите через Admin API, и эндпоинты сгенерируются на лету.
18
+ 2. **Реалистичная генерация данных**: Автоматически создает правдоподобные данные (имена, email, UUID, даты) на основе типов в JSON Schema с помощью библиотеки `Faker`.
19
+ 3. **In-Memory CRUD**: Запоминает данные, которые вы отправляете через `POST`, и возвращает их при `GET` запросах.
20
+ 4. **Chaos Engineering**: Симулируйте медленные 3G-сети или случайные падения сервера (HTTP 500, 503) глобально или для конкретных запросов через HTTP-заголовки.
21
+
22
+ ## 📖 Подробная документация
23
+ Для глубокого погружения и примеров изучите полную инструкцию:
24
+ 👉 **[Читать полную документацию (на русском)](docs/USAGE_RU.md)**
25
+
26
+ ## 🛠 Быстрый старт (Docker)
27
+
28
+ Самый простой способ запустить FastMock — использовать Docker.
29
+
30
+ 1. Склонируйте репозиторий:
31
+ ```bash
32
+ git clone https://github.com/Artem-SPb/fastmock.git
33
+ cd fastmock
34
+ ```
35
+ 2. Положите вашу спецификацию `openapi.yaml` в корень проекта (необязательно).
36
+ 3. Запустите контейнер:
37
+ ```bash
38
+ docker compose up
39
+ ```
40
+ 4. Откройте **http://127.0.0.1:8000/docs** в вашем браузере!
41
+
42
+ ## 👨‍💻 Автор
43
+ **Artem-SPb**
44
+ - GitHub: [@Artem-SPb](https://github.com/Artem-SPb)
45
+
46
+ Создано в качестве портфолио-проекта, демонстрирующего современную архитектуру на Python, работу с экосистемой FastAPI и фокус на Developer Experience (DX).
47
+
48
+ *Если проект оказался полезным, не забудьте поставить звездочку ⭐!*
@@ -0,0 +1,13 @@
1
+ version: '3.8'
2
+
3
+ services:
4
+ fastmock:
5
+ build: .
6
+ ports:
7
+ - "8000:8000"
8
+ volumes:
9
+ # Монтируем файл спецификации (если он есть локально)
10
+ # - ./openapi.yaml:/app/openapi.yaml
11
+ - ./src:/app/src
12
+ environment:
13
+ - DEBUG=1
@@ -0,0 +1,67 @@
1
+ # How to use FastMock (Guide for Frontend & Mobile Developers)
2
+
3
+ If the backend isn't ready yet, but you need to build UI, render lists, handle network errors, or plot real-time charts — **FastMock** will save your time. You don't need to know Python or databases to run it.
4
+
5
+ ---
6
+
7
+ ## 🛠 Step 1: Start the server (Takes 1 minute)
8
+
9
+ You don't need to configure environments. Everything works via Docker.
10
+
11
+ 1. Ensure you have [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed.
12
+ 2. Download this project (or run `git clone`).
13
+ 3. Open a terminal in the project folder and type:
14
+ ```bash
15
+ docker compose up
16
+ ```
17
+ 4. Done! The server is running. Open the dashboard in your browser: **http://127.0.0.1:8000/docs**
18
+
19
+ ---
20
+
21
+ ## 📄 Step 2: Add API Contracts (Swagger)
22
+
23
+ FastMock doesn't know in advance which endpoints your app needs. You have to provide a specification (OpenAPI / Swagger file).
24
+
25
+ 1. Ask your backend developer for the `openapi.yaml` file (or write a simple one yourself).
26
+ 2. Go to the dashboard (http://127.0.0.1:8000/docs).
27
+ 3. Find the green **`POST /_admin/specs`** button, click *Try it out*, select your file, and hit *Execute*.
28
+ 4. **Magic:** The server instantly generates all the endpoints defined in the file!
29
+
30
+ > 💡 **Quick Start:** There is an `openapi.example.yaml` file in the project folder. Just copy it, rename it to `openapi.yaml`, and restart the server. You'll instantly get working `/users` and `/products` endpoints.
31
+
32
+ ---
33
+
34
+ ## 📱 Step 3: Connect your application
35
+
36
+ Now, simply change the base URL in your iOS/Android/Web app's code to `http://127.0.0.1:8000`.
37
+
38
+ ### 🧠 Smart Data Generation
39
+ Make a `GET /users` request from your app. You won't get an empty response. FastMock will generate realistic JSON! If a field is named `email`, it returns a real random email; if it's `id`, it generates a UUID.
40
+
41
+ ### 💾 Data Persistence (Forms)
42
+ Want to test a profile creation form?
43
+ 1. Send a `POST /users` from your app with any JSON (e.g., `{"name": "John"}`).
44
+ 2. Make a `GET /users` request. John will appear in the list!
45
+ The data is saved. *(Note: if you start the server with the `--persist db.json` flag, data is saved to a file that you can edit right in your text editor!)*
46
+
47
+ ---
48
+
49
+ ## 🌩 Step 4: Testing Errors (Chaos Engineering)
50
+
51
+ How will your app behave if the user has a poor 3G connection in the subway, or the backend crashes with a 500 error?
52
+ You don't need to unplug your ethernet cable! Just add Headers to your requests from the app:
53
+
54
+ * `X-Mock-Delay: 2000` — The server will "think" for exactly 2 seconds before responding. Check your loading spinners!
55
+ * `X-Mock-Status: 500` — The server will forcibly return a 500 Server Error. Test your error alerts and fallback screens!
56
+
57
+ ---
58
+
59
+ ## ⏱ Step 5: WebSockets Testing (Real-time)
60
+
61
+ If you're building a chat or a crypto chart, you need WebSockets. FastMock can simulate those too!
62
+
63
+ Connect your app to `ws://127.0.0.1:8000/ws/chat`.
64
+ 1. **Echo:** Send any text, and it comes right back.
65
+ 2. **Data Stream:** Send a special JSON `{"action": "stream", "interval": 1}`, and the server will infinitely stream new generated data to you every second! (Send `{"action": "stop"}` to pause it).
66
+
67
+ Happy coding! 🚀
@@ -0,0 +1,67 @@
1
+ # Как использовать FastMock (Гайд для Фронтенд и Мобайл разработчиков)
2
+
3
+ Если бэкенд еще не готов, а тебе нужно делать UI, выводить списки, обрабатывать ошибки сети или графики — **FastMock** спасет твое время. Тебе не нужно знать Python или базы данных, чтобы запустить его.
4
+
5
+ ---
6
+
7
+ ## 🛠 Шаг 1: Запуск сервера (Занимает 1 минуту)
8
+
9
+ Тебе не нужно настраивать окружение. Всё работает через Docker.
10
+
11
+ 1. Убедись, что у тебя установлен [Docker Desktop](https://www.docker.com/products/docker-desktop/).
12
+ 2. Скачай этот проект (или сделай `git clone`).
13
+ 3. Открой терминал в папке проекта и напиши:
14
+ ```bash
15
+ docker compose up
16
+ ```
17
+ 4. Готово! Сервер запущен. Открой в браузере панель управления: **http://127.0.0.1:8000/docs**
18
+
19
+ ---
20
+
21
+ ## 📄 Шаг 2: Добавляем API контракты (Swagger)
22
+
23
+ FastMock не знает заранее, какие эндпоинты нужны твоему приложению. Ему нужно дать спецификацию (OpenAPI / Swagger файл).
24
+
25
+ 1. Попроси у бэкенд-разработчика файл `openapi.yaml` (или напиши простой сам).
26
+ 2. Зайди в панель управления (http://127.0.0.1:8000/docs).
27
+ 3. Найди зеленую кнопку **`POST /_admin/specs`**, нажми *Try it out*, выбери свой файл и нажми *Execute*.
28
+ 4. **Магия:** Сервер моментально сгенерировал все эндпоинты, которые были в файле!
29
+
30
+ > 💡 **Быстрый старт:** В папке проекта уже лежит файл `openapi.example.yaml`. Просто скопируй его, назови `openapi.yaml` и перезапусти сервер. У тебя сразу появятся эндпоинты `/users` и `/products`.
31
+
32
+ ---
33
+
34
+ ## 📱 Шаг 3: Подключаем твое приложение
35
+
36
+ Теперь в коде твоего iOS/Android/Web приложения просто поменяй базовый URL на `http://127.0.0.1:8000`.
37
+
38
+ ### 🧠 Умная генерация данных
39
+ Сделай запрос `GET /users` из приложения. Тебе не вернется пустота. FastMock сам сгенерирует реалистичный JSON! Если поле называется `email` — он вернет реальный случайный email, если `id` — сгенерирует UUID.
40
+
41
+ ### 💾 Сохранение данных (Формы)
42
+ Хочешь протестировать форму создания профиля?
43
+ 1. Отправь из приложения `POST /users` с любым JSON (например, `{"name": "Иван"}`).
44
+ 2. Сделай `GET /users`. Иван появится в списке!
45
+ Данные сохраняются. *(Примечание: если запустить сервер с флагом `--persist db.json`, то данные сохранятся в файл, который можно редактировать прямо в блокноте!)*
46
+
47
+ ---
48
+
49
+ ## 🌩 Шаг 4: Тестирование ошибок (Chaos Engineering)
50
+
51
+ Как твое приложение поведет себя, если у пользователя плохой интернет в метро (Edge/3G) или бэкенд упал с 500 ошибкой?
52
+ Тебе не нужно выдергивать кабель интернета! Просто добавь заголовки (Headers) к своим запросам из приложения:
53
+
54
+ * `X-Mock-Delay: 2000` — Сервер будет "думать" ровно 2 секунды перед ответом. Проверь свои лоадеры (спиннеры).
55
+ * `X-Mock-Status: 500` — Сервер принудительно вернет 500 ошибку сервера. Проверь алерты и экраны ошибок!
56
+
57
+ ---
58
+
59
+ ## ⏱ Шаг 5: Тестирование WebSockets (Real-time)
60
+
61
+ Если ты делаешь чат или график биржи, тебе нужны вебсокеты. FastMock умеет симулировать и их!
62
+
63
+ Подключись из приложения к `ws://127.0.0.1:8000/ws/chat`.
64
+ 1. **Эхо:** Отправь любой текст, и он вернется обратно.
65
+ 2. **Поток данных (Стриминг):** Отправь специальный JSON `{"action": "stream", "interval": 1}`, и сервер начнет каждую секунду бесконечно присылать тебе новые сгенерированные данные! (Отправь `{"action": "stop"}`, чтобы остановить).
66
+
67
+ Удачной разработки! 🚀
@@ -0,0 +1,120 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: Sample E-Commerce API
4
+ description: Тестовая спецификация для проверки возможностей FastMock API Engine.
5
+ version: 1.0.0
6
+ servers:
7
+ - url: http://localhost:8000
8
+ paths:
9
+ /users:
10
+ get:
11
+ summary: Получить список пользователей
12
+ responses:
13
+ '200':
14
+ description: Успешный ответ
15
+ content:
16
+ application/json:
17
+ schema:
18
+ type: array
19
+ items:
20
+ $ref: '#/components/schemas/User'
21
+ post:
22
+ summary: Создать нового пользователя
23
+ requestBody:
24
+ required: true
25
+ content:
26
+ application/json:
27
+ schema:
28
+ $ref: '#/components/schemas/UserCreate'
29
+ responses:
30
+ '201':
31
+ description: Пользователь создан
32
+ content:
33
+ application/json:
34
+ schema:
35
+ $ref: '#/components/schemas/User'
36
+ /users/{id}:
37
+ get:
38
+ summary: Получить пользователя по ID
39
+ parameters:
40
+ - name: id
41
+ in: path
42
+ required: true
43
+ schema:
44
+ type: string
45
+ format: uuid
46
+ responses:
47
+ '200':
48
+ description: Успешный ответ
49
+ content:
50
+ application/json:
51
+ schema:
52
+ $ref: '#/components/schemas/User'
53
+ /products:
54
+ get:
55
+ summary: Получить список товаров
56
+ responses:
57
+ '200':
58
+ description: Успешный ответ
59
+ content:
60
+ application/json:
61
+ schema:
62
+ type: array
63
+ items:
64
+ $ref: '#/components/schemas/Product'
65
+
66
+ components:
67
+ schemas:
68
+ User:
69
+ type: object
70
+ properties:
71
+ id:
72
+ type: string
73
+ format: uuid
74
+ first_name:
75
+ type: string
76
+ description: Имя пользователя
77
+ last_name:
78
+ type: string
79
+ description: Фамилия пользователя
80
+ email:
81
+ type: string
82
+ format: email
83
+ phone:
84
+ type: string
85
+ created_at:
86
+ type: string
87
+ format: date-time
88
+ required:
89
+ - id
90
+ - first_name
91
+ - email
92
+
93
+ UserCreate:
94
+ type: object
95
+ properties:
96
+ first_name:
97
+ type: string
98
+ last_name:
99
+ type: string
100
+ email:
101
+ type: string
102
+ format: email
103
+ required:
104
+ - first_name
105
+ - email
106
+
107
+ Product:
108
+ type: object
109
+ properties:
110
+ id:
111
+ type: string
112
+ format: uuid
113
+ name:
114
+ type: string
115
+ price:
116
+ type: number
117
+ example: 99.99
118
+ in_stock:
119
+ type: boolean
120
+ example: true
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "fastmock-api"
7
+ version = "0.1.0"
8
+ description = "A lightweight, local Mock server on FastAPI for frontend and mobile teams."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ dependencies = [
12
+ "fastapi>=0.100.0",
13
+ "uvicorn>=0.23.0",
14
+ "pydantic>=2.0.0",
15
+ "pydantic-settings>=2.0.0",
16
+ "faker>=19.0.0",
17
+ "pyyaml>=6.0",
18
+ "jsonref>=1.1.0",
19
+ "python-multipart>=0.0.9",
20
+ "typer>=0.9.0",
21
+ "websockets>=12.0"
22
+ ]
23
+
24
+ [project.scripts]
25
+ fastmock = "fastmock.cli:app"
26
+
27
+ [project.optional-dependencies]
28
+ dev = [
29
+ "pytest>=7.0",
30
+ "pytest-asyncio",
31
+ "httpx",
32
+ "ruff",
33
+ "mypy"
34
+ ]
35
+
36
+ [tool.ruff]
37
+ line-length = 100
38
+ target-version = "py312"
39
+
40
+ [tool.ruff.lint]
41
+ select = ["E", "F", "B", "UP", "SIM", "RUF", "BLE", "ASYNC"]
42
+ ignore = ["B008", "BLE001", "S110", "SIM102", "ASYNC230", "RUF059", "RUF002", "RUF003", "E501", "RUF001", "UP015", "ASYNC240", "E402"]
43
+
44
+ [tool.mypy]
45
+ strict = true
46
+ ignore_missing_imports = true
47
+
48
+ [tool.hatch.build.targets.wheel]
49
+ packages = ["src/fastmock"]
File without changes
File without changes