Getting Started with Shuup Development¶
Note
If you are planning on using Shuup to build your own shop, read the Getting Started with Shuup guide instead.
Note
Interested in contributing to Shuup? Take a look at our Contribution Guide.
Requirements¶
- Python 2.7.9+/3.4+. https://www.python.org/download/.
- Node.js (v0.12 or above). https://nodejs.org/en/download/
- Any database supported by Django.
Installation for Shuup Development¶
To start developing Shuup, you’ll need a Git checkout of Shuup and a Github fork of Shuup for creating pull requests. Github pull requests are used to get your changes into Shuup Base.
If you haven’t done so already, create a fork of Shuup in Github by clicking the “Fork” button at https://github.com/shuup/shuup and clone the fork to your computer as usual. See Github Help about forking repos for details.
Setup a virtualenv and activate it. You may use the traditional
virtualenv
command, or the newerpython -m venv
if you’re using Python 3. See Virtualenv User Guide, if you are unfamiliar with virtualenv. For example, following commands create and activate a virtualenv in Linux:virtualenv shuup-venv . shuup-venv/bin/activate
Finally, you’ll need to install Shuup in the activated virtualenv in development mode. To do that, run the following commands in the root of the checkout (within the activated virtualenv):
pip install -e .[everything]
Workbench, the built-in test project¶
The Workbench project in the repository is a self-contained Django project set up to use an SQLite database. It is used by the test suite and is also useful for development on its own.
Practically the only difference to a normal Django project is that instead
of python manage.py
, one uses python -m shuup_workbench
.
To get started with Workbench, invoke the following in the Shuup working copy root.
# Migrate database.
python -m shuup_workbench migrate
# Import some basic data.
python -m shuup_workbench shuup_populate_mock --with-superuser=admin
# Run the Django development server (on port 8000 by default).
python -m shuup_workbench runserver
You can use the credentials admin
/admin
, that is username admin
and password admin
to log in as a superuser on http://127.0.0.1:8000/ .
Building resources¶
Shuup uses JavaScript and CSS resources that are compiled using various
Node.js packages. These resources are compiled automatically by
setup.py
when installing Shuup with pip, but if you make changes to
the source files (e.g. under shuup/admin/static_src
), the resources
have to be rebuilt.
This can be done with
python setup.py build_resources
The command also accepts couple arguments, see its help for more details:
python setup.py build_resources --help
Running tests¶
To run tests in the active virtualenv:
py.test -v --nomigrations shuup_tests
# Or with coverage
py.test -vvv --nomigrations --cov shuup --cov-report html shuup_tests
To run tests for all supported Python versions run:
pip install tox # To install tox, needed just once
tox
Collecting translatable messages¶
To update the PO catalog files which contain translatable (and
translated) messages, issue shuup_makemessages
management command in
the shuup
directory:
cd shuup && python -m shuup_workbench shuup_makemessages