<commit_before># BATMAN

A Python deployment toolbelt

![batman](http://1.bp.blogspot.com/-z0lXpuKOQXQ/UFZE-PjgIPI/AAAAAAAADrM/HrzTbznSYFI/s1600/famous-cartoon-character-batman.jpg)

## Usage

Create a `.batman.yml` file in your repository.  You can set the name of the virtualenv to run, the temp directory used to store hashes, the list of files to check for updates, and the commands to run when those files change.   You can also provide a list of symlinks that should be created, if they aren't already.

Batman should be called by an automated deployment script, but you can call it manually like this:

`batman /full/path/to/project`

## Assumptions

You need pip, virtualenv, virtualenvwrapper, and python already installed on your deployment target.

## .batman.yml

 * **virtualenv** specify the virtualenv to install packages into for this repository
 * **hash_dir** the temp directory to store hashes in. This is how batman can tell if your files have changed.
 * **add2virutalenv** Add these paths to the virtualenv
 * **update_on_change** Mapping from file to watch to command to run if the file changes
 * **ensure_symlinks** Mapping from symlink name to target to create symlinks.  You can use paths relative to the project root for src if you want.
 * **delete_pattern** command-line glob that will search the directory structure and delete all files matching this pattern.  Be careful with this one!

## Example .batman.yml (this one is used for our rg2 app)

```yaml
virtualenv: rg2
hash_dir: ~/tmp/hashes/

update_on_change:<commit_msg>Add example usage of delete_pattern to readme<commit_after># BATMAN

A Python deployment toolbelt

![batman](http://1.bp.blogspot.com/-z0lXpuKOQXQ/UFZE-PjgIPI/AAAAAAAADrM/HrzTbznSYFI/s1600/famous-cartoon-character-batman.jpg)

## Usage

Create a `.batman.yml` file in your repository.  You can set the name of the virtualenv to run, the temp directory used to store hashes, the list of files to check for updates, and the commands to run when those files change.   You can also provide a list of symlinks that should be created, if they aren't already.

Batman should be called by an automated deployment script, but you can call it manually like this:

`batman /full/path/to/project`

## Assumptions

You need pip, virtualenv, virtualenvwrapper, and python already installed on your deployment target.

## .batman.yml

 * **virtualenv** specify the virtualenv to install packages into for this repository
 * **hash_dir** the temp directory to store hashes in. This is how batman can tell if your files have changed.
 * **add2virutalenv** Add these paths to the virtualenv
 * **update_on_change** Mapping from file to watch to command to run if the file changes
 * **ensure_symlinks** Mapping from symlink name to target to create symlinks.  You can use paths relative to the project root for src if you want.
 * **delete_pattern** command-line glob that will search the directory structure and delete all files matching this pattern.  Be careful with this one!

## Example .batman.yml (this one is used for our rg2 app)

```yaml
virtualenv: rg2
hash_dir: ~/tmp/hashes/
delete_pattern: "*.pyc"

update_on_change:
{'fraction_non_alphanumeric': 0.07228535353535354, 'fraction_numerical': 0.005681818181818182, 'mean_word_length': 4.482698961937716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2154759', 'n_tokens_mistral': 944, 'n_tokens_neox': 911, 'n_words': 429}