Skip to content

Commit

Permalink
build: upgrade minimum python version and dependencies (#14)
Browse files Browse the repository at this point in the history
* build: upgrade minimum python version, drop black and isort

* fix: update python matrix version

* fix: describe python deps update

* fix: update pre-commit versions

* fix: update ruff format commands

* build: update ruff mypy versions

* fix: run formatter
  • Loading branch information
arthurdjn authored Oct 23, 2024
1 parent 584e423 commit f878964
Show file tree
Hide file tree
Showing 8 changed files with 1,717 additions and 1,745 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
# check-out repo and set-up python
Expand All @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# Setup services with docker compose
- name: Setup env config
run: |
Expand Down Expand Up @@ -49,4 +49,3 @@ jobs:
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: false

21 changes: 5 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
ci:
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions"
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: no-commit-to-branch
name: No commits to master

- id: check-toml
name: Check toml

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: Sort imports

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
name: Black formatting
language_version: python3.12

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.6.9
hooks:
- id: ruff
name: Ruff formatting
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
types_or: [python, pyi]
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Lowered the minimum required Python version to 3.8 and updated `pre-commit` minimum dependency.
- Added more tests for MacOS, Windows and Linux and various Python versions.
- Upgraded minimum python version from 3.8 to 3.9, to facilitate the use with numpy 2.x.y in development. Updated associated CI/CD pipeline.

#### Removed

- Removed the TODOS.md file and added the tasks to the issues.
- Removed dev dependencies for black and isort.

### New Contributors

Expand Down
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,19 @@ CMD:=poetry run

.PHONY: format
format: ## Format source code and tests
$(CMD) black .
$(CMD) ruff format $(SRC) $(TESTS)

.PHONY: lint
lint: ## Lint source code and tests
$(CMD) ruff .
$(CMD) ruff $(SRC) $(TESTS)

.PHONY: lint-fix
lint-fix: ## Lint and fix source code and tests
$(CMD) ruff --fix .
$(CMD) ruff --fix $(SRC) $(TESTS)

.PHONY: type
type: ## Type in source code and tests
$(CMD) mypy .

.PHONY: isort
isort: ## Sort imports in source code and tests
$(CMD) isort .
$(CMD) mypy $(SRC) $(TESTS)

.PHONY: pre-commit
pre-commit: ## Run pre-commit hooks
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
<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/)
[![mypy](https://img.shields.io/badge/mypy-typing-red.svg?color=009ACF&labelColor=6DBA65)](https://mypy-lang.org)
[![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)

Expand Down
3,382 changes: 1,691 additions & 1,691 deletions poetry.lock

Large diffs are not rendered by default.

35 changes: 12 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,17 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
packages = [
{ include="geoserver", from="." },
]
packages = [{ include = "geoserver", from = "." }]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
requests = "^2.31.0"
typing-extensions = "^4.12.1"

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.5.0"
black = "^24.1.1"
pytest = "^8.0.0"
pytest-cov = "^4.1.0"
mypy = "^1.8.0"
ruff = "^0.1.14"
isort = "^5.13.2"
mkdocs = "^1.5.3"
mkdocs-material = "^9.5.6"
mkdocstrings-python = "^1.8.0"
Expand All @@ -50,26 +44,21 @@ mkdocs-exclude = "^1.0.2"
nbconvert = "^7.16.4"
dict2xml = "^1.7.5"
bump-my-version = "^0.21.1"

[tool.black]
target-version = ["py310"]
line-length = 120
ruff = "^0.7.0"
mypy = "^1.13.0"

[tool.ruff]
target-version = "py310"
target-version = "py312"
line-length = 120
ignore-init-module-imports = true

[tool.ruff.per-file-ignores]
"geoserver/**/__init__.py" = ["F401"]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.isort]
profile = "black"
line_length = 120
known_first_party = ["geoserver"]
[tool.ruff.lint.per-file-ignores]
"geoserver/**/__init__.py" = ["F401"]

[tool.ruff.lint.isort]
known-first-party = ["geoserver"]

[tool.mypy]
disallow_untyped_calls = true
Expand All @@ -88,7 +77,7 @@ implicit_reexport = true
addopts = ["--capture=no", "--color=yes", "-vv"]

[tool.coverage.run]
source = ["src"]
source = ["geoserver"]

[tool.coverage.report]
precision = 2
Expand Down
1 change: 0 additions & 1 deletion tests/test_geoserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ def test_upload_coverage_store(test_geoserver: GeoServer, test_workspace: str) -

@pytest.mark.skipif(not GEOSERVER_RUNNING, reason=f"No GeoServer running at {GEOSERVER_URL!r}.")
def test_get_coverage_store(test_geoserver: GeoServer, test_workspace: str, test_coverage_store: str) -> None:

data = test_geoserver.get_coverage_store(test_coverage_store, workspace=test_workspace)
assert isinstance(data, dict)

Expand Down

0 comments on commit f878964

Please sign in to comment.