An open API service indexing awesome lists of open source software.

https://github.com/rsgalloway/distman

super simple file distribution system
https://github.com/rsgalloway/distman

dist distribution file-distribution package-manager poetry poetry-python setuptools vfx-pipeline

Last synced: 5 months ago
JSON representation

super simple file distribution system

Awesome Lists containing this project

README

          

distman
=======

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

## Installation

The easiest way to install:

```bash
$ pip install -U distman
```

Alternatively, use distman to dist to a deployment area using options defined
in the `dist.json` and `distman.env` environment stack files:

```bash
$ distman [-d]
```

Files, directories and links 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:

```json
{
"author": "",
"targets": {
"": {
"source": "",
"destination": ""
},
}
}
```

where `` is the relative path to the source file, directory or
link, and `` is the target destination path, and `` 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 in paths are defined with curly
brackets only, e.g.:

```bash
"{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 a `dist.json` file (remove -d when ready):

```bash
$ distman -d
```

This will dist files to the `${DEPLOY_ROOT}` folder defined in the provided
`distman.env` [envstack](https://github.com/rsgalloway/envstack) file and might
look something like this when disted:

```
${DEPLOY_ROOT}
├── bin
│   ├── distman -> versions/distman.0.c73fe42
│   └── versions
│   └── distman.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 deployment folder, update the `distman.env` environment stack
file then re-dist:

```bash
$ distman [-d]
```

By default, `distman` dists to a prod folder under `${DEPLOY_ROOT}`. This can be
changed at any time using `${ENV}` or updating or modifying the `distman.env`
envstack file:

```bash
$ 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 configuration is done in the `distman.env`
[envstack](https://github.com/rsgalloway/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) |
| $LOG_DIR | directory to write log files |
| $LOG_LEVEL | logging level to use (DEBUG, INFO, etc) |
| $ROOT | dist root directory |