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: 7 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Setup Python ${{ matrix.python-version }}
with:
Expand All @@ -19,10 +19,8 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y binutils gdal-bin libgdal-dev libproj-dev libsqlite3-mod-spatialite spatialite-bin
pip3 install -r requirements-test.txt
pip3 install -r requirements-dev.txt
pip3 install gdal=="`gdal-config --version`.*"
pip3 install .
pip3 install ".[test,dev,fes,backend-django,backend-sqlalchemy,backend-native,backend-elasticsearch,backend-opensearch]"
- name: Configure sysctl limits
run: |
sudo swapoff -a
Expand Down Expand Up @@ -53,7 +51,7 @@ jobs:
- name: Run unit tests
run: |
pytest
# - name: run pre-commit (code formatting, lint and type checking)
# run: |
# python -m pip3 install pre-commit
# pre-commit run --all-files
- name: Run pre-commit (code formatting, lint and type checking)
run: |
pip3 install pre-commit
pre-commit run --all-files
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
publish:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Setup Python
with:
python-version: '3.11'
- name: Install build dependency
run: pip3 install wheel setuptools
run: pip3 install build
- name: Build package
run: python3 setup.py sdist bdist_wheel --universal
run: python3 -m build
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
23 changes: 6 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
repos:
- repo: https://github.com/psf/black
rev: 25.1.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.13
hooks:
- id: black
language_version: python

- repo: https://github.com/PyCQA/isort
rev: 6.0.1
hooks:
- id: isort
language_version: python

- repo: https://github.com/PyCQA/flake8
rev: 7.2.0
hooks:
- id: flake8
language_version: python
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
rev: v2.1.0
hooks:
- id: mypy
language_version: python
Expand Down
18 changes: 11 additions & 7 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
build:
os: ubuntu-22.04
tools:
python: "3.12"

sphinx:
configuration: docs/conf.py
configuration: docs/conf.py

# Optionally set requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
- requirements: requirements-test.txt
install:
- method: pip
path: .
extra_requirements:
- docs
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

sys.path.insert(0, os.path.abspath(".."))

from pygeofilter.version import __version__ # noqa: E402

# -- Project information -----------------------------------------------------

Expand All @@ -25,9 +26,9 @@
author = "Fabian Schindler"

# The short X.Y version
version = ""
version = __version__
# The full version, including alpha/beta/rc tags
release = "0.0.3"
release = __version__


# -- General configuration ---------------------------------------------------
Expand Down Expand Up @@ -144,7 +145,9 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "pygeofilter", "pygeofilter Documentation", [author], 1)]
man_pages = [
(master_doc, "pygeofilter", "pygeofilter Documentation", [author], 1)
]


# -- Options for Texinfo output ----------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions docs/requirements.txt

This file was deleted.

46 changes: 24 additions & 22 deletions examples/cql2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
"metadata": {},
"outputs": [],
"source": [
"from pygeofilter.parsers.cql2_json import parse\n",
"from pygeofilter.backends.cql2_json import to_cql2\n",
"import json\n",
"import traceback\n",
"from lark import lark, logger, v_args\n",
"from pygeofilter.cql2 import BINARY_OP_PREDICATES_MAP\n"
"\n",
"from pygeofilter.backends.cql2_json import to_cql2"
]
},
{
Expand All @@ -34,7 +32,10 @@
],
"source": [
"from pygeofilter.parsers.cql2_text import parse as cql2_parse\n",
"cql2_parse(\"collection = 'landsat8_l1tp' AND gsd <= 30 AND eo:cloud_cover <= 10 AND datetime >= TIMESTAMP('2021-04-08T04:39:23Z')\")"
"\n",
"cql2_parse(\n",
" \"collection = 'landsat8_l1tp' AND gsd <= 30 AND eo:cloud_cover <= 10 AND datetime >= TIMESTAMP('2021-04-08T04:39:23Z')\"\n",
")"
]
},
{
Expand Down Expand Up @@ -99,51 +100,52 @@
}
],
"source": [
"from pygeofilter.parsers.cql2_text import parse as text_parse\n",
"from pygeofilter.parsers.cql2_json import parse as json_parse\n",
"from pygeofilter.backends.cql2_json import to_cql2\n",
"import orjson\n",
"import json\n",
"import pprint\n",
"\n",
"from pygeofilter.parsers.cql2_json import parse as json_parse\n",
"from pygeofilter.parsers.cql2_text import parse as text_parse\n",
"\n",
"\n",
"def pp(j):\n",
" print(orjson.dumps(j))\n",
"with open('tests/parsers/cql2_json/fixtures.json') as f:\n",
"\n",
"\n",
"with open(\"tests/parsers/cql2_json/fixtures.json\") as f:\n",
" examples = json.load(f)\n",
"\n",
"for k, v in examples.items():\n",
" parsed_text = None\n",
" parsed_json = None\n",
" print (k)\n",
" t=v['text'].replace('filter=','')\n",
" j=v['json']\n",
" print(k)\n",
" t = v[\"text\"].replace(\"filter=\", \"\")\n",
" j = v[\"json\"]\n",
" # print('\\t' + t)\n",
" # pp(orjson.loads(j))\n",
" # print('*****')\n",
" try:\n",
" parsed_text=text_parse(t)\n",
" parsed_json=json_parse(j)\n",
" parsed_text = text_parse(t)\n",
" parsed_json = json_parse(j)\n",
" if parsed_text == parsed_json:\n",
" print('*******parsed trees match***************')\n",
" print(\"*******parsed trees match***************\")\n",
" else:\n",
" print(parsed_text)\n",
" print('-----')\n",
" print(\"-----\")\n",
" print(parsed_json)\n",
" if parsed_json is None or parsed_text is None:\n",
" raise Exception\n",
" if to_cql2(parsed_text) == to_cql2(parsed_json):\n",
" print('*******reconstructed json matches*******')\n",
" print(\"*******reconstructed json matches*******\")\n",
" else:\n",
" pp(to_cql2(parsed_text))\n",
" print('-----')\n",
" print(\"-----\")\n",
" pp(to_cql2(parsed_json))\n",
" except Exception as e:\n",
" print(parsed_text)\n",
" print(parsed_json)\n",
" print(j)\n",
" traceback.print_exc(f\"Error: {e}\")\n",
" pass\n",
" print('____________________________________________________________')\n",
" "
" print(\"____________________________________________________________\")"
]
},
{
Expand Down
Loading
Loading