Skip to main content

A reusable deployment framework for Python.

Project description

PyDaffodil

Stars Badge Forks Badge Issues Badge License Badge

pydaffodil is a reusable deployment framework for Python, designed to simplify the process of deploying applications to remote VPS servers.

Features

  • Run shell commands
  • Transfer files using SCP
  • Execute SSH commands
  • Modular and reusable deployment steps

Installation

To install pydaffodil, follow these steps:

  1. Install Python: Make sure you have Python 3.6+ installed. You can download it from python.org.

  2. Install PyDaffodil:

    You can install pydaffodil from PyPI using pip:

    pip install pydaffodil
    
  3. Verify Installation:

    After installation, you can verify it by importing pydaffodil in your Python script or in the Python interpreter:

    from pydaffodil import Daffodil
    

    If no errors are raised, the installation was successful.

Usage

Here's an example of how to use pydaffodil for deployment:

from pydaffodil import Daffodil

cli = Daffodil(remote_user="root", remote_host="123.221.11.243", remote_path="/root/prod/bccs")

steps = [
    {"step": "Build the project", "command": lambda: cli.run_command("npm run build")},
    {"step": "Stop backend process on remote server", "command": lambda: cli.ssh_command("sudo forever stop 1")},
    {"step": "Transfer files to remote server", "command": lambda: cli.transfer_files("build")},
    {"step": "Restart backend process on remote server", "command": lambda: cli.ssh_command("sudo forever restartall")}
]

cli.deploy(steps)

Note: require admin privileges to run the script.

How to Republish to PyPI

To republish this project to PyPI after making changes, follow these steps:

1. Update the Version Number

In order to upload a new version to PyPI, you must increment the version number in the setup.py file. For example, if the current version is 1.0.0, change it to 1.0.1:

# setup.py
setup(
    name="pydaffodil",
    version="1.0.1",  # Increment the version number here
    # Other metadata...
)

2. Install build module

Run the following to install the build module

pip install build

3. Build the Package

Run the following command to build both the source distribution (.tar.gz) and the wheel (.whl) files:

python -m build

This will generate the package files in the dist/ folder.

4. Upload the Package to PyPI

Once your package is built, you can use twine to upload it to PyPI. Run the following command to upload the new version:

twine upload dist/*

You'll be prompted to enter your PyPI credentials. Make sure to have them ready.

5. Test Your New Release

After uploading, you can verify that the new version has been successfully published by installing it using pip:

pip install --upgrade pydaffodil

This will install the latest version of the package.

6. Re-uploading to TestPyPI (Optional)

If you'd like to test the release before publishing it to the official PyPI, you can upload to TestPyPI instead:

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Then install it from TestPyPI to verify:

pip install --index-url https://test.pypi.org/simple/ pydaffodil

This ensures that everything is working correctly before pushing the package to the main PyPI repository.

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

pydaffodil-1.1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

pydaffodil-1.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file pydaffodil-1.1.1.tar.gz.

File metadata

  • Download URL: pydaffodil-1.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pydaffodil-1.1.1.tar.gz
Algorithm Hash digest
SHA256 5c9f267a9acd83ca80ac3b729f6a72de3503ee7674036f78e1a6a04bb5374b2c
MD5 43b8dbab625cc67ef913523360e4b5be
BLAKE2b-256 65e9ca5bd71ca9599c6fc816d448addd1bd26a3c9e309e4a95d20137a1389157

See more details on using hashes here.

File details

Details for the file pydaffodil-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pydaffodil-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pydaffodil-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6bc71d815c72573cd91b1fccec98acdc6466d3f6ec8b9537ed9cee9778615416
MD5 c767d27831b0ebe2ae3a82424b47555f
BLAKE2b-256 f5c585a065aabb8e1eecd7e443b174cab3bc4f2785f6e38393ac911fb02bfa48

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