Skip to main content

Uma biblioteca para gerar dados fictícios para testes

Project description

Mockbin - Gerador de Dados Fictícios em Python

PyPI Version Python Versions License: MIT

Biblioteca Python para geração de dados fictícios estruturados, perfeita para testes, desenvolvimento e prototipagem.

Instalação

pip install mockbin

Uso Básico

from mockbin import Mockbin
from mockbin.generators import NameGenerator, EmailGenerator, DateGenerator

# Inicializar o Mockbin
mocker = Mockbin()

# Configurar um modelo de dados
mocker.set_model("users", 10).set_columns("users", {
    "id": UUIDGenerator,
    "name": NameGenerator,
    "email": EmailGenerator,
    "signup_date": DateGenerator,
    "is_active": BooleanGenerator
})

# Gerar DataFrame
df = mocker.get_df_from_model("users")
print(df)

Exemplos de Uso

# Gerar usuários e pedidos relacionados
users = mocker.model("users", 100).columns("users", {
    "user_id": UUIDGenerator,
    "name": NameGenerator
}).get_df_from_model("users")

orders = mocker.model("orders", 500).columns("orders", {
    "order_id": UUIDGenerator,
    "user_id": lambda: random.choice(users['user_id']),
    "item": ItemGenerator,
    "value": NumberGenerator(10, 1000, decimal=True)
}).get_df_from_model("orders")

Customização de Geradores

# Criando geradores customizados
corporate_email = EmailGenerator(domain="empresa.com.br")
high_value = NumberGenerator(1000, 10000, decimal=True)

mocker.model("employees", 50).columns("employees", {
    "name": NameGenerator,
    "email": corporate_email,
    "salary": high_value
})

Exportando Dados

Você pode exportar os modelos gerados para CSV ou Parquet:

from mockbin import Mockbin
from mockbin.generators import NameGenerator

mocker = Mockbin()
mocker.model("users", 100).columns("users", {
    "name": NameGenerator
})

# Método alternativo
mocker.export_model(
    model_name="users",
    output_path="data/users.csv",
    format='csv',
    index=False
)

Para usar exportação Parquet, instale as dependências extras:

pip install mockbin[parquet]
# ou
pip install pyarrow

Licença

Distribuído sob a licença MIT. Veja LICENSE para mais informações.

Contato

Nathan Rodrigo - nathan.lopes@sptech.school

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mockbinn-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mockbinn-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file mockbinn-0.1.0.tar.gz.

File metadata

  • Download URL: mockbinn-0.1.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mockbinn-0.1.0.tar.gz
Algorithm Hash digest
SHA256 89d5f75104be84b30df162691ce1238aecd35985f2cf11cbfeda7770d50fdd3b
MD5 a1ff7a6e0adbd88d443781b99dd441c4
BLAKE2b-256 631d493e6c8d0b5836c246cc90eb28f58feabd0ccb82d9944b165c062cdd3a85

See more details on using hashes here.

File details

Details for the file mockbinn-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mockbinn-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mockbinn-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9de429cfc9640d3fa4baef6852bc1143d221407533bd18f0f1ea3deefc0f449
MD5 8c93e97d49d015058b0c20777fdf3919
BLAKE2b-256 8dc07e4a256dc55d1c74071272f366774b28f9f170599b7f81da4d3e9d744d67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page