Skip to main content

Biblioteca de utilitários essenciais para projetos CSC

Project description

csc-essentials

Pequeno utilitário para integração com Google Cloud (BigQuery, Secret Manager, Cloud Logging, Compute).

Instalação

pip install csc-essentials

Quickstart (exemplo rápido)

from google.cloud import bigquery
from csc_essentials.logging import GeradorLog
from csc_essentials.secrets import get_secrets
from csc_essentials.database import inserir_banco_dados

log = GeradorLog("exemplo")
# Ler segredo do Secret Manager (ex.: token Slack)
raw = get_secrets("projects/MEU_PROJ/secrets/SLACK_SECRET/versions/latest")

# Preparar cliente BigQuery
client = bigquery.Client()

# Carregar arquivo NDJSON para uma tabela
inserir_banco_dados(
    arquivo_path="/tmp/dados.ndjson",
    projeto="meu-projeto",
    dataset="meu_dataset",
    tabela="minha_tabela",
    log=log,
    client=client,
    wait_job=True,
)

print("Upload iniciado")

Documentação

  • Documentação por módulo em docs/ (veja docs/overview.md).
  • Principais módulos: logging, secrets, utils, database.

Contribuindo

  • Abra uma issue descrevendo o problema ou feature.
  • Envie um Pull Request com testes e descrição clara das mudanças.
  • Formato de código: siga o estilo existing do projeto e execute os testes (pytest).

Licença

Este repositório está licenciado conforme o arquivo LICENSE na raiz.

Notas rápidas

  • Verifique permissões GCP ao usar bigquery.Client() e secretmanager.SecretManagerServiceClient.
  • Em desenvolvimento local, você pode desativar o envio para Cloud Logging configurando GCP_LOGGING_ATIVO=false.

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

csc_essentials-0.3.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

csc_essentials-0.3.4-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file csc_essentials-0.3.4.tar.gz.

File metadata

  • Download URL: csc_essentials-0.3.4.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for csc_essentials-0.3.4.tar.gz
Algorithm Hash digest
SHA256 574be6f217b0a217e8bef2c76b2b8b2b398fb534f1f3d741aabb2e799615bade
MD5 c63ea0fad25abac1653c5bb6d764518f
BLAKE2b-256 7c006874b468e9118e8c373a15fdfb6cc0c42aae18708a563edef29914b36ae0

See more details on using hashes here.

File details

Details for the file csc_essentials-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: csc_essentials-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for csc_essentials-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 45e6b4a18ff2dca1fe62772692ad745a416e6d9f099d5cb05fc3683ef5db5f5e
MD5 e6157d439c608d68b365cd1f7bc0030a
BLAKE2b-256 b28f745d6af3e1b98ebee6d0955ea9959ee08ff7ce65fd443e509bc6fc76966f

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