Skip to main content

Super simple file distribution

Project description

distman

Distributes files and directories to versioned destinations defined in dist.json files.

Installation

The easiest way to install:

$ pip install distman

Alternatively,

$ git clone https://github.com/rsgalloway/distman
$ cd distman
$ python setup.py install

Files and directories can be distributed from any folder or git repo containing a dist.json file.

Quickstart

distman looks for a dist file called dist.json at the root of a directory or git repo. The dist file defines the file distrubution instructions.

The basic format of the dist.json file is:

{
    "version": "1",
    "author": "<email>",
    "targets": {
        "<target>": {
            "source": "<source-path>",
            "destination": "<target-path>"
        },
    }
}

where <source-path> is the relative path to the source file or directory, and <target-path> is the target destination path, and <target> is a named target label to use when running distman commands. You can define as many targets as you need.

See the dist.json file in this repo for an example.

Target paths can include environment variables, such as those defined in the distman.env envstack file, where variables are defined with curly brackets only, e.g.:

"{DEPLOY_ROOT}/lib/python/distman"

When files are distributed (or disted), they are copied to a versions folder and a symlink is created to the version. When a new version is disted, the version number is incremented and the link is updated.

Usage

To dist files defined in the dist.json file (use -d for dryrun):

$ distman [-d]

This will dist files to the $DEPLOY_ROOT folder defined in the distman.env envstack file and might look something like this using default values:

$HOME/.local/distman/prod/
├── env
│   ├── distman.env -> versions/distman.env.0.c73fe42
│   └── versions
│       └── distman.env.0.c73fe42
└── lib
    └── python
        ├── distman -> versions/distman.0.c73fe42
        └── versions
            └── distman.0.c73fe42
                ├── cli.py
                ├── config.py
                ├── dist.py
                ├── __init__.py
                ├── logger.py
                ├── source.py
                └── util.py

To override the root folder, set the $ROOT env var, or update the distman.env stack file:

$ ROOT=/var/tmp/tools distman [-d]

By default, distman dists to a prod folder under $ROOT. This can be changed at any time using $ENV or updating or creating a new distman.env envstack file:

$ ENV=dev distman [-d]

This will change prod to dev in the target deplyment path. This is useful for deploying files or code to different development environments.

Dist Info

When disting files, distman will create hidden dist info files that meta data about the source files. For example, if the source file is called foobar.py then the dist info file that will be created will be called .foobar.py.dist. The dist info files will be created at the deployment root.

Config

Most congifation is done in the distman.env envstack file.

Default config settings are in the config.py module. The following environment variables are supported:

Variable Description
$DEPLOY_ROOT file deployment root directory
$ENV target environment (e.g. prod or dev)
$ROOT dist root directory

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

distman-0.1.7.tar.gz (19.6 kB view details)

Uploaded Source

File details

Details for the file distman-0.1.7.tar.gz.

File metadata

  • Download URL: distman-0.1.7.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for distman-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b612e4925d9f4bb95e9f17bd3e86828757a8c0622fe6a1f8ecd567b6e8cda564
MD5 f554152b28157ebe8367a280500e6bad
BLAKE2b-256 484401818582ac1ffb2968288aa5f0f8670793d700f7a2fd9cd832de044fcc2c

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