Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 45 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,82 @@
# Forger

A Python tool for generating fake data and exporting it to JSON files. Built with Faker, Typer, and Poetry.
A Python CLI tool for generating fake data and exporting it to JSON files.

## Description
## Overview

Forger is a command-line tool that helps you generate realistic fake data for testing and development purposes. It uses the Faker library to create various types of fake data and exports them to JSON files.
Forger helps you generate realistic test data using the Faker library. It's perfect for developers who need to quickly create test datasets for their applications.

## Features

- Generate fake user data
- Export data to JSON format
- Customizable data generation
- Command-line interface using Typer
- Generate fake user data with customizable fields
- Export to JSON format
- Support for multiple data types (names, addresses, emails)
- Command-line interface with Typer
- Configurable output format
- Batch processing

## Requirements

- Python 3.13 or higher
- Poetry for dependency management
- Python 3.13+
- Poetry
- Git

## Installation
## Quick Start

1. Clone the repository:
1. Clone and install:
```bash
git clone https://github.com/yourusername/forger.git
cd forger
poetry install
```

2. Install dependencies using Poetry:
2. Verify installation:
```bash
poetry install
forger --help
```

## Usage

After installation, you can use Forger through the command line:

```bash
# Generate fake user data
poetry run python main.py generate-users --count 10 --output users.json
# Basic usage
forger generate-users --count 10 --output users.json

# Custom fields
forger generate-users --count 5 --fields name,email,address --output custom_users.json

# Specific locale
forger generate-users --count 3 --locale fr_FR --output french_users.json
```

## Development

This project uses Poetry for dependency management. To add new dependencies:
1. Fork and clone the repository
2. Create a feature branch: `git checkout -b feature/your-feature`
3. Install dependencies: `poetry install`
4. Run tests: `poetry run pytest`

### Adding Dependencies

```bash
# Production dependency
poetry add package-name

# Development dependency
poetry add --group dev package-name
```

## License
## Contributing

This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Open a Pull Request

## Author
## License

- weyderfs (weyderfs@gmail.com)
Apache 2.0 License - see [LICENSE](LICENSE) for details.

## Contributing
## Support

Contributions are welcome! Please feel free to submit a Pull Request.
Open an issue in the GitHub repository for questions or problems.
143 changes: 142 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ requires-python = ">=3.13, <4.0"
dependencies = [
"faker (>=37.3.0,<38.0.0)",
"datetime (>=5.5,<6.0)",
"typer (>=0.9.0,<1.0.0)",
"rich (>=13.7.0,<14.0.0)",
]

[project.scripts]
forger = "src.cli:app"

[tool.poetry]
packages = [
{ include = "src" }
Expand Down
5 changes: 5 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
Forger - A tool for generating fake user data
"""

__version__ = "0.0.1"
43 changes: 43 additions & 0 deletions src/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import typer
from rich.console import Console
from rich.panel import Panel
from .services.user_generator import save_users_to_file

# Initialize Typer app and Rich console
app = typer.Typer(help="Generate fake user data with customizable options")
console = Console()


@app.command()
def main(
count: int = typer.Option(
10,
"--count", "-c",
help="Number of fake users to generate",
min=1
),
output: str = typer.Option(
'users.json',
"--output", "-o",
help="Output JSON file path"
)
) -> None:
"""Generate fake user data and save it to a JSON file.

If no arguments are provided, generates 10 users and saves to users.json
"""
try:
if not output.endswith('.json'):
output += '.json'

save_users_to_file(count, output)

# Display success message in a nice panel
console.print(Panel(
f"[green]Successfully generated {count} users and saved to {output}[/green]",
title="Forger",
border_style="green"
))
except Exception as e:
console.print(f"[red]Error: {str(e)}[/red]")
raise typer.Exit(1)
Loading