From 199903cdebaed33e9f144f233d55154fbf1f37c9 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 5 Jul 2023 16:59:56 +0200 Subject: [PATCH 1/5] Add pyproject.toml --- pyproject.toml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..405b9e3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[project] +name = "libqfieldsync" +description = "the qfieldsync library" +version = "1.0" +authors = [ + { name = "OPENGIS.ch", email = "info@opengis.ch" } +] +dependencies = [ +] + +[project.optional-dependencies] +dev = [ + "pre-commit" +] From ee0a0601a4683a104a751c9cf9e8c3b51666f204 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Tue, 15 Aug 2023 15:22:24 +0200 Subject: [PATCH 2/5] Move and adjust files --- __init__.py => libqfieldsync/__init__.py | 0 layer.py => libqfieldsync/layer.py | 0 offline_converter.py => libqfieldsync/offline_converter.py | 0 project.py => libqfieldsync/project.py | 0 project_checker.py => libqfieldsync/project_checker.py | 5 +++-- {utils => libqfieldsync/utils}/__init__.py | 0 {utils => libqfieldsync/utils}/bad_layer_handler.py | 0 {utils => libqfieldsync/utils}/exceptions.py | 0 {utils => libqfieldsync/utils}/file_utils.py | 0 {utils => libqfieldsync/utils}/logger.py | 0 {utils => libqfieldsync/utils}/qgis.py | 0 {utils => libqfieldsync/utils}/xml.py | 0 tests/test_offline_converter.py | 5 +++-- 13 files changed, 6 insertions(+), 4 deletions(-) rename __init__.py => libqfieldsync/__init__.py (100%) rename layer.py => libqfieldsync/layer.py (100%) rename offline_converter.py => libqfieldsync/offline_converter.py (100%) rename project.py => libqfieldsync/project.py (100%) rename project_checker.py => libqfieldsync/project_checker.py (99%) rename {utils => libqfieldsync/utils}/__init__.py (100%) rename {utils => libqfieldsync/utils}/bad_layer_handler.py (100%) rename {utils => libqfieldsync/utils}/exceptions.py (100%) rename {utils => libqfieldsync/utils}/file_utils.py (100%) rename {utils => libqfieldsync/utils}/logger.py (100%) rename {utils => libqfieldsync/utils}/qgis.py (100%) rename {utils => libqfieldsync/utils}/xml.py (100%) diff --git a/__init__.py b/libqfieldsync/__init__.py similarity index 100% rename from __init__.py rename to libqfieldsync/__init__.py diff --git a/layer.py b/libqfieldsync/layer.py similarity index 100% rename from layer.py rename to libqfieldsync/layer.py diff --git a/offline_converter.py b/libqfieldsync/offline_converter.py similarity index 100% rename from offline_converter.py rename to libqfieldsync/offline_converter.py diff --git a/project.py b/libqfieldsync/project.py similarity index 100% rename from project.py rename to libqfieldsync/project.py diff --git a/project_checker.py b/libqfieldsync/project_checker.py similarity index 99% rename from project_checker.py rename to libqfieldsync/project_checker.py index 89b20f8..61b4727 100644 --- a/project_checker.py +++ b/libqfieldsync/project_checker.py @@ -9,11 +9,12 @@ SyncAction, UnsupportedPrimaryKeyError, ) -from qfieldsync.libqfieldsync.project import ProjectConfiguration, ProjectProperties -from qfieldsync.libqfieldsync.utils.file_utils import isascii from qgis.core import Qgis, QgsMapLayer, QgsProject, QgsSettings from qgis.PyQt.QtCore import QObject +from libqfieldsync.project import ProjectConfiguration, ProjectProperties +from libqfieldsync.utils.file_utils import isascii + from .offline_converter import ExportType if sys.version_info >= (3, 8): diff --git a/utils/__init__.py b/libqfieldsync/utils/__init__.py similarity index 100% rename from utils/__init__.py rename to libqfieldsync/utils/__init__.py diff --git a/utils/bad_layer_handler.py b/libqfieldsync/utils/bad_layer_handler.py similarity index 100% rename from utils/bad_layer_handler.py rename to libqfieldsync/utils/bad_layer_handler.py diff --git a/utils/exceptions.py b/libqfieldsync/utils/exceptions.py similarity index 100% rename from utils/exceptions.py rename to libqfieldsync/utils/exceptions.py diff --git a/utils/file_utils.py b/libqfieldsync/utils/file_utils.py similarity index 100% rename from utils/file_utils.py rename to libqfieldsync/utils/file_utils.py diff --git a/utils/logger.py b/libqfieldsync/utils/logger.py similarity index 100% rename from utils/logger.py rename to libqfieldsync/utils/logger.py diff --git a/utils/qgis.py b/libqfieldsync/utils/qgis.py similarity index 100% rename from utils/qgis.py rename to libqfieldsync/utils/qgis.py diff --git a/utils/xml.py b/libqfieldsync/utils/xml.py similarity index 100% rename from utils/xml.py rename to libqfieldsync/utils/xml.py diff --git a/tests/test_offline_converter.py b/tests/test_offline_converter.py index d40000f..c26d3fe 100644 --- a/tests/test_offline_converter.py +++ b/tests/test_offline_converter.py @@ -21,13 +21,14 @@ import shutil import tempfile +import unittest from pathlib import Path from qgis.core import QgsOfflineEditing, QgsProject -from qgis.testing import start_app, unittest +from qgis.testing import start_app from qgis.testing.mocked import get_iface -from ..offline_converter import ExportType, OfflineConverter +from libqfieldsync.offline_converter import ExportType, OfflineConverter start_app() From adf0323e68a6cf6f55d965ff61d4218ebebb39af Mon Sep 17 00:00:00 2001 From: Adrien Date: Tue, 22 Aug 2023 16:52:29 +0200 Subject: [PATCH 3/5] Filling in some gaps in pyproject.toml + test packaging (#53) * edited pyproject.toml * added CI job for testing packaging * project documentation url * ran formatter --- .github/workflows/continuous_integration.yml | 18 ++++++++++++++ pyproject.toml | 26 ++++++++++++++++---- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index dc81f52..4c8be79 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -32,3 +32,21 @@ jobs: - name: Test on QGIS LTR 3. run: | docker-compose -f .docker/docker-compose.yml run qgis /usr/src/.docker/run-docker-tests.sh + test_packaging: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + cache: 'pip' + - name: Install toolchain + run: pip install build + - name: Package with build + run: python -m build + - name: Install with pip + run: pip install . diff --git a/pyproject.toml b/pyproject.toml index 405b9e3..24206d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,16 @@ +[build-system] +requires = [ + "setuptools>=68.0", + "wheel", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["libqfieldsync"] + +[tool.setuptools.dynamic] +dependencies = { file = ["requirements.txt"] } + [project] name = "libqfieldsync" description = "the qfieldsync library" @@ -5,10 +18,13 @@ version = "1.0" authors = [ { name = "OPENGIS.ch", email = "info@opengis.ch" } ] -dependencies = [ -] +requires-python = ">=3.8" + +[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" -] +dev = ["pre-commit"] From ecbf30fe281b45aa052204186ec24b679c79f0d0 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Tue, 3 Oct 2023 14:34:03 +0200 Subject: [PATCH 4/5] Add package libqfieldsync.utils --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 24206d4..4e7268a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ requires = [ build-backend = "setuptools.build_meta" [tool.setuptools] -packages = ["libqfieldsync"] +packages = ["libqfieldsync", "libqfieldsync.utils"] [tool.setuptools.dynamic] dependencies = { file = ["requirements.txt"] } From 53948c66b1e6ea046a12712263bf3da11e7ac3f1 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Tue, 3 Oct 2023 14:38:18 +0200 Subject: [PATCH 5/5] Fix imports --- libqfieldsync/project_checker.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libqfieldsync/project_checker.py b/libqfieldsync/project_checker.py index 61b4727..edf8d4c 100644 --- a/libqfieldsync/project_checker.py +++ b/libqfieldsync/project_checker.py @@ -4,14 +4,10 @@ from pathlib import Path from typing import Callable, Dict, List, Optional -from qfieldsync.libqfieldsync.layer import ( - LayerSource, - SyncAction, - UnsupportedPrimaryKeyError, -) from qgis.core import Qgis, QgsMapLayer, QgsProject, QgsSettings from qgis.PyQt.QtCore import QObject +from libqfieldsync.layer import LayerSource, SyncAction, UnsupportedPrimaryKeyError from libqfieldsync.project import ProjectConfiguration, ProjectProperties from libqfieldsync.utils.file_utils import isascii