Metadata-Version: 2.4
Name: pyportable
Version: 0.3.0
Summary: Download, configure and manage Portable (Embedded) Python installations automatically.
Author-email: David Silva <david.emery.silva@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/DaavidSiilva/PyPortable
Project-URL: Repository, https://github.com/DaavidSiilva/PyPortable
Project-URL: Issues, https://github.com/DaavidSiilva/PyPortable/issues
Project-URL: Changelog, https://github.com/DaavidSiilva/PyPortable/releases
Keywords: python,portable,embedded,installer,cli,windows
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: System :: Installation/Setup
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# PyPortable Installer

<img width="1024" height="559" alt="image" src="https://github.com/user-attachments/assets/d929d0dc-f63a-4dcf-b16c-7f457fb5d7f9" />

![Downloads](https://static.pepy.tech/badge/pyportable)
![PyPI Version](https://img.shields.io/pypi/v/pyportable)
![License](https://img.shields.io/github/license/DaavidSiilva/PyPortable)
![Python](https://img.shields.io/pypi/pyversions/pyportable)

Uma ferramenta CLI e biblioteca Python para baixar, configurar e gerenciar
instalações do **Python Portable (Embeddable)** automaticamente. Ideal para criar
ambientes Python isolados para distribuição, sem instalação administrativa.

## Funcionalidades

- **Versões sempre atualizadas** — a lista de versões é lida em tempo real do
  feed oficial do python.org (com cache local), nada de lista fixa no código.
- **Multi-arquitetura** — builds `amd64` (64 bits), `win32` (32 bits) e `arm64`,
  com detecção automática da sua máquina.
- **Download inteligente** — barra de progresso, retry automático, cache dos
  instaladores e verificação de checksum quando o python.org publica um.
- **Fallback de releases source-only** — quando uma versão só tem código-fonte
  (sem binário para Windows), o PyPortable cai automaticamente para o patch
  mais novo que realmente possui build.
- **Pip pronto para uso** — instala `pip`, `setuptools` e `wheel`, e já configura
  o `._pth` e o `site-packages`.
- **Scripts de ativação** — gera `activate.ps1` e `activate.bat` junto da instalação.
- **Diagnóstico e limpeza** — `doctor`, `uninstall` e `clean` integrados.
- **CLI moderna** — Typer + Rich, com cores, tabelas e ajuda navegável.

## Instalação

```bash
pip install pyportable
```

### Desenvolvimento

```bash
git clone https://github.com/DaavidSiilva/PyPortable
cd PyPortable
pip install -e ".[dev]"
pytest
```

## Uso

### Listar versões disponíveis

```bash
pyportable list              # versões estáveis
pyportable list --all        # inclui alpha/beta/rc
pyportable list --check      # confirma no python.org quais builds existem
pyportable list --json       # saída para scripts
```

### Instalar

```bash
pyportable install latest              # instala na pasta .python
pyportable install 3.12                # série mais recente disponível
pyportable install 3.12.10             # versão exata
pyportable install 3.12 --arch 32      # força 32 bits
pyportable install 3.12 --dir .venv    # pasta customizada
pyportable install 3.12 --dry-run      # mostra o plano sem baixar
pyportable install 3.12 --force        # substitui instalação existente
```

Atalho: `pyportable 3.12` é equivalente a `pyportable install 3.12`.

### Gerenciar

```bash
pyportable doctor                 # checa a instalação atual
pyportable uninstall --yes        # remove a instalação
pyportable clean --yes            # limpa o cache de downloads
pyportable version                # versão do PyPortable
```

### Ativar o ambiente

Depois de instalar, use os scripts gerados:

```powershell
# PowerShell
.\.python\activate.ps1
```

```bat
:: CMD
.python\activate.bat
```

## Uso como biblioteca

```python
from pyportable import install, doctor, uninstall

result = install("3.12", arch="64", dest=".python")
print(result.python_exe)   # .python\python.exe

report = doctor(".python")
if not report.ok:
    print(report.issues)

uninstall(".python")
```

## Opções da CLI

| Comando     | Descrição                                              |
| ----------- | ------------------------------------------------------ |
| `list`      | Lista versões publicadas no python.org                 |
| `install`   | Baixa, extrai e configura uma instalação portátil      |
| `doctor`    | Inspeciona uma instalação e aponta problemas           |
| `uninstall` | Remove uma instalação                                  |
| `clean`     | Limpa o cache local (zips e feed de versões)           |
| `version`   | Mostra a versão do PyPortable                          |

Use `pyportable <comando> --help` para ver todas as flags.

## Estrutura do Projeto

- `pyportable/`
  - `cli.py` — interface de linha de comando (Typer + Rich).
  - `releases.py` — descoberta e resolução de versões no python.org.
  - `downloader.py` — download com progresso, retry e checksum.
  - `installer.py` — instalação, desinstalação e diagnóstico.
  - `config.py` — constantes e caminhos.
  - `_console.py` — tema e helpers de saída.
- `tests/` — suíte de testes com pytest.

## Publicação

O caminho recomendado é **Trusted Publishing (OIDC)**, sem tokens armazenados:
crie uma tag (`vX.Y.Z`) e o workflow `.github/workflows/publish.yml` cuida do resto.

Para publicar manualmente com o Twine:

```bash
python -m build
twine upload dist/*          # usa TWINE_USERNAME / TWINE_PASSWORD do ambiente
```

`TWINE_USERNAME` costuma ser `__token__` e `TWINE_PASSWORD`, o API token do PyPI.

## Licença

MIT
