Skip to main content

Boot.py is an small set of tools to build simple scripts. Python3 only, and really small: 2Kb!

Project description

https://badge.fury.io/py/boot.py.svg

Install and Use

Install with pip.

pip install boot.py

Create a file and import boot. For example this will install a virtual environment, install requirements, and create some files.

#!/usr/bin/env python3
import os
import venv

from pathlib import Path

root_path = Path(__file__).parent.resolve()
venv_dir = root_path / '.venv'

with step(f'Creating virtualenv in {venv_dir.name}'):
    if not venv_dir.exists():
        venv.create(venv_dir, with_pip=True)

with step('Installing requirements'):
    run(f'{venv_dir / "bin/pip"} install -r requirements.txt')

with step('Creating directories'):
    run(f'mkdir -p public/media')
    run(f'mkdir -p public/static')

with step('Environment file'):
    envfile = root_path / '.env'

    if not envfile.exists():
        with open(envfile, 'w') as handle:
            os.chmod(envfile, 0o600)
            handle.write('')

This will output.

$ ./script.py
Creating virtualenv in .venv ... [Ok]
Installing requirements ... [Ok]
Installing project ... [Ok]
Creating directories ... [Ok]
Environment file ... [Ok]

Simple!

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

boot.py-0.7.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

boot.py-0.7-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file boot.py-0.7.tar.gz.

File metadata

  • Download URL: boot.py-0.7.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for boot.py-0.7.tar.gz
Algorithm Hash digest
SHA256 ae5500223bd9cc21a1ab0b057d3999677cbd4e76202bf99a5ca814d789285a6b
MD5 19fcc366b15608830eb0b6a82b371690
BLAKE2b-256 fada3801033abdd8cc3ee2425c28908298701b604984cdac1a5a2deeab910e5b

See more details on using hashes here.

File details

Details for the file boot.py-0.7-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for boot.py-0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 57cad192aa782451dede68b497eefc1ac468459fa79df8c5dab7227ed7093356
MD5 63da49fdc19f5dde87eebc54b5033e85
BLAKE2b-256 02108b349b85b40e997629b08e1bbfc13b49c06084c25d2fe0b3a528724b2c0f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page