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
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on: [ push, pull_request ]

jobs:
main:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -19,15 +19,15 @@ jobs:
- name: Install requirements 📦
run: |
pip3 install -e .
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
pip3 install -r docs/requirements.txt
pip3 install ".[dev]"
pip3 install ".[docs]"
pip3 install ".[test]"
- name: run tests ⚙️
run: python3 -m pytest
run: pytest tests/
- name: run tests in offline mode
if: matrix.python-version == '3.12'
run: |
python3 -m pytest \
pytest tests/\
-m "not online" \
--disable-socket \
--deselect="tests/doctests/wcs_thredds.txt::wcs_thredds.txt" \
Expand All @@ -45,4 +45,4 @@ jobs:
- name: build docs 🏗️
run: cd docs && make html
- name: run flake8 ⚙️
run: flake8 owslib
run: flake8 owslib/
9 changes: 5 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ jobs:
python-version: ["3.12"]
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}

- name: Install requirements 📦
run: |
pip install -e .
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install ".[dev]"
pip install ".[docs]"
pip install ".[test]"

- name: run tests ⚙️
run: python -m pytest
run: pytest tests/
7 changes: 2 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
include LICENSE
include *.md
include *.rst
include *.txt
recursive-exclude tests *
# this file controls the contents of sdist
prune tests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Releasing

