<div align="center" style="width: 100%; margin: auto">
<a href="" rel="noopener"><img src="https://raw.githubusercontent.com/arthurdjn/geoserver-py/main/medias/geoserver-py.png" alt="Banner"></a>
[![python](https://img.shields.io/badge/python-3.8_%7C_3.9_%7C_3.10_%7C_3.11_%7C_3.12-red.svg?color=009ACF&labelColor=6DBA65&logo=python&logoColor=white)](https://www.python.org/)
[![black](https://img.shields.io/badge/black-formatter-red.svg?color=009ACF&labelColor=6DBA65)](https://github.com/psf/black)
[![mypy](https://img.shields.io/badge/mypy-typing-red.svg?color=009ACF&labelColor=6DBA65)](https://mypy-lang.org)
[![ruff](https://img.shields.io/badge/ruff-linter-red.svg?color=009ACF&labelColor=6DBA65&logo=ruff&logoColor=white)](https://docs.astral.sh/ruff)
[![isort](https://img.shields.io/badge/isort-imports-red.svg?color=009ACF&labelColor=6DBA65)](https://pycqa.github.io/isort/)
[![poetry](https://img.shields.io/badge/poetry-dependencies-red.svg?color=009ACF&labelColor=6DBA65&logo=poetry&logoColor=white)](https://python-poetry.org)
[![pytest](https://img.shields.io/badge/pytest-testing-red.svg?color=009ACF&labelColor=6DBA65&logo=pytest&logoColor=white)](https://pytest.org)
</div>
---
<p align="center">
Unofficial GeoServer python client. Manage workspaces, permissions, upload vectors, rasters and more. Check out the <a href="https://arthurdjn.github.io/geoserver-py">documentation</a> for more information! <br>
<i>We are looking for contributors and feedbacks!</i>
</p>
<br>
## ❓ About
This python package provides a simple interface to communicate with GeoServer. It implements most of the GeoServer REST API endpoints, allowing users to interact with GeoServer programmatically.
### Why?
The purpose of this package is to implement the REST API endpoints with **full type hints** and **[documentation](https://arthurdjn.github.io/geoserver-py)**. This package does not aim to provide a high-level abstraction over the GeoServer REST API, thus it is expected that you have some knowledge of the GeoServer REST API.
### Features
This package supports both **JSON** and **XML** requests and response. It provides type hints for all the methods and classes, making it easier to work with the package.
> [!NOTE]
> This package only relies on `requests` as a dependency, which make it extremely lightweight and easy to install: no need to install GDAL!
#### Get requests
```python
# As JSON
workspaces = geoserver.get_workspaces() # default is "json"
# As XML
workspaces = geoserver.get_workspaces(format="xml")
```
#### Post requests
```python
# As JSON
geoserver.create_workspace(body={"workspace": {"name": "new_workspace"}})
# As XML
geoserver.create_workspace(body="<workspace><name>new_workspace</name></workspace>")
```
### Documentation
We provide several [examples](./notebooks) and a [documentation](https://arthurdjn.github.io/geoserver-py) to help you get started,
<br>
## 🚀 Quick Start
This section will guide you on how to setup and use the package.
### Installation
```bash
pip install geoserver-py
```
### Usage
```python
from geoserver import GeoServer
# Connect to a GeoServer instance
geoserver = GeoServer(
url="http://localhost:8080/geoserver",
username="admin",
password="geoserver"
)
# Get all workspaces
workspaces = geoserver.get_workspaces()
# Create a workspace
geoserver.create_workspace_from_name(name="my_workspace")
# or geoserver.create_workspace(body={"workspace": {"name": "my_workspace"}})
# Get all datastores
datastores = geoserver.get_data_stores(workspace="my_workspace")
# Upload a Shapefile
geoserver.upload_data_store(file="path/to/file.shp", workspace="my_workspace")
# Upload a GeoTIFF
geoserver.upload_coverage_store(file="path/to/file.tif", format="geotiff", workspace="my_workspace")
# Upload a style
geoserver.upload_style(file="path/to/file.sld", workspace="my_workspace")
# etc.
```
<br>
## 📚 Examples
We provide several examples in the [notebooks](./notebooks) folder. These examples are based on the [GeoServer REST API documentation](https://docs.geoserver.org/main/en/user/rest/index.html).
<br>
## 🤗 Contributing
We welcome any contributions, from bug reports to new features! If you want to contribute to the package, please read the [For Developers](#-for-developers) section.
If you simply find the package useful, please consider giving it a star ⭐️ on GitHub.
<br>
## 🧑💻 For Developers
This section if for advanced users who want to contribute to the package. It will guide you on how to setup the package for development.
### Local installation
1. First, clone the repository and install the dependencies:
```bash
git clone https://github.com/arthurdjn/geoserver-py
cd geoserver-py
```
2. Install the dependencies (we recommend using [`poetry`](https://python-poetry.org/) for this)
```bash
poetry install
```
> [!NOTE]
> The usual workflow is to create a fork of the repository, clone it, and then install the dependencies.
### Testing
First, make sure you have a running GeoServer instance. You can run one using the provided `docker-compose` file:
```bash
docker-compose up -d
```
Then, you can run the tests using the following command:
```bash
make tests
```
### Linting, formatting and typing
You can run the linters, formatters and type checkers using the following command:
```bash
make lint # Run all the below commands
make format # Format the code using black
make type # Type check the code using mypy
make isort # Sort the imports using isort
make all # Run all the above commands
```
### Before committing
Make sure to run the `pre-commit` hook before committing, which will check that the formatting, linting and typing are correct:
```bash
make pre-commit
```
> [!NOTE]
> Also make sure the tests are passing.
Once everything is correct, please **create a pull request** to the repository from your local fork.
### About versioning
We follow the [Semantic Versioning](https://semver.org/) guidelines for versioning the package. The version number is defined in the `pyproject.toml` file.
There are some utility commands to automate the versioning and publish associated tags:
```bash
make patch # Bump the patch version
make minor # Bump the minor version
make major # Bump the major version
```
<br>
## 👉 Similar Projects
There are several alternatives to this package, some of them are:
- [`geoserver-rest`](https://github.com/gicait/geoserver-rest) is a Python library for management for geospatial data in GeoServer.
- [`geoserver-restconfig`](https://github.com/GeoNode/geoserver-restconfig) is a python library for manipulating a GeoServer instance via the GeoServer RESTConfig API.
While these packages are great and well-maintained, they do not provide full type hints and customizations over the GeoServer REST API. This library aims to provide a closer API to the GeoServer REST API, making it easier to work with the package.
_We would like to thank the authors of these packages for their contributions to the community, which have inspired us to create `geoserver-py`._
Raw data
{
"_id": null,
"home_page": "https://github.com/arthurdjn/geoserver-py/",
"name": "geoserver-py",
"maintainer": "Arthur Dujardin",
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": "arthurdujardin.github@gmail.com",
"keywords": "geoserver, python, client, api",
"author": "Arthur Dujardin",
"author_email": "arthurdujardin.github@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9f/91/9fd08d096892363c2e7ac05071bb31b8f9a4dd9406ca50967c16143bafeb/geoserver_py-0.1.0.tar.gz",
"platform": null,
"description": "<div align=\"center\" style=\"width: 100%; margin: auto\">\n <a href=\"\" rel=\"noopener\"><img src=\"https://raw.githubusercontent.com/arthurdjn/geoserver-py/main/medias/geoserver-py.png\" alt=\"Banner\"></a>\n\n[![python](https://img.shields.io/badge/python-3.8_%7C_3.9_%7C_3.10_%7C_3.11_%7C_3.12-red.svg?color=009ACF&labelColor=6DBA65&logo=python&logoColor=white)](https://www.python.org/)\n[![black](https://img.shields.io/badge/black-formatter-red.svg?color=009ACF&labelColor=6DBA65)](https://github.com/psf/black)\n[![mypy](https://img.shields.io/badge/mypy-typing-red.svg?color=009ACF&labelColor=6DBA65)](https://mypy-lang.org)\n[![ruff](https://img.shields.io/badge/ruff-linter-red.svg?color=009ACF&labelColor=6DBA65&logo=ruff&logoColor=white)](https://docs.astral.sh/ruff)\n[![isort](https://img.shields.io/badge/isort-imports-red.svg?color=009ACF&labelColor=6DBA65)](https://pycqa.github.io/isort/)\n[![poetry](https://img.shields.io/badge/poetry-dependencies-red.svg?color=009ACF&labelColor=6DBA65&logo=poetry&logoColor=white)](https://python-poetry.org)\n[![pytest](https://img.shields.io/badge/pytest-testing-red.svg?color=009ACF&labelColor=6DBA65&logo=pytest&logoColor=white)](https://pytest.org)\n\n</div>\n\n---\n\n<p align=\"center\">\n Unofficial GeoServer python client. Manage workspaces, permissions, upload vectors, rasters and more. Check out the <a href=\"https://arthurdjn.github.io/geoserver-py\">documentation</a> for more information! <br>\n <i>We are looking for contributors and feedbacks!</i>\n</p>\n\n<br>\n\n## \u2753 About\n\nThis python package provides a simple interface to communicate with GeoServer. It implements most of the GeoServer REST API endpoints, allowing users to interact with GeoServer programmatically.\n\n### Why?\n\nThe purpose of this package is to implement the REST API endpoints with **full type hints** and **[documentation](https://arthurdjn.github.io/geoserver-py)**. This package does not aim to provide a high-level abstraction over the GeoServer REST API, thus it is expected that you have some knowledge of the GeoServer REST API.\n\n### Features\n\nThis package supports both **JSON** and **XML** requests and response. It provides type hints for all the methods and classes, making it easier to work with the package.\n\n> [!NOTE]\n> This package only relies on `requests` as a dependency, which make it extremely lightweight and easy to install: no need to install GDAL!\n\n#### Get requests\n\n```python\n# As JSON\nworkspaces = geoserver.get_workspaces() # default is \"json\"\n\n# As XML\nworkspaces = geoserver.get_workspaces(format=\"xml\")\n```\n\n#### Post requests\n\n```python\n# As JSON\ngeoserver.create_workspace(body={\"workspace\": {\"name\": \"new_workspace\"}})\n\n# As XML\ngeoserver.create_workspace(body=\"<workspace><name>new_workspace</name></workspace>\")\n```\n\n### Documentation\n\nWe provide several [examples](./notebooks) and a [documentation](https://arthurdjn.github.io/geoserver-py) to help you get started,\n\n<br>\n\n## \ud83d\ude80 Quick Start\n\nThis section will guide you on how to setup and use the package.\n\n### Installation\n\n```bash\npip install geoserver-py\n```\n\n### Usage\n\n```python\nfrom geoserver import GeoServer\n\n# Connect to a GeoServer instance\ngeoserver = GeoServer(\n url=\"http://localhost:8080/geoserver\",\n username=\"admin\",\n password=\"geoserver\"\n)\n\n# Get all workspaces\nworkspaces = geoserver.get_workspaces()\n\n# Create a workspace\ngeoserver.create_workspace_from_name(name=\"my_workspace\")\n# or geoserver.create_workspace(body={\"workspace\": {\"name\": \"my_workspace\"}})\n\n# Get all datastores\ndatastores = geoserver.get_data_stores(workspace=\"my_workspace\")\n\n# Upload a Shapefile\ngeoserver.upload_data_store(file=\"path/to/file.shp\", workspace=\"my_workspace\")\n\n# Upload a GeoTIFF\ngeoserver.upload_coverage_store(file=\"path/to/file.tif\", format=\"geotiff\", workspace=\"my_workspace\")\n\n# Upload a style\ngeoserver.upload_style(file=\"path/to/file.sld\", workspace=\"my_workspace\")\n\n# etc.\n```\n\n<br>\n\n## \ud83d\udcda Examples\n\nWe provide several examples in the [notebooks](./notebooks) folder. These examples are based on the [GeoServer REST API documentation](https://docs.geoserver.org/main/en/user/rest/index.html).\n\n<br>\n\n## \ud83e\udd17 Contributing\n\nWe welcome any contributions, from bug reports to new features! If you want to contribute to the package, please read the [For Developers](#-for-developers) section.\n\nIf you simply find the package useful, please consider giving it a star \u2b50\ufe0f on GitHub.\n\n<br>\n\n## \ud83e\uddd1\u200d\ud83d\udcbb For Developers\n\nThis section if for advanced users who want to contribute to the package. It will guide you on how to setup the package for development.\n\n### Local installation\n\n1. First, clone the repository and install the dependencies:\n\n ```bash\n git clone https://github.com/arthurdjn/geoserver-py\n cd geoserver-py\n ```\n\n2. Install the dependencies (we recommend using [`poetry`](https://python-poetry.org/) for this)\n\n ```bash\n poetry install\n ```\n\n> [!NOTE]\n> The usual workflow is to create a fork of the repository, clone it, and then install the dependencies.\n\n### Testing\n\nFirst, make sure you have a running GeoServer instance. You can run one using the provided `docker-compose` file:\n\n```bash\ndocker-compose up -d\n```\n\nThen, you can run the tests using the following command:\n\n```bash\nmake tests\n```\n\n### Linting, formatting and typing\n\nYou can run the linters, formatters and type checkers using the following command:\n\n```bash\nmake lint # Run all the below commands\nmake format # Format the code using black\nmake type # Type check the code using mypy\nmake isort # Sort the imports using isort\nmake all # Run all the above commands\n```\n\n### Before committing\n\nMake sure to run the `pre-commit` hook before committing, which will check that the formatting, linting and typing are correct:\n\n```bash\nmake pre-commit\n```\n\n> [!NOTE]\n> Also make sure the tests are passing.\n\nOnce everything is correct, please **create a pull request** to the repository from your local fork.\n\n### About versioning\n\nWe follow the [Semantic Versioning](https://semver.org/) guidelines for versioning the package. The version number is defined in the `pyproject.toml` file.\n\nThere are some utility commands to automate the versioning and publish associated tags:\n\n```bash\nmake patch # Bump the patch version\nmake minor # Bump the minor version\nmake major # Bump the major version\n```\n\n<br>\n\n## \ud83d\udc49 Similar Projects\n\nThere are several alternatives to this package, some of them are:\n\n- [`geoserver-rest`](https://github.com/gicait/geoserver-rest) is a Python library for management for geospatial data in GeoServer.\n- [`geoserver-restconfig`](https://github.com/GeoNode/geoserver-restconfig) is a python library for manipulating a GeoServer instance via the GeoServer RESTConfig API.\n\nWhile these packages are great and well-maintained, they do not provide full type hints and customizations over the GeoServer REST API. This library aims to provide a closer API to the GeoServer REST API, making it easier to work with the package.\n\n_We would like to thank the authors of these packages for their contributions to the community, which have inspired us to create `geoserver-py`._\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Minimal python client to communicate with Geoserver.",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/arthurdjn/geoserver-py/",
"Homepage": "https://github.com/arthurdjn/geoserver-py/",
"Repository": "https://github.com/arthurdjn/geoserver-py/"
},
"split_keywords": [
"geoserver",
" python",
" client",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7f849587b2cf19e0f5453a1b4dcd356460c9cd89238a1fdc43113cf6707c268a",
"md5": "bd4be2305a8f75b91737512b0b41ae85",
"sha256": "d5ad0860e192ceb14567694e91cafa474d7ef16a12c4c66a8093c9b7296c7366"
},
"downloads": -1,
"filename": "geoserver_py-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bd4be2305a8f75b91737512b0b41ae85",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 26140,
"upload_time": "2024-06-12T22:50:37",
"upload_time_iso_8601": "2024-06-12T22:50:37.549156Z",
"url": "https://files.pythonhosted.org/packages/7f/84/9587b2cf19e0f5453a1b4dcd356460c9cd89238a1fdc43113cf6707c268a/geoserver_py-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f919fd08d096892363c2e7ac05071bb31b8f9a4dd9406ca50967c16143bafeb",
"md5": "d8c739bd2e275abdc2cb98f157fb5cc8",
"sha256": "0858f1315ca346f0e1508fa1cde159f88bc5beac3abc6e4698f291c36b67ff26"
},
"downloads": -1,
"filename": "geoserver_py-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d8c739bd2e275abdc2cb98f157fb5cc8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 27375,
"upload_time": "2024-06-12T22:50:39",
"upload_time_iso_8601": "2024-06-12T22:50:39.307258Z",
"url": "https://files.pythonhosted.org/packages/9f/91/9fd08d096892363c2e7ac05071bb31b8f9a4dd9406ca50967c16143bafeb/geoserver_py-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-12 22:50:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arthurdjn",
"github_project": "geoserver-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "geoserver-py"
}