Skip to content

Commit d4d5574

Browse files
authored
Add conda support (#696)
* added conda environment.yml * added makefile with shortcuts * skip python 3.9 * fixed tox config * added support for python 3.13 * fixed docs workflow * using ruff instead of flake8 * clean up make * updated readme * removed obsolete INSTALL.md * added conda badge to readme
1 parent 1b3ceac commit d4d5574

File tree

11 files changed

+200
-73
lines changed

11 files changed

+200
-73
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v4
1919
- uses: actions/setup-python@v5
2020
with:
21-
python-version: "3.9"
21+
python-version: "3.10"
2222
- name: Install tox
2323
run: |
2424
pip install tox>=4.0
@@ -33,12 +33,14 @@ jobs:
3333
strategy:
3434
matrix:
3535
include:
36-
- tox-env: py39-extra
37-
python-version: "3.9"
3836
- tox-env: py310-extra
3937
python-version: "3.10"
4038
- tox-env: py311-extra
4139
python-version: "3.11"
40+
- tox-env: py312-extra
41+
python-version: "3.12"
42+
- tox-env: py313-extra
43+
python-version: "3.13"
4244
steps:
4345
- uses: actions/checkout@v4
4446
- name: Install packages 📦
@@ -54,7 +56,7 @@ jobs:
5456
- name: Run tests with tox ⚙️
5557
run: tox -e ${{ matrix.tox-env }}
5658
- name: Run coveralls ⚙️
57-
if: matrix.python-version == 3.9
59+
if: matrix.python-version == 3.10
5860
uses: AndreMiras/coveralls-python-action@develop
5961

6062
docs:
@@ -64,9 +66,9 @@ jobs:
6466
steps:
6567
- uses: actions/checkout@v4
6668
- uses: actions/setup-python@v5
67-
name: Setup Python 3.9
69+
name: Setup Python 3.10
6870
with:
69-
python-version: 3.9
71+
python-version: "3.10"
7072
- name: Build documentation 🏗️
7173
run: |
7274
pip install -e .[dev]

INSTALL.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

Makefile

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Configuration
2+
APP_ROOT := $(abspath $(lastword $(MAKEFILE_LIST))/..)
3+
4+
# end of configuration
5+
6+
define PRINT_HELP_PYSCRIPT
7+
import re, sys
8+
9+
for line in sys.stdin:
10+
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
11+
if match:
12+
target, help = match.groups()
13+
print("%-20s %s" % (target, help))
14+
else:
15+
match = re.match(r'^## (.*)$$', line)
16+
if match:
17+
help = match.groups()[0]
18+
print("\n%s" % (help))
19+
endef
20+
export PRINT_HELP_PYSCRIPT
21+
22+
.DEFAULT_GOAL := help
23+
24+
help: ## print this help message. (Default)
25+
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
26+
27+
## Build targets:
28+
29+
install: ## install pywps
30+
@echo "Installing pywps ..."
31+
@-bash -c 'pip install -e .'
32+
33+
develop: ## install pywps with development libraries
34+
@echo "Installing development requirements for tests and docs ..."
35+
@-bash -c 'pip install -e ".[dev]"'
36+
37+
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
38+
39+
clean-build: ## remove build artifacts
40+
@echo "Removing build artifacts ..."
41+
@-rm -fr build/
42+
@-rm -fr dist/
43+
@-rm -fr .eggs/
44+
@-find . -name '*.egg-info' -exec rm -fr {} +
45+
@-find . -name '*.egg' -exec rm -f {} +
46+
@-find . -name '*.log' -exec rm -fr {} +
47+
@-find . -name '*.sqlite' -exec rm -fr {} +
48+
49+
clean-pyc: ## remove Python file artifacts
50+
@echo "Removing Python file artifacts ..."
51+
@-find . -name '*.pyc' -exec rm -f {} +
52+
@-find . -name '*.pyo' -exec rm -f {} +
53+
@-find . -name '*~' -exec rm -f {} +
54+
@-find . -name '__pycache__' -exec rm -fr {} +
55+
56+
clean-test: ## remove test and coverage artifacts
57+
@echo "Removing test artifacts ..."
58+
@-rm -fr .tox/
59+
@-rm -f .coverage
60+
@-rm -fr .pytest_cache
61+
62+
clean-dist: clean ## remove git ignored files and directories
63+
@echo "Running 'git clean' ..."
64+
@git diff --quiet HEAD || echo "There are uncommitted changes! Aborting 'git clean' ..."
65+
## do not use git clean -e/--exclude here, add them to .gitignore instead
66+
@-git clean -dfx
67+
68+
clean-docs: ## remove documentation artifacts
69+
@echo "Removing documentation artifacts ..."
70+
$(MAKE) -C docs clean
71+
72+
lint: ## check style with ruff
73+
@echo "Running code style checks ..."
74+
@bash -c 'ruff check pywps'
75+
76+
## Testing targets:
77+
78+
test: ## run tests quickly with the default Python (skip slow and online tests)
79+
@echo "Running tests (skip slow and online tests) ..."
80+
@bash -c 'pytest -v -m "not slow and not online" tests/'
81+
82+
test-all: ## run all tests quickly with the default Python
83+
@echo "Running all tests (including slow and online tests) ..."
84+
@bash -c 'pytest -v tests/'
85+
86+
## Sphinx targets:
87+
88+
docs: clean-docs ## generate Sphinx HTML documentation, including API docs
89+
@echo "Generating docs with Sphinx ..."
90+
$(MAKE) -C docs html
91+
@echo "Open your browser to: file:/$(APP_ROOT)/docs/build/html/index.html"
92+
## do not execute xdg-open automatically since it hangs ReadTheDocs and job does not complete
93+
@echo "xdg-open $(APP_ROOT)/docs/build/html/index.html"
94+
95+
96+
## Deployment targets:
97+
98+
# dist: clean ## builds source and wheel package
99+
# python -m flit build
100+
# ls -l dist
101+
102+
# release: dist ## package and upload a release
103+
# python -m flit publish dist/*
104+

README.md

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,31 @@ the Open Geospatial Consortium. PyWPS is written in Python.
77
[![Build Status](https://github.com/geopython/pywps/actions/workflows/main.yml/badge.svg)](https://github.com/geopython/pywps/actions/workflows/main.yml)
88
[![Coverage Status](https://coveralls.io/repos/github/geopython/pywps/badge.svg?branch=main)](https://coveralls.io/github/geopython/pywps?branch=main)
99
[![PyPI](https://img.shields.io/pypi/dm/pywps.svg)](https://pypi.org/project/pywps/)
10+
[![Conda](https://anaconda.org/conda-forge/pywps/badges/version.svg)](https://anaconda.org/channels/conda-forge/packages/pywps/overview)
1011
[![GitHub license](https://img.shields.io/github/license/geopython/pywps.svg)]()
1112

1213
[![Join the chat at https://gitter.im/geopython/pywps](https://badges.gitter.im/geopython/pywps.svg)](https://gitter.im/geopython/pywps?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1314

14-
# License
15+
## License
1516

1617
As of PyWPS 4.0.0, PyWPS is released under an
1718
[MIT](https://en.wikipedia.org/wiki/MIT_License) license
1819
(see [LICENSE.txt](LICENSE.txt)).
1920

20-
# Dependencies
21+
## Dependencies
2122

2223
See [requirements.txt](requirements.txt) file
2324

24-
# Run tests
25+
## Install
26+
27+
Install it from GitHub:
28+
```bash
29+
$ git clone https://github.com/geopython/pywps.git
30+
$ cd pywps/
31+
$ pip install .
32+
```
33+
34+
## Run tests
2535

2636
```bash
2737
pip install -r requirements-dev.txt
@@ -32,9 +42,37 @@ python -m coverage run --source=pywps -m unittest tests
3242
python -m coverage report -m
3343
```
3444

35-
# Run web application
45+
## Quick Guide with Conda
3646

37-
## Example service
47+
Checkout source from GitHub:
48+
```bash
49+
$ git clone https://github.com/geopython/pywps.git
50+
$ cd pywps/
51+
```
52+
53+
Build conda environment:
54+
```bash
55+
conda env create -f environment.yml
56+
```
57+
58+
Install pywps:
59+
```bash
60+
make install
61+
```
62+
63+
Or the development version:
64+
```bash
65+
make develop
66+
```
67+
68+
Run tests:
69+
```bash
70+
make tests
71+
```
72+
73+
## Run web application
74+
75+
### Example service
3876

3977
Clone the example service after having installed PyWPS:
4078

@@ -44,7 +82,9 @@ cd pywps-flask
4482
python demo.py
4583
```
4684

47-
## Apache configuration
85+
Access example service: http://localhost:5000
86+
87+
### Apache configuration
4888

4989
1. Enable WSGI extension
5090

@@ -92,7 +132,7 @@ python demo.py
92132
```
93133
94134
95-
# Issues
135+
## Issues
96136
97137
On Windows PyWPS does not support multiprocessing which is used when making
98138
requests storing the response document and updating the status to displaying

environment.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: pywps
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- python >=3.10,<3.14
6+
- pip >=25.0
7+
- owslib >=0.35.0
8+
- requests >=2.32.5
9+
- werkzeug >=3.1.4
10+
- sqlalchemy >=2.0.44
11+
- lxml >=6.0.2
12+
- urllib3 >=2.5.0
13+
- markupsafe >=3.0.3
14+
- numpy >=1.22.2
15+
- zarr <3
16+
- fiona
17+
- geotiff
18+
# tests
19+
- pytest
20+
- ruff >=0.5.7
21+
# docs
22+
- sphinx >=7.0.0
23+

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
[build-system]
22
requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"
4+
5+
[tool.ruff]
6+
lint.select = ["E", "W", "F", "C90"] # Flake8-equivalent rule families
7+
lint.ignore = ["F401", "E402", "C901"]
8+
9+
line-length = 120
10+
exclude = ["tests"]
11+

pywps/validator/complexvalidator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def validategeojson(data_input, mode):
223223
>>> from io import StringIO
224224
>>> class FakeInput(object):
225225
... json = open('point.geojson','w')
226-
... json.write('''{"type":"Feature", "properties":{}, "geometry":{"type":"Point", "coordinates":[8.5781228542328, 22.87500500679]}, "crs":{"type":"name", "properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}''') # noqa
226+
... json.write('''{"type":"Feature", "properties":{}, "geometry":{"type":"Point", "coordinates":[8.5781228542328, 22.87500500679]}, "crs":{"type":"name", "properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}''')
227227
... json.close()
228228
... file = 'point.geojson'
229229
>>> class FakeDataFormat(object):
@@ -232,7 +232,7 @@ def validategeojson(data_input, mode):
232232
>>> fake_input.data_format = FakeDataFormat()
233233
>>> validategeojson(fake_input, MODE.SIMPLE)
234234
True
235-
"""
235+
""" # noqa
236236

237237
LOGGER.info('validating GeoJSON; Mode: {}'.format(mode))
238238
passed = False

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ bump2version
22
coverage
33
coveralls
44
docutils
5-
flake8
5+
ruff
66
pylint
77
pytest
88
pytest-cov

setup.cfg

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,4 @@ replace = {new_version}
1717
[coverage:run]
1818
relative_files = True
1919

20-
[flake8]
21-
ignore =
22-
F401
23-
E402
24-
W606
25-
max-line-length = 120
26-
exclude = tests
2720

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,17 @@
4949
"Operating System :: OS Independent",
5050
"Programming Language :: Python",
5151
"Programming Language :: Python :: 3",
52-
"Programming Language :: Python :: 3.9",
5352
"Programming Language :: Python :: 3.10",
5453
"Programming Language :: Python :: 3.11",
54+
"Programming Language :: Python :: 3.12",
55+
"Programming Language :: Python :: 3.13",
5556
"Topic :: Scientific/Engineering :: GIS",
5657
],
5758
"install_requires": INSTALL_REQUIRES,
5859
"extras_require": dict(
5960
dev=DEV_REQUIRES,
6061
),
61-
"python_requires": ">=3.9,<4",
62+
"python_requires": ">=3.10,<4",
6263
"packages": find_packages(exclude=["docs", "tests.*", "tests"]),
6364
"include_package_data": True,
6465
"scripts": [],

0 commit comments

Comments
 (0)