```bash
# update version
vi owslib/__init__.py
vi pyproject.toml # update [project]/version
git commit -m 'update release version' owslib/__init__.py
# push changes
git push origin master
Expand Down
13 changes: 12 additions & 1 deletion owslib/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
__version__ = '0.36.dev0'
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2026 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@gmail.com>
#
# Contact email: tomkralidis@gmail.com
# =============================================================================

from owslib.util import get_package_version

__version__ = get_package_version()
13 changes: 12 additions & 1 deletion owslib/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2025 Tom Kralidis
# Copyright (c) 2026 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@gmail.com>
#
Expand All @@ -12,6 +12,7 @@
import copy
from copy import deepcopy
from datetime import datetime, timedelta, timezone
import importlib.metadata
from io import StringIO, BytesIO
import os
import re
Expand Down Expand Up @@ -1068,3 +1069,13 @@ def str2bool(value: Union[bool, str]) -> bool:
value2 = value.lower() in ('yes', 'true', 't', '1', 'on')

return value2


def get_package_version() -> str:
"""
Helper function to get package version

:returns: `str` of version of package
"""

return importlib.metadata.version('OWSLib')
60 changes: 59 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
[build-system]
requires = ["setuptools>=46.4", "wheel"]
requires = ["setuptools<69", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "OWSLib"
version = "0.36.dev0"
description = "OGC Web Service utility library"
readme = "README.md"
requires-python = ">=3.12"
license = {text = "BSD-3-Clause"}
keywords = ["gis", "ogc", "ogcapi", "ows", "opensearch", "iso", "19115", "fgdc", "dif", "ows", "wfs", "wms", "sos", "csw", "wps", "wcs", "capabilities", "metadata", "wmts", "connectedsystems"]
authors = [
{name = "Sean Gillies", email = "sean.gillies@gmail.com"},
{name = "Tom Kralidis", email = "tomkralidis@gmail.com"}
]
maintainers = [
{name = "Tom Kralidis", email = "tomkralidis@gmail.com"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: GIS"
]
dependencies = [
"lxml",
"python-dateutil",
"pyyaml",
"requests"
]

[project.optional-dependencies]
dev = ["flake8", "flake8-pyproject", "pytest", "pytest-cov", "pytest_httpserver", "pytest-socket", "Pillow", "tox", "twine", "coverage", "coveralls", "build"]
docs = ["ipykernel", "nbconvert", "nbsphinx", "pypandoc", "sphinx==8.1.3"]
release = ["build", "twine", "wheel"]
test = ["pytest"]

[project.urls]
homepage = "https://geopython.github.io/OWSLib"
source = "https://github.com/geopython/OWSLib"
documentation = "https://geopython.github.io/OWSLib"
issues = "https://github.com/geopython/OWSLib/issues"

[tool.pytest]
addopts = ["-v", "-rxs", "-s", "--color=yes", "--tb=native", "--ignore=setup.py", "--doctest-modules", "--doctest-glob='tests/**/*.txt'", "--cov-report=term-missing", "--cov=owslib"]

norecursedirs = [".git", "docs", "examples", "etc", "cov*", "*.egg*", "pytest*", ".tox", "_broken"]
markers = ["online: test requires online resources."]

[tool.flake8]
ignore = ["F401", "E402"]
max-line-length = 120
exclude = [".git", "__pycache__", "docs/source/conf.py,", "build", "dist", "examples", "etc"]

# ensure all subpackages are found
[tool.setuptools.packages.find]
include = ["owslib*"]
12 changes: 0 additions & 12 deletions requirements-dev.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

88 changes: 0 additions & 88 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_ogcapi_records_pycsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_ogcapi_records_pycsw():
assert isinstance(w.response, dict)

pycsw_cite_demo_queryables = w.collection_queryables('metadata:main')
assert len(pycsw_cite_demo_queryables['properties'].keys()) == 14
assert len(pycsw_cite_demo_queryables['properties'].keys()) == 18

# Minimum of limit param is 1
with pytest.raises(RuntimeError):
Expand Down
18 changes: 3 additions & 15 deletions tests/test_wfs_generic.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from owslib.wfs import WebFeatureService
from owslib.util import ServiceException
from owslib.fes import PropertyIsLike, etree
from urllib.parse import urlparse
from tests.utils import resource_file, sorted_url_query, service_ok
import json
import pytest

SERVICE_URL = 'https://services.ga.gov.au/gis/stratunits/ows'


def test_caps_info():
getcapsin = open(resource_file("wfs_HSRS_GetCapabilities_1_1_0.xml"), "rb").read()
wfs = WebFeatureService('http://gis.bnhelp.cz/ows/crwfs', xml=getcapsin, version='1.1.0')
Expand Down Expand Up @@ -143,17 +143,6 @@ def test_srsname_wfs_200():
assert len(json.loads(feature.read())['features']) == 1


@pytest.mark.online
@pytest.mark.skipif(not service_ok(SERVICE_URL),
reason="WFS service is unreachable")
def test_schema_wfs_100():
wfs = WebFeatureService(SERVICE_URL, version='1.0.0')
schema = wfs.get_schema('stratunit:StratigraphicUnit')
assert len(schema['properties']) == 33
assert schema['properties']['DESCRIPTION'] == 'string'
assert schema['geometry'] is None


@pytest.mark.online
@pytest.mark.skipif(not service_ok(SERVICE_URL),
reason="WFS service is unreachable")
Expand Down Expand Up @@ -183,7 +172,7 @@ def test_schema_wfs_200():
def test_xmlfilter_wfs_110():
wfs = WebFeatureService(SERVICE_URL, version='1.1.0')
filter_prop = PropertyIsLike(propertyname='stratunit:GEOLOGICHISTORY', literal='Cisuralian - Guadalupian',
matchCase=True)
matchCase=True)

filterxml = etree.tostring(filter_prop.toXML()).decode("utf-8")

Expand All @@ -200,12 +189,11 @@ def test_xmlfilter_wfs_110():
def test_xmlfilter_wfs_200():
wfs = WebFeatureService(SERVICE_URL, version='2.0.0')
filter_prop = PropertyIsLike(propertyname='stratunit:geologichistory', literal='Cisuralian - Guadalupian',
matchCase=True)
matchCase=True)

filterxml = etree.tostring(filter_prop.toXML()).decode("utf-8")

getfeat_params = {'typename': 'stratunit:StratigraphicUnit', 'filter': filterxml}

response = wfs.getfeature(**getfeat_params).read()
assert b'<stratunit:NAME>Boolgeeda Iron Formation</stratunit:NAME>' in response

Loading