Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve development guide #357

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"editor.rulers": [
88
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The CHANGELOG format tries to complies with [Keep a Changelog](https://keepachan

## Git hooks

We use git hooks through [pre-commit](https://pre-commit.com/) to enforce and automatically check some "rules". Please install it before to push any commit.
We use git hooks through [pre-commit](https://pre-commit.com/) to enforce and automatically check some "rules". Please install it before any commit: `pre-commit install`.

See the relevant configuration file: `.pre-commit-config.yaml`.

Expand Down
4 changes: 2 additions & 2 deletions docs/development/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Project uses Sphinx to generate documentation from docstrings (documentation in-

To build it:

```bash
```sh
# install aditionnal dependencies
python -m pip install -U -r requirements/documentation.txt
# build it
Expand All @@ -19,7 +19,7 @@ Open `docs/_build/index.html` in a web browser.

## Write documentation using live render

```bash
```sh
sphinx-autobuild -b html docs/ docs/_build
```

Expand Down
29 changes: 27 additions & 2 deletions docs/development/testing.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
# Tests

The project aims to be fully tested on every targetted platform through intensive CI/CD on every Pull Request.

Still, it's preferable to run tests locally before pushing to the public remote repository.

## Structure

- tests are located in the `tests` subfolder
- a test file is prefixed with `test_`
- ideally a test is written using the standard library, so as a "pure" unittest class, even if for some needs the pytest framework can be used.
- quick tests scripts can be stored in `tests/dev` folder to illustrate or check a behavior

## Requirements

To run the tests, you need to install development requirements ([Ubuntu](ubuntu) or [Windows](windows)).
To run the tests, you need to install development requirements ([Ubuntu](./ubuntu.md#develop-on-ubuntu) or [Windows](./windows.md#develop-on-windows)).

Complete it by installing tests requirements:

```sh
python -m pip install -U -r requirements/testing.txt
```

## Run

```bash
Simply run Pytest:

```sh
pytest
```

It's also possible to run an individual test:

```sh
python -m unittest tests.test_qplugin_object.TestQgisPluginObject.test_profile_load_from_json_basic
```
21 changes: 14 additions & 7 deletions docs/development/ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,54 @@
Tested on:

- Ubuntu 20.04
- Ubuntu 22.04

## Install Python and Git

Install system requirements:

```bash
```sh
sudo apt install git python3-pip python3-virtualenv python3-venv virtualenv
```

Clone the repository where you want:

```bash
```sh
git clone https://github.com/Guts/qgis-deployment-cli.git
# or using ssh
git clone git@github.com:Guts/qgis-deployment-cli.git
```

Create and enter virtual environment (change the path at your convenience):

```bash
```sh
python3 -m venv .venv
source .venv/bin/activate
```

## Install project requirements

```bash
```sh
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/development.txt
```

## Install git hooks

```sh
pre-commit install
```

## Install project

```bash
```sh
python -m pip install -e .
```

Try it with:

```bash
qgis-deployment-toolbelt
```sh
qgis-deployment-toolbelt --help
```

Happy coding!
21 changes: 18 additions & 3 deletions docs/development/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Tested on:

## Requirements

- [Python 3.10+ installed with the Windows MSI installer](https://www.python.org/downloads/windows/) (version from the Windows store is not working)
- [Python 3.10+ installed with the Windows MSI installer](https://www.python.org/downloads/windows/) (version from the Windows store is not working with virtual environments)
- [Git](https://git-scm.com/download/win) and/or [GitHub Desktop](https://desktop.github.com/)

## Enable remote scripts (for virtual environment)

Open a Powershell prompt as **administrator** inside the repository folder:

```powershell
# if not already done, enable scripts - required by virtualenv
# if not already done, enable scripts - required by virtualenv
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```

Expand Down Expand Up @@ -44,9 +44,24 @@ python -m pip install -U pip setuptools wheel

# install dependencies
python -m pip install -U -r requirements/development.txt
```

## Install git hooks

```sh
pre-commit install
```

# finally, install the package in editable mode
## Install project

```sh
python -m pip install -e .
```

Try it with:

```sh
qgis-deployment-toolbelt --help
```

Happy coding!
8 changes: 4 additions & 4 deletions docs/guides/howto_qgis_get_plugin_id.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# How to get a plugin ID

## Method 1 :
## Method 1

1. Open the repository in your browser. Example for the official set on QGIS 3.28: <https://plugins.qgis.org/plugins/plugins.xml?qgis=3.28>
1. Open the RAW mode (or source), typing `Ctrl + U` or right-click and select `View page source`
1. Use your browser search `Ctrl + F` to look for the plugin you want
1. Grab the `plugin_id` attribute:

![Plugin ID into official repository - Example QuickOSM](/static/repository_plugins_plugin_id.webp)
![Plugin ID into official repository - Example QuickOSM](../static/repository_plugins_plugin_id.webp)

## Method 2 :
## Method 2

1. Search for the plugin on QGIS plugin search page. Example for the official set on QGIS 3.28: <https://plugins.qgis.org/search>
2. Identify the plugin you want in the search results list
3. The plugin ID is the number between brackets at the left of the plugin name

![Plugin ID into plugin search page - Example Franch Locator Filter](/static/plugin_search.png)
![Plugin ID into plugin search page - Example Franch Locator Filter](../static/plugin_search.png)
4 changes: 2 additions & 2 deletions docs/guides/howto_windows_sign_executable.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to: Sign the executable
# How to sign the executable on Windows

## Self-signed certificate

Expand Down Expand Up @@ -63,4 +63,4 @@ Requirements:

Opening the properties of the executable, the related tab should look like this:

![QGIS Deployment Toolbelt - Properties security](/static/executable_windows_properties_signed.png)
![QGIS Deployment Toolbelt - Properties security](/..static/executable_windows_properties_signed.png)