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:

  1. Setup Nextcloud locally or remotely.

  2. Install AppAPI, follow it’s steps to register deploy daemon if needed.

  3. Clone the nc_py_api with shell:

    git clone https://github.com/cloud-py-api/nc_py_api.git
    
  4. Set current working dir to the root folder of cloned nc_py_api with shell:

    cd nc_py_api
    
  5. Create and activate Virtual Environment with shell:

    python3 -m venv env
    
  6. Activate Python Virtual Environment with shell:

    source ./env/bin/activate
    
  7. Update pip to the last version with pip:

    python3 -m pip install --upgrade pip
    
  8. Install dev-dependencies with pip:

    pip install ".[dev]"
    
  9. Install pre-commit hooks with shell:

    pre-commit install
    
  10. 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
    
  11. In a separate terminal while the nc_py_api _install.py script is running execute this command in the shell:

    make register28
    
  12. In tests/gfixture.py edit NC_AUTH_USER and NC_AUTH_PASS, if they are different in your setup.

  13. Run tests to check that everything works with shell:

    python3 -m pytest
    
  14. Install documentation dependencies if needed with pip:

    pip install ".[docs]"
    
  15. You can easy build documentation with shell:

    make docs
    
  16. Your setup is ready for the developing nc_py_api and Applications based on it. Best of Luck!