<commit_before>Local development
=================

Prerequisites
-------------

* GCC, make, and similar (``apt-get install build-essential``)
* PostgreSQL development headers (``apt-get install libpq-dev``)
* Python 2.7 with development headers (``apt-get install python-dev``)
* virtualenv (``apt-get install python-virtualenv``)
* pip (``apt-get install python-pip``)
* git (``apt-get install git``)
* Heroku Toolbelt (https://toolbelt.heroku.com/)

Code style guide
----------------

We follow `plone.api's style guide
<http://ploneapi.readthedocs.org/en/latest/contribute/conventions.html>`_. Read
it & use it.


Setting up a local development environment
------------------------------------------

Prepare the environment::

    # fetch latest code
    $ git clone https://github.com/ferewuz/balistos.git
    $ cd balistos

    # build development environment
    $ make

Now you can run a variety of commands::

    # if your DB is empty, populate it with demo content
    $ make db

    # Start the development instance of Pyramid
    $ bin/pserve etc/development.ini --reload

    # development commands
    $ make docs  # generate HTML format of docs for local viewing
    $ make tests  # run all tests
    $ make coverage  # generate HTML report of test coverage
    $ make clean  # clean up if something is broken and start from scratch<commit_msg>Initial docs on how to run alembic<commit_after>Local development
=================

Prerequisites
-------------

* GCC, make, and similar (``apt-get install build-essential``)
* PostgreSQL development headers (``apt-get install libpq-dev``)
* Python 2.7 with development headers (``apt-get install python-dev``)
* virtualenv (``apt-get install python-virtualenv``)
* pip (``apt-get install python-pip``)
* git (``apt-get install git``)
* Heroku Toolbelt (https://toolbelt.heroku.com/)

Code style guide
----------------

We follow `plone.api's style guide
<http://ploneapi.readthedocs.org/en/latest/contribute/conventions.html>`_. Read
it & use it.


Setting up a local development environment
------------------------------------------

Prepare the environment::

    # fetch latest code
    $ git clone https://github.com/ferewuz/balistos.git
    $ cd balistos

    # build development environment
    $ make

Now you can run a variety of commands::

    # if your DB is empty, populate it with demo content
    $ make db

    # Start the development instance of Pyramid
    $ bin/pserve etc/development.ini --reload

    # development commands
    $ make docs  # generate HTML format of docs for local viewing
    $ make tests  # run all tests
    $ make coverage  # generate HTML report of test coverage
    $ make clean  # clean up if something is broken and start from scratch


Running migration script
------------------------

For database migration we are using alembic scripts

Add a new alembic upgrade script::

    $ bin/alembic -c etc/development.ini -n app:main revision --autogenerate -m "YOUR REVISION INFO"

Run the script::

    $ bin/alembic -c etc/development.ini -n app:main upgrade head
{'fraction_non_alphanumeric': 0.15196876016921576, 'fraction_numerical': 0.0013016596160104132, 'mean_word_length': 2.8233830845771144, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '3899267', 'n_tokens_mistral': 888, 'n_tokens_neox': 833, 'n_words': 321}