Setting up dev environment
We highly recommend to use Julius Haertl docker setup for Nextcloud dev setup.
Development of nc-py-api can be done on any OS as it is a pure Python package.
Note
We suggest to use PyCharm, but of course you can use any IDE you like for this like VS Code or Vim.
Steps to setup up the development environment:
Setup Nextcloud locally or remotely.
Install AppAPI, follow it’s steps to register
deploy daemon
if needed.Clone the nc_py_api with shell:
git clone https://github.com/cloud-py-api/nc_py_api.git
Set current working dir to the root folder of cloned nc_py_api with shell:
cd nc_py_api
Create and activate Virtual Environment with shell:
python3 -m venv env
Activate Python Virtual Environment with shell:
source ./env/bin/activate
Update
pip
to the last version with pip:python3 -m pip install --upgrade pip
Install dev-dependencies with pip:
pip install ".[dev]"
Install pre-commit hooks with shell:
pre-commit install
Run nc_py_api with appropriate PyCharm configuration(
register_nc_py_api(xx)
) or if you are not using PyCharm execute this command in the shell:APP_ID=nc_py_api APP_PORT=9009 APP_SECRET=12345 APP_VERSION=1.0.0 NEXTCLOUD_URL=http://nextcloud.local APP_HOST=0.0.0.0 python3 tests/_install.py
In a separate terminal while the
nc_py_api
_install.py script is running execute this command in the shell:make register28
In
tests/gfixture.py
editNC_AUTH_USER
andNC_AUTH_PASS
, if they are different in your setup.Run tests to check that everything works with shell:
python3 -m pytest
Install documentation dependencies if needed with pip:
pip install ".[docs]"
You can easy build documentation with shell:
make docs
Your setup is ready for the developing nc_py_api and Applications based on it. Best of Luck!