Skip to main content

Deploy a versioned codebase to S3/MinIO, SSH, or a local directory

Project description

depush

Deploy a versioned codebase directory to S3/MinIO, SSH, or a local directory.

depush reads a version file from your codebase directory and deploys all files to {prefix}/{version}/ at the destination. Stale files at the destination that no longer exist in the source are automatically deleted, keeping deployments in sync.

Configuration is flexible: use CLI flags, environment variables, or a YAML config file. Precedence (highest to lowest): CLI flag > environment variable > YAML config > default.


Installation

pip install depush

Or with uv:

uv add depush

Quick start

Your codebase directory must contain a version file:

my-project/
├── version        # contains e.g. "1.2.3"
├── main.py
└── ...

Deploy to S3 / MinIO

depush --target s3 --prefix mylib \
  --s3-bucket deployments \
  --s3-endpoint http://localhost:9000 \
  --s3-access-key admin \
  --s3-secret-key secret

Files are uploaded to s3://deployments/mylib/1.2.3/.

Deploy over SSH

depush --target ssh --prefix mylib \
  --ssh-host myserver.example.com \
  --ssh-user deploy \
  --ssh-key-file ~/.ssh/id_rsa

Files are copied to /deployments/mylib/1.2.3/ on the remote host.

Deploy to a local directory

depush --target local --prefix mylib --local-dest /srv/releases

Files are copied to /srv/releases/mylib/1.2.3/.

Dry run

Add --dry-run to any command to preview what would be deployed without making any changes:

depush --target s3 --prefix mylib --s3-bucket deployments --dry-run

Configuration file

Place a depush.yaml in the current directory (or pass --config path/to/file.yaml) to avoid repeating flags:

target: s3
prefix: mylib
codebase_dir: ./codebase
dry_run: false

s3:
  bucket: deployments
  endpoint: http://localhost:9000   # omit for AWS
  region: us-east-1
  access_key: admin
  secret_key: secret

# local:
#   dest: ./dist

# ssh:
#   host: myserver.example.com
#   port: 22
#   user: deploy
#   key_file: ~/.ssh/id_rsa
#   deploy_root: /deployments

Environment variables

All options can also be set via environment variables:

Variable Description Default
DEPLOY_TARGET Deployment target: s3, ssh, or local (required)
DEPLOY_PREFIX Path prefix, e.g. mylibmylib/{version}/ (required)
DEPLOY_CODEBASE_DIR Path to codebase directory .
DEPLOY_DRY_RUN Set to 1, true, or yes to preview false
DEPLOY_CONFIG Path to a YAML config file depush.yaml if present
DEPLOY_LOCAL_DEST Root destination for local deployments ./dist
S3_BUCKET S3/MinIO bucket name (required for s3)
S3_ENDPOINT Custom endpoint URL for MinIO (AWS default)
S3_REGION AWS region us-east-1
S3_PROFILE AWS credentials profile name (from ~/.aws/credentials); falls back to AWS_PROFILE
S3_ACCESS_KEY Access key / MinIO username
S3_SECRET_KEY Secret key / MinIO password
SSH_HOST SSH server hostname or IP (required for ssh)
SSH_PORT SSH port 22
SSH_USER SSH username admin
SSH_PASSWORD SSH password (omit to use key auth)
SSH_KEY_FILE Path to private key file
SSH_DEPLOY_ROOT Absolute path on the remote server /deployments

Ignoring files

Create a .depushignore file in your codebase directory using the same syntax as .gitignore to exclude files from deployment:

*.log
__pycache__/
.env

Programmatic use

from depush import depush

# Parse args and deploy
depush.main()

# Or use individual functions
files = depush.collect_files(Path("./my-codebase"))

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

depush-0.1.0.tar.gz (50.7 kB view details)

Uploaded Source

Built Distribution

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

depush-0.1.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for depush-0.1.0.tar.gz
Algorithm Hash digest
SHA256 368e6c102f3761e6fdd2f5a0d3fcc3e0d4f5e9da55fb31552e9d1ec6a95c7335
MD5 bdcfa22379c7bdd3a446871bef6e9142
BLAKE2b-256 2e55a7bb9c7e699dde158570a0093c7b08410e98772eb518e278165375f5b40f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for depush-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28d06edc7d584290ea3ca11170c46769dcc671a2aee2e22272f99530a3a645d8
MD5 5274117cff6104210ffe3f979150499b
BLAKE2b-256 6f7002aed8863b1ef227bbb2a3004ffb621d78f03596856cd19d97fea3e1045e

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