Skip to content
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
19 changes: 14 additions & 5 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
ARG QGIS_TEST_VERSION=latest
FROM qgis/qgis:${QGIS_TEST_VERSION}

RUN apt-get update \
&& apt-get install -y python3-pip \
RUN apt update \
&& apt install -y \
glibc-tools \
&& rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /tmp/

RUN pip3 install -r /tmp/requirements.txt --break-system-packages
# Install uv from the official image, which is a lot faster than installing it with pip
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

ENV LANG=C.UTF-8

# Add crashes dump to STDERR
ENV LD_PRELOAD="/lib/x86_64-linux-gnu/libSegFault.so"
ENV SEGFAULT_SIGNALS="abrt segv"
ENV LIBC_FATAL_STDERR_=1

COPY . /usr/src

RUN uv venv --system-site-packages

WORKDIR /usr/src
11 changes: 0 additions & 11 deletions .docker/docker-compose.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .docker/run-docker-tests.sh

This file was deleted.

5 changes: 5 additions & 0 deletions .docker/xvfb-pytest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e

xvfb-run pytest
13 changes: 7 additions & 6 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ jobs:

- name: Run tests
run: |
docker compose -f .docker/docker-compose.yml run qgis /usr/src/.docker/run-docker-tests.sh
docker build -f .docker/Dockerfile --build-arg QGIS_TEST_VERSION=$QGIS_TEST_VERSION -t libqfieldsync-test .
docker run --rm libqfieldsync-test .docker/xvfb-pytest

test_packaging:
runs-on: ubuntu-latest
Expand All @@ -63,11 +64,11 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6

- name: Install toolchain
run: pip install build
- name: Install uv with all available options
uses: astral-sh/setup-uv@v8.1.0

- name: Package with build
run: python -m build
- name: Package with uv
run: uv build

- name: Install with pip
run: pip install .
run: pip install . --break-system-packages
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ crashlytics.properties
crashlytics-build.properties
fabric.properties

# Mypy
.mypy_cache/

# My super new category
.DS_Store
Expand Down
35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,43 @@

This library facilitates packaging and synchronizing QGIS projects for use with [QField](http://www.qfield.org).

This library is the heart of the QFieldSync QGIS plugin.
This library is the heart of the QFieldSync QGIS plugin and QFieldCloud's QGIS worker container.

More information can be found in the [QField documentation](https://docs.qfield.org/get-started/).

The plugin can be downloaded on the [QGIS plugin repository](https://plugins.qgis.org/plugins/qfieldsync/).
The QFieldSync plugin can be downloaded on the [QGIS plugin repository](https://plugins.qgis.org/plugins/qfieldsync/).


## Development

Improvements are welcome, feel free to fork and open a PR.

### Code style

Code style is done with [pre-commit](https://pre-commit.com).
### Getting started

```
pip install pre-commit
# install pre-commit hook
pre-commit install
This project uses [`uv`](https://docs.astral.sh/uv/getting-started/installation/) for managing it's dependencies.

```shell
git clone git@github.com:opengisch/libqfieldsync.git
cd libqfieldsync

# we need to pass `system-site-packages` to use the local QGIS version
uv venv --system-site-packages

# we use `pre-commit` for code styling, see https://pre-commit.com
uv run pre-commit install
```

## Testing

```console
GITHUB_WORKSPACE=$PWD QGIS_TEST_VERSION=final-3_34_2 docker compose -f .docker/docker-compose.yml run qgis /usr/src/.docker/run-docker-tests.sh
Run local tests (assuming a QGIS installed on host):

```shell
uv run pytest
```

If you want to test with a specific QGIS version, or you don't have QGIS installed, then:

```shell
docker run --rm $(docker build --build-arg QGIS_TEST_VERSION=ltr -q -f .docker/Dockerfile .) .docker/xvfb-pytest
```
48 changes: 22 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
[build-system]
requires = [
"setuptools>=68.0",
"wheel",
[project]
name = "libqfieldsync"
description = "the qfieldsync library"
version = "1.0"
Comment thread
gounux marked this conversation as resolved.
authors = [
{ name = "OPENGIS.ch", email = "info@opengis.ch" }
]
build-backend = "setuptools.build_meta"
requires-python = ">=3.9"

[tool.ruff]
# Support Python 3.9+.
target-version = "py39"
[project.urls]
homepage = "https://github.com/opengisch/libqfieldsync"
documentation = "https://docs.qfield.org/get-started/"
repository = "https://github.com/opengisch/libqfieldsync"
tracker = "https://github.com/opengisch/libqfieldsync/issues"

[project.optional-dependencies]
dev = ["pre-commit"]

[dependency-groups]
dev = [
"pre-commit>=2.21.0",
"pytest>=7.4.4",
"pytest-cov>=4.1.0",
]

[tool.ruff.lint]
select = ["ALL"]
Expand Down Expand Up @@ -105,21 +119,3 @@ exclude = [
"__pycache__",
]
select = ["CLB100", "IF100"]

[project]
name = "libqfieldsync"
description = "the qfieldsync library"
version = "1.0"
authors = [
{ name = "OPENGIS.ch", email = "info@opengis.ch" }
]
requires-python = ">=3.7"

[project.urls]
homepage = "https://github.com/opengisch/libqfieldsync"
documentation = "https://docs.qfield.org/get-started/"
repository = "https://github.com/opengisch/libqfieldsync"
tracker = "https://github.com/opengisch/libqfieldsync/issues"

[project.optional-dependencies]
dev = ["pre-commit"]
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

Loading