{"id":51026924,"url":"https://github.com/gitstq/mockcraft","last_synced_at":"2026-06-21T20:02:33.174Z","repository":{"id":351983047,"uuid":"1213342506","full_name":"gitstq/mockcraft","owner":"gitstq","description":"MockCraft - YAML-driven structured test data factory. Zero-dependency Python CLI.","archived":false,"fork":false,"pushed_at":"2026-04-17T09:38:47.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-17T11:28:52.809Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitstq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-17T09:26:23.000Z","updated_at":"2026-04-17T09:38:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gitstq/mockcraft","commit_stats":null,"previous_names":["gitstq/mockcraft"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gitstq/mockcraft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fmockcraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fmockcraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fmockcraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fmockcraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitstq","download_url":"https://codeload.github.com/gitstq/mockcraft/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fmockcraft/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34623906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-21T20:02:32.393Z","updated_at":"2026-06-21T20:02:33.168Z","avatar_url":"https://github.com/gitstq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MockCraft\n\n**[English](README.md)** | **[简体中文](README_zh-CN.md)** | **[繁體中文](README_zh-TW.md)** | **[日本語](README_ja.md)** | **[한국어](README_ko.md)**\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eYAML-driven structured test data factory\u003c/strong\u003e\u003cbr\u003e\n  Zero-dependency Python CLI — define your schema in YAML, get realistic data in seconds\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Python-3.8+-blue.svg\" alt=\"Python 3.8+\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-green.svg\" alt=\"MIT License\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Dependencies-Zero-success.svg\" alt=\"Zero Dependencies\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Providers-23+-orange.svg\" alt=\"23+ Providers\"\u003e\n\u003c/p\u003e\n\n---\n\n## 🎉 What is MockCraft?\n\nMockCraft is a lightweight, zero-dependency Python CLI tool that generates structured fake data from YAML schemas. It's designed for developers who need realistic test data for database seeding, API testing, benchmarking, and development demos — without writing boilerplate code.\n\n**Key difference from Faker:** Faker is a Python library for generating individual fake values. MockCraft is a **data factory** — define your entire data structure once in YAML, and generate hundreds of consistent, realistic records in one command.\n\n## ✨ Core Features\n\n- **YAML-Driven Schema** — Define data structures declaratively in YAML\n- **23+ Built-in Providers** — Names, emails, phones, addresses, IPs, URLs, UUIDs, timestamps, text, and more\n- **Zero Dependencies** — Only Python stdlib required (plus PyYAML for schema parsing)\n- **6 Output Formats** — Table, JSON, CSV, SQL INSERT, Markdown, YAML\n- **Reproducible Seeds** — Same seed always produces the same data\n- **Multi-Locale Support** — Chinese (zh_CN), English (en_US), Japanese (ja_JP), Korean (ko_KR), Traditional Chinese (zh_TW)\n- **CLI + Python API** — Use from command line or import as a library\n- **Streaming Generator** — Memory-efficient for large datasets\n\n## 🚀 Quick Start\n\n### Install\n\n```bash\npip install mockcraft\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/gitstq/mockcraft.git\ncd mockcraft\npip install -e .\n```\n\n### Generate Your First Data\n\nCreate a YAML schema (`users.yaml`):\n\n```yaml\nfields:\n  user_id:\n    type: int\n    min: 1000\n    max: 9999\n  name:\n    type: person\n  email:\n    type: email\n  age:\n    type: int\n    min: 18\n    max: 65\n  city:\n    type: choice\n    choices: [Beijing, Shanghai, Shenzhen, Guangzhou]\n  is_active:\n    type: bool\n  balance:\n    type: float\n    min: 0\n    max: 10000\n    decimals: 2\n```\n\nGenerate 10 records:\n\n```bash\nmockcraft generate users.yaml -n 10\n```\n\nExport to different formats:\n\n```bash\n# JSON\nmockcraft generate users.yaml -n 100 --format=json --output=users.json\n\n# CSV\nmockcraft generate users.yaml -n 100 --format=csv --output=users.csv\n\n# SQL INSERT statements\nmockcraft generate users.yaml -n 100 --format=sql --table=t_users --output=users.sql\n\n# Markdown table\nmockcraft generate users.yaml -n 10 --format=markdown\n```\n\n## 📖 Detailed Guide\n\n### CLI Commands\n\n```bash\n# Generate data\nmockcraft generate \u003cschema.yaml\u003e -n \u003ccount\u003e [-f format] [-o output] [-s seed]\n\n# List all available providers\nmockcraft list-providers\n\n# Validate a schema file\nmockcraft validate \u003cschema.yaml\u003e\n\n# Show version\nmockcraft version\n```\n\n### CLI Options\n\n| Option | Short | Description | Default |\n|--------|-------|-------------|---------|\n| `--count` | `-n` | Number of records | 1 |\n| `--format` | `-f` | Output format (table/json/csv/sql/markdown/yaml) | table |\n| `--output` | `-o` | Output file path (stdout if omitted) | stdout |\n| `--seed` | `-s` | Random seed for reproducibility | random |\n| `--locale` | | Data locale (zh_CN/en_US/ja_JP/ko_KR/zh_TW) | zh_CN |\n| `--table` | | SQL table name | mock_data |\n\n### Available Providers\n\n| Type | Description | Parameters |\n|------|-------------|------------|\n| `person` / `name` / `fullname` | Person name | `gender`: male/female |\n| `email` | Email address | `name`, `domain` |\n| `phone` / `mobile` | Phone number | — |\n| `address` | Street address | — |\n| `int` | Integer | `min`, `max` |\n| `float` | Float number | `min`, `max`, `decimals` |\n| `bool` | Boolean | — |\n| `choice` | Random choice | `choices`: [list] |\n| `uuid` | UUID v4 | — |\n| `ipv4` | IPv4 address | — |\n| `ipv6` | IPv6 address | — |\n| `url` | URL | — |\n| `user_agent` | Browser User-Agent | — |\n| `datetime` | Datetime string | `format`, `offset_days` |\n| `date` | Date string | `format`, `offset_days` |\n| `timestamp` | Unix timestamp | `offset_seconds` |\n| `sentence` | Sentences | `count` |\n| `paragraph` | Paragraph | `count` |\n| `word` | Single word | — |\n| `static` | Static value | `value` |\n\n### Python API Usage\n\n```python\nfrom mockcraft import MockCraft\n\nmc = MockCraft(locale=\"zh_CN\")\n\n# Define schema inline\nschema = {\n    \"fields\": {\n        \"id\": {\"type\": \"uuid\"},\n        \"name\": {\"type\": \"person\"},\n        \"email\": {\"type\": \"email\"},\n        \"score\": {\"type\": \"float\", \"min\": 0, \"max\": 100, \"decimals\": 1},\n        \"passed\": {\"type\": \"bool\"},\n        \"created_at\": {\"type\": \"datetime\", \"format\": \"%Y-%m-%d %H:%M:%S\"},\n    }\n}\n\n# Generate 100 records\nrecords = mc.generate(schema, count=100, seed=42)\n\n# Stream generate (memory efficient)\nfor record in mc.generate_stream(schema, count=100000):\n    process(record)\n\n# Export to file\nmc.export(records, \"output.json\", format=\"json\")\n```\n\n### Template Expressions\n\nMockCraft supports inline `{{expression}}` syntax in string fields:\n\n```yaml\nfields:\n  username: \"{{person}}_{{random.int 100 999}}\"\n  created_date: \"User created on {{date format='%Y-%m-%d'}}\"\n  unique_id: \"{{random.uuid}}\"\n```\n\n## 💡 Design Philosophy\n\n1. **Schema as Code** — Your test data structure is version-controlled alongside your codebase\n2. **Convention over Configuration** — Sensible defaults, minimal boilerplate\n3. **Zero Runtime Dependencies** — Only PyYAML for parsing; everything else is stdlib\n4. **Reproducibility First** — Seed-based generation for deterministic testing\n5. **CLI-Native** — Designed for terminal workflows, CI/CD pipelines, and shell scripting\n\n### Roadmap\n\n- [ ] Custom provider plugin system\n- [ ] Relational data generation (foreign keys)\n- [ ] JSON Schema support\n- [ ] GUI schema builder (web)\n- [ ] Docker image for standalone generation\n- [ ] Excel (XLSX) output format\n\n## 📦 Build \u0026 Deploy\n\n### Install from PyPI (planned)\n\n```bash\npip install mockcraft\n```\n\n### Install from Source\n\n```bash\ngit clone https://github.com/gitstq/mockcraft.git\ncd mockcraft\npip install -e .\n\n# With dev dependencies\npip install -e \".[dev]\"\n```\n\n### Build Distribution\n\n```bash\npip install build\npython -m build\n```\n\n### Run Tests\n\n```bash\npython tests/test_mockcraft.py\n```\n\n## 🤝 Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## 📄 License\n\nThis project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.\n\n---\n\n\u003cp align=\"center\"\u003e\n  Made with ❤️ by \u003ca href=\"https://github.com/gitstq\"\u003egitstq\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitstq%2Fmockcraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitstq%2Fmockcraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitstq%2Fmockcraft/lists"}