Package: pybossa-pbs
PBS - a PYBOSSA command line interfacepbsis a very simple command line interface to a PYBOSSA server. It
allows you to create projects, add tasks (from a CSV, JSON, PO or a
PROPERTIES file) with a nice progress bar, delete them and update the
project templates (tutorial, task_presenter, and descriptions) all from
the command line.RequirementsPYBOSSA server>= 2.3.7.Installationpbs is available in Pypi, so you can install the software with pip:pipinstallpybossa-pbsIf you have all the dependencies, the package will be installed and you
will be able 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–editableflag after cloning the repository:git clone https://github.com/Scifabric/pbs.git
cd pbs
virtualenv env
source env/bin/activate
pip install --editable .This will install the pbs package, and you’ll be able to modify it,
patch it, etc. If you improve it, please, let us know and share the code
so we can integrate it back ;-)Configuring pbspbs is very handy when you work with one or two PYBOSSA servers. The
best way to configure it is creating a simple config file in your home
folder:cd~vim.pybossa.cfgThe file should have the following structure:[default]server:http://theserver.comapikey:yourkeyIf you are working with more servers, add another section below it. For
example:[default]server:http://theserver.comapikey:yourkey[crowdcrafting]server:http://crowdcrafting.orgapikey:yourkeyincrowdcraftingBy default pbs will use the credentials of the section default, so you
don’t have to type anything to use those values. However, if you want to
do actions in the other server all you have to do is the following:pbs--credentialscrowdcrafting--helpThat command will use the values of the crowdcrafting section.Getting out of the API contextPYBOSSA by default returns first your projects, meaning that if you want
to work on a project that you don’t own, it will return an error as the
project will not be found. For solving this issue you have two options:In the config file, by adding a new flag: all:1On the command line, passing the –all=1 flagCreating a projectCreating a project is very simple. All you have to do is create a file
namedproject.jsonwith the following fields:{"name":"Flickr Person Finder","short_name":"flickrperson","description":"Image pattern recognition","question":"Do you see a real human face in this photo?"}If you use the nameproject.jsonyou will not have to pass the file
name via an argument, as it’s the named used by default. Once you have
the file created, run the following command:pbscreate_projectThat command should create the project. If you want to see all the
available options, please check the–helpcommand:pbscreate_project--helpAdding tasks to a projectAdding tasks is very simple. You can have your tasks in three formats:JSONExcel (xlsx from 2010. It imports the first sheet)CSVPO (any po file that you want to translate)PROPERTIES (any PROPERTIES file that you want to translate)Therefore, adding tasks to your project is as simple as this command:pbsadd_tasks--tasks-filetasks_file.jsonIf you want to see all the available options, please check the–helpcommand:NOTE: By default PYBOSSA servers use a rate limit for avoiding abuse
of the API. For this reason, you can only do usually 300 requests per
every 15 minutes. If you are going to add more than 300 tasks, pbs will
detect it and warn you, auto-enabling the throttling for you to respect
the limits.pbsadd_tasks--helpUpdating project templatesNow that you have added tasks, you can work in your templates. All you
have to do to add/update the templates to your project is running the
following command:pbsupdate_projectThat command needs to have in the same folder where you are running it,
the following files:template.htmllong_description.mdtutorial.htmlIf you want to use another template, you can via arguments:pbsupdate_project--template/tmp/template.htmlIf you want to see all the available options, please check the–helpcommand:pbsupdate_project--helpUsing an external JavaScript fileSince pbs >= 2.3.0, pbs will check for an external JavaScript file namedbundle.jsorbundle.min.js. If any of those files exist, then, they
will be added at the bottom of 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.NOTEIf there’s a minified version of the file, bundle.min.js, that
file will be always used instead of bundle.js.Auto-updating while developing a PYBOSSA projectAt 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 these scenarios, pbs comes with a handy feature: –watch.
This argument will tell pbs to run update_project automatically when
template.html, tutorial.html or long_description.md are modified in the
file system. As simple as that.You can run it like this:pbsupdate_project--watchAnd the output will be similar to this:GIF of pbs in actionNOTE: this also works with bundle.js files :smile: Thus, you can
have webpack transpiling automatically your code, and pbs will update
automatically your project with the new code.Updating tasks redundancy from a projectIf you need it, you can update the redundancy of a task using its ID or
all the tasks skipping the ID. For example, to update the redundancy of
one task to 5:pbsupdate-task-redundancy--task-id34234--redundancy5To update all of them:pbsupdate-task-redundancy--redundancy5Note: without the –redundancy argument it will revert the redundancy
to the default value: 30.This last command will confirm that you want to update all the tasks.If you want to see all the available options, please check the–helpcommand:pbsupdate-task-redundancy--helpDeleting tasks from a projectIf you need it, you can delete all the tasks from your project, or only
one using its task.id. For deleting all the tasks, all you’ve to do is
run the following command:pbsdelete_tasksThis command will confirm that you want to delete all the tasks and
associated task_runs.If you want to see all the available options, please check the–helpcommand:pbsdelete_tasks--helpAdding helping materials to a projectAdding helping materials is very simple. You can have your materials in
three formats:JSONExcel (xlsx from 2010. It imports the first sheet)CSVTherefore, adding helping materials to your project is as simple as this
command:pbsadd_helpingmaterials--helping-materials-lfilefile.xlsx--helping-typexlsxIf you want to see all the available options, please check the–helpcommand:NOTE: By default PYBOSSA servers use a rate limit for avoiding abuse
of the API. For this reason, you can only do usually 300 requests per
every 15 minutes. If you are going to add more than 300 tasks, pbs will
detect it and warn you, auto-enabling the throttling for you to respect
the limits.NOTE: PYBOSSA helping materials allows you to upload media files like
videos, images, or sounds to support your project tutorials. The command
line pbs will check for a column in your file with the namefile_pathso it can upload it first into the server. Please, be sure that the file
(or files) path is reachable from the helping materials file.pbsadd_helpingmaterials--helpRunning the TestsTo run the test suite for pbs, first installnote:apt-getinstallpython-noseTo run all tests, execute the following from the pbs project directory:noseteststestDocumentationYou have more documentation, with real examples athttp://docs.pybossa.com.Check thetutorialas
it usespbs, and also itspbssection in the
site.Copyright / LicenseCopyright (C) 2017Scifabric LTD.License: see LICENSE file.