Skip to content

Commit

Permalink
Merge pull request #129 from cleder/develop
Browse files Browse the repository at this point in the history
1.1
  • Loading branch information
cleder authored Oct 13, 2023
2 parents fc19141 + 3b9c91a commit be7fecf
Show file tree
Hide file tree
Showing 34 changed files with 437 additions and 216 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/codeball.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
75 changes: 7 additions & 68 deletions .github/workflows/codesee-arch-diagram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,77 +5,16 @@ on:
pull_request_target:
types: [opened, synchronize, reopened]

name: CodeSee Map
name: CodeSee

permissions: read-all

jobs:
test_map_action:
codesee:
runs-on: ubuntu-latest
continue-on-error: true
name: Run CodeSee Map Analysis
name: Analyze the repo with CodeSee
steps:
- name: checkout
id: checkout
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

# codesee-detect-languages has an output with id languages.
- name: Detect Languages
id: detect-languages
uses: Codesee-io/codesee-detect-languages-action@latest

- name: Configure JDK 16
uses: actions/setup-java@v3
if: ${{ fromJSON(steps.detect-languages.outputs.languages).java }}
with:
java-version: '16'
distribution: 'zulu'

# CodeSee Maps Go support uses a static binary so there's no setup step required.

- name: Configure Node.js 14
uses: actions/[email protected]
if: ${{ fromJSON(steps.detect-languages.outputs.languages).javascript }}
with:
node-version: '14'

- name: Configure Python 3.x
uses: actions/setup-python@v4
if: ${{ fromJSON(steps.detect-languages.outputs.languages).python }}
with:
python-version: '3.10'
architecture: 'x64'

- name: Configure Ruby '3.x'
uses: ruby/setup-ruby@v1
if: ${{ fromJSON(steps.detect-languages.outputs.languages).ruby }}
with:
ruby-version: '3.0'

# CodeSee Maps Rust support uses a static binary so there's no setup step required.

- name: Generate Map
id: generate-map
uses: Codesee-io/codesee-map-action@latest
with:
step: map
github_ref: ${{ github.ref }}
languages: ${{ steps.detect-languages.outputs.languages }}

- name: Upload Map
id: upload-map
uses: Codesee-io/codesee-map-action@latest
with:
step: mapUpload
api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
github_ref: ${{ github.ref }}

