**pbs** is a very simple command line interface to a PYBOSSA server. It allowsyou to create projects, add tasks (from a CSV, JSON, PO or a PROPERTIES file) with a niceprogress bar, delete them and update the project templates (tutorial, task_presenter, and descriptions) all from the command line.

Requirements============

[PYBOSSA server](http://pybossa.com) >= 1.2.0.

Installation============

pbs is available in Pypi, so you can install the software with pip:

```bash pip install pybossa-pbs```

If you have all the dependencies, the package will be installed and you will beable to use it from the command line. The command is: **pbs**.

If you want to hack on the code, just install it but with the **--editable**flag after cloning the repository:

By default pbs will use the credentials of the section default, so you don'thave to type anything to use those values. However, if you want to do actionsin the other server all you have to do is the following:

```bash pbs --credentials crowdcrafting --help```

That command will use the values of the crowdcrafting section.

### Getting out of the API context

PYBOSSA by default returns first your projects, meaning that if you want to workon a project that you don't own, it will return an error as the project will not befound. For solving this issue you have two options:

* In the config file, by adding a new flag: all:1 * On the command line, passing the --all=1 flag

## Creating a project

Creating a project is very simple. All you have to do is create a file named**project.json** with the following fields:

If you want to see all the availableoptions, please check the **--help** command:

**NOTE**: By default PYBOSSA servers use a rate limit for avoiding abuse of theAPI. For this reason, you can only do usually 300 requests per every 15minutes. If you are going to add more than 300 tasks, pbs will detect it andwarn you, auto-enabling the throttling for you to respect the limits.

```bash pbs add_tasks --help```

## Updating project templates

Now that you have added tasks, you can work in your templates. All you have todo to add/update the templates to your project is running the followingcommand:

```bash pbs update_project```

That command needs to have in the same folder where you are running it, thefollowing files:

* template.html * long_description.md * tutorial.html

If you want to use another template, you can via arguments:

```bash pbs update_project --template /tmp/template.html```

If you want to see all the availableoptions, please check the **--help** command:

```bash pbs update_project --help```

### Using an external JavaScript file

Since pbs >= 2.3.0, pbs will check for an external JavaScript file named *bundle.js*or *bundle.min.js*. If any of those files exist, then, they will be added at the bottomof your template (like you have been doing so far with your projects).

This solution allows you to use for example webpack plus babel to transpile your code,minimize it and add it to your PYBOSSA project.

In order to use this solution, just transpile to a file named bundle.js or bundle.min.js.

**NOTE** If there's a minified version of the file, bundle.min.js, that file will be always usedinstead of bundle.js.

### Auto-updating while developing a PYBOSSA project

At some point you will end up running lots of pbs update_project commands, as you will be using your own editor for fixing CSS, HTML or JavaScript. For thesescenarios, pbs comes with a handy feature: --watch. This argument will tell pbsto run update_project automatically when template.html, tutorial.html orlong_description.md are modified in the file system. As simple as that.

You can run it like this:

```bash pbs update_project --watch```

And the output will be similar to this:

![GIF of pbs in action](http://i.imgur.com/QoYC4oV.gif)

**NOTE**: this also works with bundle.js files :smile: Thus, you can have webpack transpiling automatically your code, and pbs will update automatically your projectwith the new code.

## Updating tasks redundancy from a project

If you need it, you can update the redundancy of a task using its ID or all thetasks skipping the ID. For example, to update the redundancy of one task to 5:

```bash pbs update-task-redundancy --task-id 34234 --redundancy 5```

To update all of them:

```bash pbs update-task-redundancy --redundancy 5```

**Note**: without the --redundancy argument it will revert the redundancy tothe default value: 30.

This last command will confirm that you want to update all the tasks.

If you want to see all the availableoptions, please check the **--help** command:

```bash pbs update-task-redundancy --help```

## Deleting tasks from a project

If you need it, you can delete all the tasks from your project, or only oneusing its task.id. For deleting all the tasks, all you've to do is run thefollowing command:

```bash pbs delete_tasks```

This command will confirm that you want to delete all the tasks and associatedtask_runs.

If you want to see all the availableoptions, please check the **--help** command:

```bash pbs delete_tasks --help```

# Documentation

You have more documentation, with real examples at[http://docs.pybossa.com](http://docs.pybossa.com).

Check the [tutorial](http://docs.pybossa.com/en/latest/user/tutorial.html) asit uses **pbs**, and also its [pbs](http://docs.pybossa.com/en/latest/user/pbs.html) sectionin the site.