Skip to content

Install and contribute¤

Install and run (simple version)¤

First, install node. It is recommended to use nvm to do so.

Then:

# clone 
git clone https://github.com/pierre-24/cp2k-basis.git
cd cp2k-basis

# optional (but recommended): create virtualenv
python -m venv virtualenv
source venv/bin/activate

# install dependencies
make install
make install-front

# build front
make front

# run the webservice:
# either:
make run
# or,
flask --app cp2k_basis_webservice run

If you want to use your own library of basis and pseudopotentials, check out this page, and then:

# create an instance folder
# see https://flask.palletsprojects.com/en/latest/config/#instance-folders
mkdir instance

# copy source
cp library/DATA_SOURCES.yml instance/

# after editing the DATA_SOURCES.yml file to fit your needs, 
# run the `cb_fetch_data` command to create a new library:
cb_fetch_data instance/DATA_SOURCES.yml -o instance/library.h5 

# setup a custom config
echo "LIBRARY='instance/library.h5'" > instance/settings.py

And then you can restart the webservice.

Contribute¤

Contributions, either with issues or pull requests are welcomed.

Install¤

If you want to contribute, this is the usual deal: start by forking, then clone your fork and use the following install procedure instead.

cd cp2k-basis

# definitely recommended in this case: use a virtualenv!
python -m venv virtualenv
source venv/bin/activate

# install also dev dependencies
pip install pip-tools
make install-dev
make install-front

# ... then build front and run (see above)

Tips to contribute¤

  • A useful setting is to setup the webservice to use the (smaller) test library for development:

    mkdir instance
    echo "LIBRARY='tests/LIBRARY_EXAMPLE.h5'" > instance/settings.py
    

    The webservice should then be faster to start & reload.

  • A good place to start is the list of issues. In fact, it is easier if you start by filling an issue, and if you want to work on it, says so there, so that everyone knows that the issue is handled.

  • Don't forget to work on a separate branch. Since this project follow the git flow, you should base your branch on dev, not work in it directly:

    git checkout -b new_branch origin/dev
    
  • Don't forget to regularly run the linting and tests:

    make lint
    make test
    

    Indeed, the code follows the PEP-8 style recommendations, checked by flake8, for the python part and use jshint for the JS part. Having an extensive test suite is also a good idea to prevent regressions.

  • If you modify the front (i.e., the JS script file or the stylesheet), don't forget to rebuild the front to see the effects:

    make front
    

    Indeed, both JS and SCSS are minified.

  • If you want to see and edit the doc, you can run the mkdocs webserver:

    make doc-serve
    
  • Pull requests should be unitary, and include unit test(s) and documentation if needed. The test suite and lint must succeed for the merge request to be accepted.