- name: Insights
id: insights
uses: Codesee-io/codesee-map-action@latest
- uses: Codesee-io/codesee-action@v2
with:
step: insights
api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
github_ref: ${{ github.ref }}
codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
22 changes: 11 additions & 11 deletions .github/workflows/run-all-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11-dev']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -23,9 +23,9 @@ jobs:
pip install pytest pytest-cov typing_extensions
- name: Test with pytest
run: |
pytest pygeoif --cov=pygeoif --cov-fail-under=100 --cov-report=xml
pytest tests --cov=tests --cov=pygeoif --cov-report=xml
- name: "Upload coverage to Codecov"
if: ${{ matrix.python-version==3.9 }}
if: ${{ matrix.python-version==3.11 }}
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
Expand All @@ -35,10 +35,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9']
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Linting
run: |
flake8 pygeoif
black --check pygeoif
black --check pygeoif tests
yamllint .github/workflows/
- name: Check complexity
run: |
Expand All @@ -65,9 +65,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pypy-version: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9']
pypy-version: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.pypy-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -78,15 +78,15 @@ jobs:
pip install pytest typing_extensions
- name: Test with pytest
run: |
pytest pygeoif
pytest tests
publish:
if: "github.event_name == 'push' && github.repository == 'cleder/pygeoif'"
needs: [cpython, static-tests, pypy]
name: Build and publish to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
Expand Down
60 changes: 34 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-docstring-first
Expand All @@ -24,44 +24,52 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/ikamensh/flynt/
rev: '0.76'
rev: '1.0.1'
hooks:
- id: flynt
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
- repo: https://github.com/hakancelikdev/unimport
rev: 0.12.1
rev: 1.0.0
hooks:
- id: unimport
args: [--remove, --include-star-import, --ignore-init, --gitignore]
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
# - repo: https://github.com/dhruvmanila/remove-print-statements
# rev: 'v0.5.0'
# hooks:
# - id: remove-print-statements
# args: ['--verbose'] # Show all the print statements to be removed
- repo: https://github.com/psf/black
rev: 22.8.0
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.292'
hooks:
- id: ruff
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8
- flake8-absolute-import
- flake8-awesome
- flake8-bandit
- flake8-blind-except
# - flake8-absolute-import
# - flake8-awesome
# - flake8-bandit
# - flake8-blind-except
- flake8-bugbear
# - flake8-class-attributes-order
- flake8-cognitive-complexity
- flake8-commas
# - flake8-commas
- flake8-comments
- flake8-complex-f-strings
- flake8-continuation
- flake8-debugger
# - flake8-continuation
# - flake8-debugger
- flake8-docstrings
# - flake8-dunder-all
- flake8-encodings
Expand All @@ -79,28 +87,28 @@ repos:
- flake8-string-format
- flake8-super
- flake8-typing-imports
- flake8-use-fstring
# - flake8-use-fstring
- pep8-naming
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.981
rev: v1.5.1
hooks:
- id: mypy
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
rev: v1.0.1
hooks:
- id: rst-linter
# - repo: https://github.com/Lucas-C/pre-commit-hooks-markup
# rev: v1.0.1
# hooks:
# - id: rst-linter
- repo: https://github.com/mgedmin/check-manifest
rev: "0.48"
rev: "0.49"
hooks:
- id: check-manifest
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.18.3
rev: "0.27.0"
hooks:
- id: check-github-workflows
- id: check-github-actions
- id: check-readthedocs
- repo: https://github.com/regebro/pyroma
rev: "3.2"
hooks:
- id: pyroma
# - repo: https://github.com/regebro/pyroma
# rev: "4.1"
# hooks:
# - id: pyroma
...
2 changes: 2 additions & 0 deletions .sourcery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
refactor:
python_version: '3.7'
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ recursive-exclude *.pyc *.pyo
include docs/LICENSE.GPL
include pygeoif/py.typed
exclude pygeoif/.*
recursive-include tests *.py
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ It was written to provide clean and python only geometries for fastkml_
:target: https://www.codefactor.io/repository/github/cleder/pygeoif/overview/main
:alt: CodeFactor

.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commit

Expand Down
8 changes: 8 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

1.1 (2023/10/13)
-----------------

- Fix nested MultiGeometries
- Improve type annotations
- Add Python 3.12 to supported versions
- Last version to support Python 3.7

1.0 (2022/09/29)
------------------------

Expand Down
1 change: 0 additions & 1 deletion pygeoif/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 - 2022 Christian Ledermann
#
Expand Down
1 change: 0 additions & 1 deletion pygeoif/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 -2022 Christian Ledermann
#
Expand Down
8 changes: 3 additions & 5 deletions pygeoif/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 -2022 Christian Ledermann
#
Expand Down Expand Up @@ -155,8 +154,8 @@ def shape(
geometries = [
shape(fi) for fi in geometry["geometries"] # type: ignore [typeddict-item]
]
return GeometryCollection(geometries) # type: ignore [arg-type]
raise NotImplementedError(f"[{geometry['type']} is nor implemented")
return GeometryCollection(geometries)
raise NotImplementedError(f"[{geometry['type']} is not implemented")


def num(number: str) -> float:
Expand Down Expand Up @@ -269,9 +268,8 @@ def _multipolygon_from_wkt_coordinates(coordinates: str) -> MultiPolygon:
def _multigeometry_from_wkt_coordinates(coordinates: str) -> GeometryCollection:
gc_types = gcre.findall(coordinates)
gc_coords = gcre.split(coordinates)[1:]
assert len(gc_types) == len(gc_coords) # noqa: S101
geometries: List[Geometry] = []
for (gc_type, gc_coord) in zip(gc_types, gc_coords):
for gc_type, gc_coord in zip(gc_types, gc_coords):
gc_wkt = gc_type + gc_coord[: gc_coord.rfind(")") + 1]
geometries.append(cast(Geometry, from_wkt(gc_wkt)))
return GeometryCollection(geometries)
Expand Down
1 change: 0 additions & 1 deletion pygeoif/feature.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 -2022 Christian Ledermann
#
Expand Down
Loading

0 comments on commit be7fecf

Please sign in to comment.