# The official QFieldCloud SDK and CLI
`qfieldcloud-sdk` is the official client to connect to QFieldCloud API either as a python module, or directly from the command line.
## Contents
- [Installation](#install)
- [CLI usage](#cli-usage)
- [Module usage](#module-usage)
## Install
### Linux/macOS
pip3 install qfieldcloud-sdk
### Windows
Install Python with your favorite package manager. Then:
python -m pip install qfieldcloud-sdk
## CLI usage
The package also ships with the official QFieldCloud CLI tool.
### Usage
```
qfieldcloud-cli [OPTIONS] COMMAND [ARGS]...
```
### Examples
```shell
# logs in user "user" with password "pass"
qfieldcloud-cli login user pass
# gets the projects of user "user" with password "pass" at "https://localhost/api/v1/"
qfieldcloud-cli -u user -p pass -U https://localhost/api/v1/ list-projects
# gets the projects of user authenticated with token `QFIELDCLOUD_TOKEN` at "https://localhost/api/v1/" as JSON
export QFIELDCLOUD_URL=https://localhost/api/v1/
export QFIELDCLOUD_TOKEN=017478ee2464440cb8d3e98080df5e5a
qfieldcloud-cli --json list-projects
```
More detailed documentation can be found [here](https://docs.qfield.org/reference/qfieldcloud/sdk/)
## Module usage
```python
from import sdk
client = sdk.Client(url="https://app.qfield.cloud/api/v1/")
client.login(
username="user1",
password="pass1",
)
projects = client.list_projects()
> projects
Projects:
0 myusername/myproject1
1 myusername/myproject2
...
```
## Development
Contributions are more than welcome!
### Code style
Code style done with [precommit](https://pre-commit.com/).
```
pip install pre-commit
# if you want to have git commits trigger pre-commit, install pre-commit hook:
pre-commit install
# else run manually before (re)staging your files:
pre-commit run --all-files
```
### Cloning the project
One time action to clone and setup:
```shell
git clone https://github.com/opengisch/qfieldcloud-sdk-python
cd qfieldcloud-sdk-python
# install dev dependencies
python3 -m pip install pipenv
pre-commit install
# install package in a virtual environment
pipenv install -r requirements.txt
```
To run CLI interface for development purposes execute:
```shell
pipenv shell # if your pipenv virtual environment is not active yet
python -m qfieldcloud_sdk
```
To ease development, you can set a `.env` file. Therefore you can use directly the `qfieldcloud-cli` executable:
```
cp .env.example .env
pipenv run qfieldcloud-cli
```
### Building the package
```shell
# make sure your shell is sourced to no virtual environment
deactivate
# build
python3 -m build
# now either activate your shell with
pipenv shell
# and install with
python -m pip install . --force-reinstall
# or manually ensure it's pipenv and not your global pip doing the installation
pipenv run pip install . --force-reinstall
```
VoilĂ !
Raw data
{
"_id": null,
"home_page": null,
"name": "qfieldcloud-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "QFieldCloud, QField, QGIS, CI, SDK, CLI",
"author": null,
"author_email": "Ivan Ivanov <ivan@opengis.ch>",
"download_url": "https://files.pythonhosted.org/packages/d2/ae/26507b8b1e4e3c43204169c016421366d170c4a76b34f28f5f482b349f1d/qfieldcloud_sdk-0.9.0.tar.gz",
"platform": null,
"description": "# The official QFieldCloud SDK and CLI\n\n`qfieldcloud-sdk` is the official client to connect to QFieldCloud API either as a python module, or directly from the command line.\n\n## Contents\n\n- [Installation](#install)\n- [CLI usage](#cli-usage)\n- [Module usage](#module-usage)\n\n## Install\n\n### Linux/macOS\n\n pip3 install qfieldcloud-sdk\n\n### Windows\n\nInstall Python with your favorite package manager. Then:\n\n python -m pip install qfieldcloud-sdk\n\n## CLI usage\n\nThe package also ships with the official QFieldCloud CLI tool.\n\n### Usage\n\n```\nqfieldcloud-cli [OPTIONS] COMMAND [ARGS]...\n```\n\n### Examples\n\n```shell\n# logs in user \"user\" with password \"pass\"\nqfieldcloud-cli login user pass\n\n# gets the projects of user \"user\" with password \"pass\" at \"https://localhost/api/v1/\"\nqfieldcloud-cli -u user -p pass -U https://localhost/api/v1/ list-projects\n\n# gets the projects of user authenticated with token `QFIELDCLOUD_TOKEN` at \"https://localhost/api/v1/\" as JSON\nexport QFIELDCLOUD_URL=https://localhost/api/v1/\nexport QFIELDCLOUD_TOKEN=017478ee2464440cb8d3e98080df5e5a\nqfieldcloud-cli --json list-projects\n```\n\nMore detailed documentation can be found [here](https://docs.qfield.org/reference/qfieldcloud/sdk/)\n\n## Module usage\n\n```python\nfrom import sdk\n\nclient = sdk.Client(url=\"https://app.qfield.cloud/api/v1/\")\nclient.login(\n username=\"user1\",\n password=\"pass1\",\n)\n\nprojects = client.list_projects()\n> projects\nProjects:\n0 myusername/myproject1\n1 myusername/myproject2\n...\n```\n\n## Development\n\nContributions are more than welcome!\n\n### Code style\n\nCode style done with [precommit](https://pre-commit.com/).\n\n```\npip install pre-commit\n# if you want to have git commits trigger pre-commit, install pre-commit hook:\npre-commit install\n# else run manually before (re)staging your files:\npre-commit run --all-files\n```\n\n### Cloning the project\n\nOne time action to clone and setup:\n\n```shell\ngit clone https://github.com/opengisch/qfieldcloud-sdk-python\ncd qfieldcloud-sdk-python\n# install dev dependencies\npython3 -m pip install pipenv\npre-commit install\n# install package in a virtual environment\npipenv install -r requirements.txt\n```\nTo run CLI interface for development purposes execute:\n\n```shell\npipenv shell # if your pipenv virtual environment is not active yet\npython -m qfieldcloud_sdk\n```\nTo ease development, you can set a `.env` file. Therefore you can use directly the `qfieldcloud-cli` executable:\n```\ncp .env.example .env\npipenv run qfieldcloud-cli\n```\n\n### Building the package\n\n```shell\n# make sure your shell is sourced to no virtual environment\ndeactivate\n# build\npython3 -m build\n# now either activate your shell with\npipenv shell\n# and install with\npython -m pip install . --force-reinstall\n# or manually ensure it's pipenv and not your global pip doing the installation\npipenv run pip install . --force-reinstall\n```\nVoil\u00e0!\n",
"bugtrack_url": null,
"license": null,
"summary": "The official QFieldCloud SDK and CLI.",
"version": "0.9.0",
"project_urls": {
"documentation": "https://github.com/opengisch/qfieldcloud-sdk-python",
"homepage": "https://github.com/opengisch/qfieldcloud-sdk-python",
"repository": "https://github.com/opengisch/qfieldcloud-sdk-python",
"tracker": "https://github.com/opengisch/qfieldcloud-sdk-python/issues"
},
"split_keywords": [
"qfieldcloud",
" qfield",
" qgis",
" ci",
" sdk",
" cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "00c17745320e38598f2eb0e6b6a0d01150b2a554914cf696b1de3c5fc08fbc7e",
"md5": "a97bc695ef1d25cb6ec0c4ca89f10bb4",
"sha256": "f13fc8b7c37e7947747377f909d0c9b6cf0e34d60648d6cb80826d62bc2473d0"
},
"downloads": -1,
"filename": "qfieldcloud_sdk-0.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a97bc695ef1d25cb6ec0c4ca89f10bb4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21281,
"upload_time": "2024-10-04T19:24:43",
"upload_time_iso_8601": "2024-10-04T19:24:43.439116Z",
"url": "https://files.pythonhosted.org/packages/00/c1/7745320e38598f2eb0e6b6a0d01150b2a554914cf696b1de3c5fc08fbc7e/qfieldcloud_sdk-0.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d2ae26507b8b1e4e3c43204169c016421366d170c4a76b34f28f5f482b349f1d",
"md5": "62a3fae608e3ac452324a643184d3cdd",
"sha256": "77b3fd33a345f1491b093549a926b877ce42c474357b7a8d598343771f9ffbfa"
},
"downloads": -1,
"filename": "qfieldcloud_sdk-0.9.0.tar.gz",
"has_sig": false,
"md5_digest": "62a3fae608e3ac452324a643184d3cdd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 24226,
"upload_time": "2024-10-04T19:24:44",
"upload_time_iso_8601": "2024-10-04T19:24:44.919631Z",
"url": "https://files.pythonhosted.org/packages/d2/ae/26507b8b1e4e3c43204169c016421366d170c4a76b34f28f5f482b349f1d/qfieldcloud_sdk-0.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-04 19:24:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "opengisch",
"github_project": "qfieldcloud-sdk-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "certifi",
"specs": [
[
">=",
"2023.7.22"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
">=",
"3.2.0"
]
]
},
{
"name": "click",
"specs": [
[
">=",
"8.1.5"
]
]
},
{
"name": "idna",
"specs": [
[
">=",
"3.4"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.31.0"
]
]
},
{
"name": "tqdm",
"specs": [
[
">=",
"4.65.0"
]
]
},
{
"name": "urllib3",
"specs": [
[
">=",
"2.0.7"
]
]
},
{
"name": "pathvalidate",
"specs": [
[
">=",
"3.2.1"
]
]
}
],
"lcname": "qfieldcloud-sdk"
}