Skip to content

Commit

Permalink
Merge pull request #246 from cleder/develop
Browse files Browse the repository at this point in the history
Release 1.0.alpha.6
  • Loading branch information
cleder authored Oct 16, 2023
2 parents 20f5a6e + b773b94 commit 579f6b2
Show file tree
Hide file tree
Showing 43 changed files with 5,170 additions and 1,482 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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
21 changes: 12 additions & 9 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', '3.12-dev']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3.2.0
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -29,10 +29,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3.2.0
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -46,9 +46,11 @@ jobs:
run: |
pytest tests --cov=fastkml --cov=tests --cov-fail-under=88 --cov-report=xml
- name: "Upload coverage to Codecov"
if: ${{ matrix.python-version==3.11 }}
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true

static-tests:
runs-on: ubuntu-latest
Expand All @@ -57,7 +59,7 @@ jobs:
python-version: ['3.9']

steps:
- uses: actions/checkout@v3.2.0
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -73,7 +75,8 @@ jobs:
run: |
flake8 fastkml examples docs
black --check fastkml examples docs
yamllint .github/workflows/
yamllint .github/
yamllint .*.y*ml
- name: Check complexity
run: |
radon cc --min B fastkml
Expand All @@ -84,9 +87,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.2.0
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.pypy-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -104,7 +107,7 @@ jobs:
name: Build and publish to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.2.0
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ setup.cfg
# Installer logs
pip-log.txt

# Unit test / coverage reports
# Unit/static test / coverage reports
.coverage
coverage.xml
.tox
.pytest_cache/
nosetests.xml
.ruff_cache/
monkeytype.sqlite3

# Translations
*.mo
Expand All @@ -51,6 +55,8 @@ venv
.mypy_cache/
.pyre/
.watchmanconfig
.pytype/


# misc
.dccache
49 changes: 39 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-docstring-first
Expand All @@ -20,40 +20,69 @@ repos:
- id: pretty-format-json
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.2.0"
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
hooks:
- id: validate-pyproject
- repo: https://github.com/ikamensh/flynt/
rev: "0.77"
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: 33ead41ee30f1d323a9c2fcfd0114297efbbc4d5
rev: 1.0.0
hooks:
- id: unimport
args: [--remove, --include-star-import, --ignore-init, --gitignore]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py3-plus", "--py37-plus"]
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.11.4
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.292'
hooks:
- id: ruff
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: check-manifest
- id: flake8
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
hooks:
- id: python-use-type-annotations
- id: python-check-blanket-type-ignore
- id: python-check-mock-methods
- id: python-no-log-warn
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
# - repo: https://github.com/mgedmin/check-manifest
# rev: "0.49"
# hooks:
# - id: check-manifest
# - repo: https://github.com/Lucas-C/pre-commit-hooks-markup
# rev: v1.0.1
# hooks:
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
include *.rst
recursive-include docs *.txt
recursive-exclude *.pyc *.pyo
include docs/LICENSE.GPL
exclude fastkml/.*
include docs LICENSE.GPL
include *.txt
recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs Makefile
recursive-include tests *.py
recursive-include schema *.xsd
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Fastkml is continually tested
:target: http://codecov.io/github/cleder/fastkml?branch=main
:alt: codecov.io

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
.. image:: https://img.shields.io/badge/code+style-black-000000.svg
:target: https://github.com/psf/black
:alt: Black

Expand Down
11 changes: 10 additions & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ especially in the following ways:
Pull Requests
-------------

Start by submitting a pull request on GitHub against the `develop` branch of the
Start by submitting a pull request on GitHub against the ``develop`` branch of the
repository. Your pull request should provide a good description of the change
you are making, and/or the bug that you are fixing.

Expand Down Expand Up @@ -64,6 +64,15 @@ available.

.. _tox: https://pypi.python.org/pypi/tox

coverage
~~~~~~~~

You can also run the tests with coverage_ to see which lines are covered by the
tests. This is useful for writing new tests to cover any uncovered lines::

pytest tests --cov=fastkml --cov=tests --cov-report=xml


pre-commit
~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ requirements, namely:
* You can parse any KML snippet, it does not need to be a complete KML
document.
* It is fully tested and actively maintained.
* Geometries are handled in the `__geo_interface__` standard.
* Geometries are handled in the ``__geo_interface__`` standard.
* Minimal dependencies, pure Python.
* If available, lxml_ will be used to increase its speed.

Expand Down
1 change: 0 additions & 1 deletion examples/UsageExamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def print_child_features(element):


if __name__ == "__main__":

fname = "KML_Samples.kml"

k = kml.KML()
Expand Down
2 changes: 0 additions & 2 deletions fastkml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from fastkml.data import ExtendedData
from fastkml.data import Schema
from fastkml.data import SchemaData
from fastkml.gx import GxGeometry
from fastkml.kml import KML
from fastkml.kml import Document
from fastkml.kml import Folder
Expand Down Expand Up @@ -66,7 +65,6 @@
"TimeStamp",
"ExtendedData",
"Data",
"GxGeometry",
"Schema",
"SchemaData",
"StyleUrl",
Expand Down
17 changes: 13 additions & 4 deletions fastkml/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

from fastkml.base import _XMLObject
from fastkml.config import ATOMNS as NS
from fastkml.enums import Verbosity
from fastkml.helpers import o_from_attr
from fastkml.helpers import o_from_subelement_text
from fastkml.helpers import o_int_from_attr
Expand Down Expand Up @@ -167,8 +168,12 @@ def __init__(
def from_element(self, element: Element) -> None:
super().from_element(element)

def etree_element(self) -> Element:
return super().etree_element()
def etree_element(
self,
precision: Optional[int] = None,
verbosity: Verbosity = Verbosity.normal,
) -> Element:
return super().etree_element(precision=precision, verbosity=verbosity)


class _Person(_XMLObject):
Expand Down Expand Up @@ -227,8 +232,12 @@ def __init__(
self.uri = uri
self.email = email

def etree_element(self) -> Element:
return super().etree_element()
def etree_element(
self,
precision: Optional[int] = None,
verbosity: Verbosity = Verbosity.normal,
) -> Element:
return super().etree_element(precision=precision, verbosity=verbosity)

def from_element(self, element: Element) -> None:
super().from_element(element)
Expand Down
Loading

0 comments on commit 579f6b2

Please sign in to comment.