Skip to main content

Utilitário de deploy de flows Prefect para a RBR Asset Management.

Project description

rbr-prefect

Utilitário de deploy de flows Prefect para a RBR Asset Management.

Instalação

pip install rbr-prefect

Ou para desenvolvimento local:

pip install -e .

Uso Básico

from rbr_prefect import DefaultDeploy
from flows.my_flow import my_flow

deploy = DefaultDeploy(
    flow_func=my_flow,
    name="my-flow-prod",
    tags=["dados-externos"],
)
deploy.parameters = deploy.override(country_name="Brazil")
deploy.deploy()

Para flows de scraping com Playwright:

from rbr_prefect import ScrapeDeploy
from flows.scraper import scraper_flow

deploy = ScrapeDeploy(
    flow_func=scraper_flow,
    name="scraper-prod",
    tags=["BTG", "scraping"],
)
deploy.deploy()

Agendamento

from cronexpressions import every

deploy = DefaultDeploy(
    flow_func=my_flow,
    name="my-flow-prod",
    tags=["dados-externos"],
)
deploy.schedule(cron=every().weekday.at("09:00"))
deploy.deploy()

Release: Bump de Versão e Publicação no PyPI

O processo de publicação é inteiramente local, sem pipeline de CI/CD.

Pré-requisitos

  1. bump2version instalado:

    uv add --dev bump2version
    
  2. Credenciais do PyPI configuradas localmente via variável de ambiente:

    export UV_PUBLISH_TOKEN="pypi-xxxxxxxxxxxxxxxxxxxx"
    

    Ou via arquivo ~/.pypirc:

    [distutils]
    index-servers = pypi
    
    [pypi]
    username = __token__
    password = pypi-xxxxxxxxxxxxxxxxxxxx
    

Fluxo Completo de Release

# 1. Garantir que o branch main está limpo e atualizado
git checkout main
git pull origin main
git status  # deve estar limpo

# 2. Executar os testes (quando implementados)
uv run pytest

# 3. Bumpar a versão
#    Escolher: patch (0.1.0 → 0.1.1) | minor (0.1.0 → 0.2.0) | major (0.1.0 → 1.0.0)
bump2version patch

# O bump2version automaticamente:
#   - Atualiza a versão em pyproject.toml e rbr_prefect/__init__.py
#   - Cria o commit: "Bump version: 0.1.0 → 0.1.1"
#   - Cria a tag: "v0.1.1"

# 4. Push do commit e da tag
git push origin main
git push origin --tags

# 5. Build dos artifacts
uv build

# 6. Publicação no PyPI
uv publish

Tipos de Bump

Comando Exemplo Quando usar
bump2version patch 0.1.0 → 0.1.1 Bug fixes, pequenas correções
bump2version minor 0.1.0 → 0.2.0 Novas funcionalidades retrocompatíveis
bump2version major 0.1.0 → 1.0.0 Breaking changes

Verificando a Versão

import rbr_prefect
print(rbr_prefect.__version__)

Ou via importlib:

import importlib.metadata
print(importlib.metadata.version("rbr-prefect"))

Licença

MIT

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

rbr_prefect-0.3.14.tar.gz (189.1 kB view details)

Uploaded Source

Built Distribution

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

rbr_prefect-0.3.14-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file rbr_prefect-0.3.14.tar.gz.

File metadata

  • Download URL: rbr_prefect-0.3.14.tar.gz
  • Upload date:
  • Size: 189.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rbr_prefect-0.3.14.tar.gz
Algorithm Hash digest
SHA256 003f87eed386ba8ed2f47072723f53be25bf0f84f1ab3aaf054dea2f747178fa
MD5 42862e5d1106c89534059a6d23708dc7
BLAKE2b-256 6004f5e68f962c34d124fce8923d1cfa192ac1eaed2758c08ede897ec4536a38

See more details on using hashes here.

File details

Details for the file rbr_prefect-0.3.14-py3-none-any.whl.

File metadata

  • Download URL: rbr_prefect-0.3.14-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for rbr_prefect-0.3.14-py3-none-any.whl
Algorithm Hash digest
SHA256 f0cb84582564f562d6197fcf94f3cf99224f2766ca0a79c18b44b62167391a5e
MD5 02f4adb5d159a4c8eb4ce7334d1e71c9
BLAKE2b-256 9710d0ab2eb525dfdf3c3fae4e59bd86e9c01a51e3f8b8d4a858dbf79ddb09c5

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