Closed cleder closed 4 weeks ago
This pull request implements significant refactoring and improvements to the FastKML library, focusing on code quality, testing, and validation. The changes include improved type hints, better error handling, enhanced test coverage using property-based testing, XML schema validation, and standardized code formatting.
classDiagram
class _Geometry {
-altitude_mode: Optional[AltitudeMode]
+__init__(...)
+__repr__() str
}
class Point {
+extrude: Optional[bool]
+kml_coordinates: Optional[Coordinates]
+__init__(...)
+__eq__(other: object) bool
}
class LineString {
+extrude: Optional[bool]
+tessellate: Optional[bool]
+kml_coordinates: Optional[Coordinates]
+__init__(...)
+__eq__(other: object) bool
}
class Polygon {
+extrude: Optional[bool]
+tessellate: Optional[bool]
+outer_boundary: Optional[OuterBoundaryIs]
+inner_boundaries: List[InnerBoundaryIs]
+__init__(...)
+__eq__(other: object) bool
}
class MultiGeometry {
+kml_geometries: List[Union[Point, LineString, Polygon, LinearRing, Self]]
+__init__(...)
}
_Geometry <|-- Point
_Geometry <|-- LineString
_Geometry <|-- Polygon
_BaseObject <|-- MultiGeometry
classDiagram
class BoundaryIs {
+geometry: Optional[geo.LinearRing]
}
class OuterBoundaryIs {
+get_tag_name() str
}
class InnerBoundaryIs {
+get_tag_name() str
}
BoundaryIs <|-- OuterBoundaryIs
BoundaryIs <|-- InnerBoundaryIs
classDiagram
class Track {
+track_items: List[TrackItem]
+whens: Tuple[KmlDateTime, ...]
+coords: Tuple[PointType, ...]
+angles: Tuple[PointType, ...]
+__init__(...)
+__bool__() bool
}
class MultiTrack {
+tracks: List[Track]
+interpolate: Optional[bool]
+__init__(...)
}
Track <|-- MultiTrack
classDiagram
class TimeStamp {
+timestamp: Optional[KmlDateTime]
}
class TimeSpan {
+begin: Optional[KmlDateTime]
+end: Optional[KmlDateTime]
}
_TimePrimitive <|-- TimeStamp
_TimePrimitive <|-- TimeSpan
Change | Details | Files |
---|---|---|
Refactored geometry handling and validation |
|
fastkml/geometry.py fastkml/validator.py tests/geometries/geometry_test.py |
Enhanced testing infrastructure with property-based testing |
|
tests/hypothesis/geometry_test.py tests/hypothesis/multi_geometry_test.py tests/hypothesis/common.py .github/workflows/run-all-tests.yml |
Improved type hints and code quality |
|
pyproject.toml .pre-commit-config.yaml fastkml/helpers.py fastkml/registry.py |
Refactored GX extension support |
|
fastkml/gx.py tests/hypothesis/gx_test.py |
The pull request introduces significant updates to the testing workflows and documentation within the FastKML project. Key changes include modifications to the GitHub Actions workflow for testing with updated Python versions, enhanced coverage thresholds, and the introduction of new jobs for building and publishing packages. The documentation has been reorganized and expanded, with new files for KML examples and detailed guides on creating KML files. Additionally, numerous tests have been added or updated to reflect changes in the library's API, ensuring comprehensive validation of KML functionalities.
File/Directory | Change Summary |
---|---|
.github/workflows/run-all-tests.yml |
Updated Python version matrix, increased coverage threshold, added new jobs for building and testing packages. |
.pre-commit-config.yaml |
Updated repository and hook versions, added new hooks, and modified exclusion patterns. |
README.rst |
Enhanced documentation, added references to KML clients, and streamlined content. |
docs/Document-clean.kml |
New KML document defining geographic data for visualization. |
docs/alternatives.rst |
Added section listing alternative KML libraries with descriptions. |
docs/conf.py |
Added new Sphinx extensions and updated versioning logic. |
docs/create_kml_files.rst |
New documentation file providing guides on creating KML files for CO2 emissions data. |
docs/fastkml.rst |
Restructured documentation to enhance clarity and organization. |
docs/index.rst |
Updated to streamline content and reflect new sections. |
docs/installing.rst |
Deleted file with installation instructions. |
docs/modules.rst |
Removed section header for the fastkml module. |
docs/quickstart.rst |
New documentation file providing a quickstart guide for KML file creation. |
docs/reference_guide.rst |
Deleted structured reference guide for the fastkml library. |
docs/usage_guide.rst |
Deleted comprehensive usage guide for the fastkml library. |
docs/working_with_kml.rst |
New documentation file detailing how to work with KML files. |
examples/CreateKml.py |
Deleted example script for creating KML documents. |
examples/README.md |
Updated title and content for clarity regarding usage examples. |
examples/gx_cascading_style.kml |
New KML document defining styles and placemarks for geographic visualization. |
fastkml/__init__.py |
Updated imports and __all__ declaration for clarity and organization. |
fastkml/about.py |
Updated version number from "1.0.a13" to "1.0.0b1". |
fastkml/atom.py |
Modified attribute types in Link and _Person classes for improved type safety. |
fastkml/base.py |
Simplified equality check in _XMLObject class and renamed method for parsing strings. |
fastkml/containers.py |
Updated style retrieval logic in Document class. |
fastkml/data.py |
Modified registration logic for SimpleField , Data , and SchemaData classes. |
fastkml/enums.py |
Renamed enum member and added new method in AltitudeMode class. |
fastkml/features.py |
Enhanced attribute handling in Snippet , _Feature , Placemark , and NetworkLink classes. |
fastkml/geometry.py |
Improved handling of geometries and updated class structures. |
fastkml/gx.py |
Enhanced handling of KML extensions related to the gx namespace. |
fastkml/helpers.py |
Added utility functions for KML data handling. |
fastkml/kml.py |
Updated methods for handling KML elements. |
fastkml/links.py |
Modified attribute types and updated registrations in Link class. |
fastkml/overlays.py |
Enhanced attribute handling in overlay classes. |
fastkml/registry.py |
Updated type annotations and improved flexibility in the registry's functionality. |
fastkml/schema/*.xsd |
Introduced new XML Schema Definition files for KML extensions and Atom elements. |
pyproject.toml |
Updated project metadata, consolidated dependencies, and refined configuration settings. |
tests/*.py |
Numerous updates to test cases reflecting changes in method signatures, improved error handling, and added tests. |
enhancement
, Tests
๐ฐ In the meadow, changes bloom,
With tests and docs, we clear the gloom.
KML shines, with styles anew,
A rabbit's cheer for all we do!
Let's hop along, our code refined,
In every line, our joy aligned! ๐
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Preparing review...
:warning: This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev
Generated with :heart: by ellipsis.dev
Preparing review...
Failed to generate code suggestions for PR
Here are some key observations to aid the review process:
โฑ๏ธ Estimated effort to review: 4 ๐ต๐ต๐ต๐ตโช |
๐งช PR contains tests |
๐ No security concerns identified |
โก Recommended focus areas for review Code Complexity The helper functions have been significantly refactored and expanded. Verify that the new implementations, especially get_value and the new datetime and coordinate handling functions, work correctly across all use cases. API Changes The geometry classes have been modified, with some attributes moved or removed. Ensure these changes don't break existing functionality and are properly documented. Test Coverage Many tests have been updated or added. Verify that these changes provide adequate coverage for the new and modified functionality in the geometry classes. |
Updated Python version and dependencies: The changes include updates in Python version, increase in pytest coverage, and inclusion of document packages in installation dependencies.
Improved GitHub Actions workflow: GitHub Actions workflow has been updated to run example scripts, reorganize steps, conditionally publish only on pushes to the 'main' branch, and test installation on Test PyPI.
Documentation and Sphinx configuration enhancements: New documentation files have been added and existing ones have been updated. Sphinx configuration has been enhanced with added extensions.
Quickstart guide and example updates: The 'quickstart.rst' file has been updated with a comprehensive guide and code examples. Some redundant example scripts were removed while new image files were added.
Code adjustments and improvements: New KML file and shapefile data have been added, some Python files have been renamed, method names have been modified, version in 'about.py' has been updated, and code organization has been improved.
Improved altitude mode documentation and defaults: The explanation for altitude modes has been revised for better clarity. Default values for optional attributes in a few classes have been introduced.
Inclusion of XML Schema Definition (XSD) files and Style modifications: New XSD files have been added to enhance XML validation capabilities. 'style.py' has been modified to change 'color' attribute type hint and default values for various attributes.
Updates in 'utils.py', 'validator.py', and 'views.py': New utility functions have been introduced, a new module for KML validation has been added, and default values for several properties in 'views.py' have been set.
Method renaming and improved tests: Method names have been refactored in multiple files to align with updated naming convention. New tests for container creation, feature appending and error handling have been added.
Enhancements in testing: The testing suite has been updated with new tests to assert GeometryError, check verbose and terse output, adjust string output precision, and handle KML parsing errors.
Polygon and Helper function tests: New tests have been added to cover features like 'extrude' and altitude mode configurations and to validate handling of attributes as float, enum and boolean values.
Testing updates with Hypothesis: A new suite for Hypothesis testing has been created including new test files and strategies to generate test cases, focus on serialization and deserialization behavior and asserting roundtrip behaviour for XML objects.
Testing updates and enhancements: The changes include replacing 'class_from_string' with 'from_string' for consistency, ensuring coordinate formats, handling None cases in style map and enhancing existing test cases.
Refactoring in multiple test files: The test files have been refactored for readability and consistency. Additional improvements in the error messages and new test files for utility functions and validating logic have also been added.
Explore these optional code suggestions:
Category | Suggestion | Score |
Enhancement |
Use parametrized tests to cover multiple invalid input scenarios for Track.from_string method___ **Consider using parametrized tests fortest_track_from_str_invalid_when and test_track_from_str_invalid_coord to test multiple invalid inputs.**
[tests/gx_test.py [367-393]](https://github.com/cleder/fastkml/pull/377/files#diff-4ac18980a60351fdb90de277ced50c1429130b451c36d8cb7ef5fa9e9b90203dR367-R393)
```diff
-def test_track_from_str_invalid_when(self) -> None:
- doc = """
+@pytest.mark.parametrize("invalid_input, invalid_field", [
+ ("2010-02-32T02:02:09Z", "when"),
+ ("XYZ 37.371915 156.000000", "coord"),
+])
+def test_track_from_str_invalid_input(self, invalid_input: str, invalid_field: str) -> None:
+ doc = f"""
Suggestion importance[1-10]: 8Why: Parametrizing the tests for invalid inputs significantly improves test coverage and reduces code duplication, making the tests more maintainable and comprehensive. | 8 |
Add input validation for coordinate values to ensure data integrity___ **In thecoords_subelement_list_kwarg function, consider adding input validation for the coordinate values to ensure they are valid before processing them further.** [fastkml/helpers.py [1101-1110]](https://github.com/cleder/fastkml/pull/377/files#diff-b5b3941187e8c15a6401d21669f3dd0d541c710ecbb6238620a56e24305fc02cR1101-R1110) ```diff def coords_subelement_list_kwarg( *, element: Element, ns: str, name_spaces: Dict[str, str], node_name: str, kwarg: str, classes: Tuple[Type[object], ...], strict: bool, ) -> Dict[str, List[PointType]]: + def validate_coordinate(coord: str) -> bool: + try: + float(coord) + return True + except ValueError: + return False + # Rest of the function implementation + # Use validate_coordinate() to check each coordinate value + ``` - [ ] **Apply this suggestion** Suggestion importance[1-10]: 7Why: Adding input validation for coordinate values is a valuable suggestion that can improve data integrity and prevent potential errors downstream. It addresses a potential vulnerability in the code and enhances its robustness. | 7 | |
Add a test case to verify that Track initialization raises an exception when whens and coords have different lengths___ **Consider adding a test case for theTrack class that verifies the behavior when both whens and coords are provided but have different lengths.**
[tests/gx_test.py [179-197]](https://github.com/cleder/fastkml/pull/377/files#diff-4ac18980a60351fdb90de277ced50c1429130b451c36d8cb7ef5fa9e9b90203dR179-R197)
```diff
def test_track_from_whens_and_coords(self) -> None:
whens = [
KmlDateTime(
datetime.datetime(2023, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc),
),
]
coords = [(1, 2)]
track = Track(
whens=whens,
coords=coords,
)
assert "when>" in track.to_string()
assert ">2023-01-01T00:00:00+00:00" in track.to_string()
assert "coord>" in track.to_string()
assert ">1 2" in track.to_string()
assert track.coords == ((1, 2),)
+ # Test mismatched lengths
+ with pytest.raises(ValueError, match="Length of whens and coords must be equal"):
+ Track(whens=whens, coords=coords + [(3, 4)])
+
```
- [ ] **Apply this suggestion**
Suggestion importance[1-10]: 7Why: This suggestion adds an important edge case test, ensuring that the Track class correctly handles mismatched lengths of whens and coords, which enhances the robustness of the test suite. | 7 | |
Add a test case to verify Track behavior with TrackItems containing None values for when, coord, or angle___ **Consider adding a test case for theTrack class that verifies the behavior when track_items contain None values for when , coord , or angle .**
[tests/gx_test.py [160-175]](https://github.com/cleder/fastkml/pull/377/files#diff-4ac18980a60351fdb90de277ced50c1429130b451c36d8cb7ef5fa9e9b90203dR160-R175)
```diff
def test_track_from_track_items(self) -> None:
time1 = KmlDateTime(
datetime.datetime(2023, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc),
)
angle = Angle()
- track_items = [TrackItem(when=time1, coord=geo.Point(1, 2), angle=angle)]
+ track_items = [
+ TrackItem(when=time1, coord=geo.Point(1, 2), angle=angle),
+ TrackItem(when=None, coord=geo.Point(3, 4), angle=None),
+ TrackItem(when=time1, coord=None, angle=angle),
+ ]
track = Track(
track_items=track_items,
)
assert "when>" in track.to_string()
assert ">2023-01-01T00:00:00+00:00" in track.to_string()
assert "coord>" in track.to_string()
assert ">1 2" in track.to_string()
+ assert ">3 4" in track.to_string()
assert "angles>" in track.to_string()
assert ">0.0 0.0 0.0" in track.to_string()
+ assert track.track_items == track_items
```
- [ ] **Apply this suggestion**
Suggestion importance[1-10]: 7Why: This suggestion improves test coverage by verifying the Track class's behavior with TrackItems containing None values, which is an important edge case that should be tested. | 7 | |
Simplify attribute retrieval and default value handling in the get_value function___ **In theget_value function, consider using the getattr function with a default value instead of using getattr and then checking for None . This can simplify the code and reduce the number of comparisons.** [fastkml/helpers.py [121-124]](https://github.com/cleder/fastkml/pull/377/files#diff-b5b3941187e8c15a6401d21669f3dd0d541c710ecbb6238620a56e24305fc02cR121-R124) ```diff -value = getattr(obj, attr_name, None) -if value is None and default is not None and verbosity == Verbosity.verbose: - return default +value = getattr(obj, attr_name, default) +if verbosity == Verbosity.verbose: + return value return None if value == default and verbosity == Verbosity.terse else value ``` - [ ] **Apply this suggestion** Suggestion importance[1-10]: 6Why: This suggestion offers a meaningful improvement in code readability and efficiency by simplifying the attribute retrieval and default value handling logic. It reduces the number of comparisons and makes the code more straightforward. | 6 | |
Add a more precise type hint for the kml_geometries attribute___ **In theMultiGeometry class, consider adding a type hint for the kml_geometries attribute to improve code readability and catch potential type-related issues earlier.** [fastkml/geometry.py [1243]](https://github.com/cleder/fastkml/pull/377/files#diff-47314ad0817fc0fdde5a4ccab1250d104c27d592f1dd0f9952b454a4e3cdf65dR1243-R1243) ```diff class MultiGeometry(_BaseObject): """A container for zero or more geometry primitives.""" - kml_geometries: List[Union[Point, LineString, Polygon, LinearRing, Self]] + kml_geometries: List[Union[Point, LineString, Polygon, LinearRing, 'MultiGeometry']] ``` - [ ] **Apply this suggestion** Suggestion importance[1-10]: 6Why: This suggestion improves code readability and can help catch potential type-related issues earlier. It's a valuable enhancement for maintainability and type safety. | 6 | |
Improve exception testing by using a context manager and asserting the specific error message___ **Consider using a context manager with pytest.raises to ensure the exception israised and to provide a more specific error message.** [tests/gx_test.py [211-219]](https://github.com/cleder/fastkml/pull/377/files#diff-4ac18980a60351fdb90de277ced50c1429130b451c36d8cb7ef5fa9e9b90203dR211-R219) ```diff -with pytest.raises( - ValueError, - match="^Cannot specify both geometry and track_items$", -): +with pytest.raises(ValueError) as excinfo: Track( whens=whens, coords=coords, track_items=track_items, ) +assert str(excinfo.value) == "Cannot specify both geometry and track_items" ``` - [ ] **Apply this suggestion** Suggestion importance[1-10]: 6Why: This suggestion enhances the exception testing by using a context manager and asserting the specific error message, which improves the test's precision and readability. | 6 | |
Use a more specific exception type for invalid coordinates___ **Consider using a more specific exception type instead ofKMLWriteError in the coordinates_subelement function. For example, you could create a custom exception like InvalidCoordinatesError to provide more precise error handling.**
[fastkml/geometry.py [166-168]](https://github.com/cleder/fastkml/pull/377/files#diff-47314ad0817fc0fdde5a4ccab1250d104c27d592f1dd0f9952b454a4e3cdf65dR166-R168)
```diff
if not coords or len(coords[0]) not in (2, 3):
msg = f"Invalid dimensions in coordinates '{coords}'"
- raise KMLWriteError(msg)
+ raise InvalidCoordinatesError(msg)
```
- [ ] **Apply this suggestion**
Suggestion importance[1-10]: 5Why: Using a more specific exception type can improve error handling and debugging, but it's a minor improvement that doesn't address a critical issue. | 5 | |
Use a list comprehension to simplify and potentially optimize the code___ **Consider using a list comprehension instead of a for loop in thedatetime_subelement_list_kwarg function to make the code more concise and potentially more efficient.** [fastkml/helpers.py [1082-1098]](https://github.com/cleder/fastkml/pull/377/files#diff-b5b3941187e8c15a6401d21669f3dd0d541c710ecbb6238620a56e24305fc02cR1082-R1098) ```diff -args_list: List[KmlDateTime] = [] cls = classes[0] if subelements := element.findall(f"{ns}{node_name}"): - for subelement in subelements: - try: - args_list.append( - cls.parse(subelement.text), # type: ignore[attr-defined] - ) - except ValueError as exc: # noqa: PERF203 - handle_error( - error=exc, - strict=strict, - element=element, - node=subelement, - expected="DateTime", - ) + args_list = [ + cls.parse(subelement.text) # type: ignore[attr-defined] + for subelement in subelements + if not handle_error( + error=ValueError(), + strict=strict, + element=element, + node=subelement, + expected="DateTime", + ) + ] ``` - [ ] **Apply this suggestion** Suggestion importance[1-10]: 4Why: The suggestion to use a list comprehension could make the code more concise, but it might not significantly improve performance. It also changes the error handling logic, which could have unintended consequences. | 4 | |
Use a dictionary comprehension for mapping geometry types___ **In thecreate_kml_geometry function, consider using a dictionary comprehension instead of a manually created dictionary for _map_to_kml . This can make the code more concise and easier to maintain.** [fastkml/geometry.py [1420-1432]](https://github.com/cleder/fastkml/pull/377/files#diff-47314ad0817fc0fdde5a4ccab1250d104c27d592f1dd0f9952b454a4e3cdf65dR1420-R1432) ```diff _map_to_kml: Dict[ Union[Type[GeoType], Type[GeoCollectionType]], Type[KMLGeometryType], ] = { - geo.Point: Point, - geo.Polygon: Polygon, - geo.LinearRing: LinearRing, - geo.LineString: LineString, - geo.MultiPoint: MultiGeometry, - geo.MultiLineString: MultiGeometry, - geo.MultiPolygon: MultiGeometry, - geo.GeometryCollection: MultiGeometry, + geo_type: kml_type + for geo_type, kml_type in [ + (geo.Point, Point), + (geo.Polygon, Polygon), + (geo.LinearRing, LinearRing), + (geo.LineString, LineString), + (geo.MultiPoint, MultiGeometry), + (geo.MultiLineString, MultiGeometry), + (geo.MultiPolygon, MultiGeometry), + (geo.GeometryCollection, MultiGeometry), + ] } ``` - [ ] **Apply this suggestion** Suggestion importance[1-10]: 4Why: While this suggestion improves code conciseness and maintainability, it doesn't address any functional issues. The current implementation is already clear and working correctly. | 4 | |
Use more specific exception types for better error handling and diagnostics___ **Use a more specific exception type instead of the generalValueError in the datetime_subelement_kwarg and datetime_subelement_list_kwarg functions. This will make error handling more precise and informative.** [fastkml/helpers.py [1058-1067]](https://github.com/cleder/fastkml/pull/377/files#diff-b5b3941187e8c15a6401d21669f3dd0d541c710ecbb6238620a56e24305fc02cR1058-R1067) ```diff -except ValueError as exc: +except (ValueError, TypeError) as exc: handle_error( error=exc, strict=strict, element=element, node=node, expected="DateTime", ) ``` - [ ] **Apply this suggestion** Suggestion importance[1-10]: 3Why: While the suggestion to use more specific exception types is valid, it offers only a minor improvement in error handling. The existing code already handles ValueError, which is sufficient for most datetime parsing errors. | 3 | |
Performance |
Improve memory efficiency in equality comparison___ **In the__eq__ method of the Point class, consider using all() with a generator expression instead of a list comprehension for better memory efficiency, especially when dealing with large objects.** [fastkml/geometry.py [479-492]](https://github.com/cleder/fastkml/pull/377/files#diff-47314ad0817fc0fdde5a4ccab1250d104c27d592f1dd0f9952b454a4e3cdf65dR479-R492) ```diff def __eq__(self, other: object) -> bool: """Check if the Point objects are equal.""" if isinstance(other, Point): return all( getattr(self, attr) == getattr(other, attr) - for attr in ( - "extrude", - "altitude_mode", - "geometry", - *xml_attrs, - *self._get_splat(), - ) + for attr in ("extrude", "altitude_mode", "geometry", *xml_attrs, *self._get_splat()) ) return super().__eq__(other) ``` - [ ] **Apply this suggestion** Suggestion importance[1-10]: 3Why: The suggestion offers a minor performance optimization, but the impact is likely negligible for most use cases. The current implementation is already quite efficient. | 3 |
๐ก Need additional feedback ? start a PR chat
**Action:** Run pr agent on every pull request, respond to user comments |
**Failed stage:** [PR Agent action step](https://github.com/cleder/fastkml/actions/runs/11671938870/job/32499449150) [โ] |
**Failed test name:** "" |
**Failure summary:**
The action failed due to a ValueError in the Python shlex module. The error occurred because there was a missing closing quotation mark in the input being processed by the shlex module. |
Relevant error logs:```yaml 1: ##[group]Operating System 2: Ubuntu ... 154: ^^^^^^^^^^^ 155: File "/usr/local/lib/python3.12/shlex.py", line 300, in __next__ 156: token = self.get_token() 157: ^^^^^^^^^^^^^^^^ 158: File "/usr/local/lib/python3.12/shlex.py", line 109, in get_token 159: raw = self.read_token() 160: ^^^^^^^^^^^^^^^^^ 161: File "/usr/local/lib/python3.12/shlex.py", line 191, in read_token 162: raise ValueError("No closing quotation") 163: ValueError: No closing quotation ``` |
User description
PR Type
Enhancement, Tests, Documentation
Description
from_string
method for consistency and improved error handling.Changes walkthrough ๐
17 files
helpers.py
Add utility functions for KML attribute handling
fastkml/helpers.py
coordinate values.
geometry.py
Refactor geometry classes and improve attribute handling
fastkml/geometry.py
gx.py
Refactor and enhance Track and TrackItem classes for XML handling
fastkml/gx.py
TrackItem
class to remove XML element generation.Track
class to handlewhens
,coords
, andangles
properties.Track
class with new registry items for XML serialization.times.py
Enhance time handling with registry-based XML serialization
fastkml/times.py
TimeStamp
andTimeSpan
with new registry items for XMLhandling.
views.py
Set default values and update altitude mode in views.
fastkml/views.py
default
values to several registry items.altitude_mode
default toNone
inCamera
andLookAt
classes.enums.py
Update Verbosity and AltitudeMode enums with new method.
fastkml/enums.py
quiet
toterse
inVerbosity
enum.AltitudeMode
docstring for better readability.get_ns_id
method toAltitudeMode
.overlays.py
Set default values for overlay registry items.
fastkml/overlays.py - Added `default` values to several registry items.
links.py
Update Link class attributes and registry defaults.
fastkml/links.py
href
,view_format
, andhttp_query
to non-optional with defaultvalues.
default
values to several registry items.styles.py
Set default values for style registry items.
fastkml/styles.py
default
values to several registry items.color
to have a default value in_ColorStyle
.validator.py
Add KML validation module with schema parsing.
fastkml/validator.py
features.py
Set default values and update geometry creation in features.
fastkml/features.py
default
values to several registry items.create_kml_geometry
assignment inPlacemark
.atom.py
Update Atom classes to use non-optional attributes.
fastkml/atom.py
href
,rel
,type
,hreflang
,title
,name
,uri
, andemail
tonon-optional with default values.
utils.py
Add utility functions for attribute checking and searching.
fastkml/utils.py
find_all
andhas_attribute_values
.registry.py
Simplify registry item types and add default attribute.
fastkml/registry.py
known_types
union type.default
attribute toRegistryItem
.__init__.py
Update module imports and add new utilities.
fastkml/__init__.py
data.py
Reorder registry items for SimpleField and Data.
fastkml/data.py - Reordered registry items for `SimpleField` and `Data`.
containers.py
Use utility function for style retrieval in containers.
fastkml/containers.py - Used `find_all` utility function in `get_style_by_url` method.
32 files
gx_test.py
Update and enhance tests for Track and MultiTrack classes
tests/gx_test.py
Track
andMultiTrack
classes.Track
class.multi_geometry_test.py
Add property-based tests for MultiGeometry class
tests/hypothesis/multi_geometry_test.py
MultiGeometry
class.geometry_test.py
Introduce property-based tests for geometry classes
tests/hypothesis/geometry_test.py
geometry_test.py
Update geometry tests and remove deprecated attributes
tests/geometries/geometry_test.py
class_from_string
withfrom_string
in tests.extrude
andtessellate
attributes.kml_test.py
Enhance KML parsing tests with new cases and methods
tests/kml_test.py
class_from_string
withfrom_string
in tests.None
namespace.times_test.py
Improve datetime parsing tests and update methods
tests/times_test.py
class_from_string
withfrom_string
in tests.multigeometry_test.py
Add verbosity tests and handle GeometryError in MultiGeometry
tests/geometries/multigeometry_test.py
MultiGeometry
.class_from_string
withfrom_string
.GeometryError
.point_test.py
Extend Point tests with verbosity and error handling
tests/geometries/point_test.py
Point
.class_from_string
withfrom_string
.GeometryError
.utils_test.py
Add utility function tests for find and find_all
tests/utils_test.py
find
andfind_all
utility functions.styles_test.py
Update style tests and add usage scenarios
tests/styles_test.py
class_from_string
withfrom_string
.StyleMap
handling ofNone
cases.polygon_test.py
Enhance Polygon tests with verbosity and error handling
tests/geometries/polygon_test.py
Polygon
.class_from_string
withfrom_string
.GeometryError
.linestring_test.py
Enhance LineString tests with error handling and verbosity checks.
tests/geometries/linestring_test.py
exceptions
,Verbosity
,GeometryError
, andCoordinates
.test_geometry_error
to testGeometryError
exception.class_from_string
withfrom_string
in several test methods.from_string
method with invalid extrude and tessellatevalues.
to_string
method with different verbosity levels.overlays_test.py
Update GroundOverlay and PhotoOverlay tests for `from_string` method.
tests/overlays_test.py
class_from_string
withfrom_string
in multiple test methods.view_volume
andimage_pyramid
intest_create_photo_overlay_with_all_optional_parameters
.gx_test.py
Add Hypothesis tests for gx Track and MultiTrack.
tests/hypothesis/gx_test.py
gx
Track and MultiTrack usingHypothesis.
Track
andMultiTrack
classes.boundaries_test.py
Add GeometryError tests and update boundary string methods.
tests/geometries/boundaries_test.py
Type
,Union
, andpytest
.GeometryError
in boundary classes.class_from_string
withfrom_string
in several test methods.helper_test.py
Add tests for helper functions edge cases.
tests/helper_test.py
subelement_int_kwarg
andattribute_float_kwarg
.containers_test.py
Update container tests and add style retrieval tests.
tests/containers_test.py
class_from_string
withfrom_string
in several test methods.get_style_by_url
method in Document.data_test.py
Update data tests to use from_string method.
tests/data_test.py
class_from_string
withfrom_string
in several test methods.common.py
Add common utilities for property-based tests.
tests/hypothesis/common.py
tests.
links_test.py
Add Hypothesis tests for Link and Icon classes.
tests/hypothesis/links_test.py
Link
andIcon
classes.atom_test.py
Update atom tests to use from_string method.
tests/atom_test.py
class_from_string
withfrom_string
in several test methods.Link
andAuthor
classes.validator_test.py
Add tests for KML validator module.
tests/validator_test.py
linearring_test.py
Update LinearRing tests to use from_string method.
tests/geometries/linearring_test.py
class_from_string
withfrom_string
in several test methods.atom_test.py
Add Hypothesis tests for Atom Link and Author.
tests/hypothesis/atom_test.py
Link
andAuthor
classes.base_test.py
Update base tests to use from_string method.
tests/base_test.py
class_from_string
withfrom_string
in several test methods.functions_test.py
Add tests for geometry error handling functions.
tests/geometries/functions_test.py
strategies.py
Add custom hypothesis strategies for testing.
tests/hypothesis/strategies.py
strings.
coordinates_test.py
Update Coordinates tests to use from_string method.
tests/geometries/coordinates_test.py
class_from_string
withfrom_string
in several test methods.features_test.py
Update features tests with improved error assertions.
tests/features_test.py
ValueError
assertion intest_placemark_geometry_and_kml_geometry_parameter_set
.class_from_string
withfrom_string
intest_network_link_read
.views_test.py
Update views tests to use from_string method.
tests/views_test.py
class_from_string
withfrom_string
in several test methods.Region
intest_region_with_all_optional_parameters
.links_test.py
Update links tests to use from_string method.
tests/links_test.py
class_from_string
withfrom_string
in several test methods.registry_test.py
Simplify registry test types and update functions.
tests/registry_test.py
known_types
union type.default
parameter toset_element
andget_kwarg
functions.5 files
conf.py
Update Sphinx configuration for enhanced documentation
docs/conf.py
Document-clean.kml
Add reference to KML document in documentation
docs/Document-clean.kml - Added reference to a KML document for documentation purposes.
shp2kml_timed.py
Add example script for shapefile to KML conversion with time.
examples/shp2kml_timed.py
time data.
fastkml
to create KML with CO2 growth data.shp2kml.py
Add example script for shapefile to KML conversion.
examples/shp2kml.py
fastkml
to create KML with CO2 data.transform_cascading_style.py
Add example script for transforming cascading styles in KML.
examples/transform_cascading_style.py
KML.
CascadingStyle
andDocument
classes.1 files
ne_110m_admin_0_countries.cpg
Add character encoding specification file.
examples/ne_110m_admin_0_countries.cpg - Added a new file for character encoding specification.
29 files
base.py
...
fastkml/base.py ...
base.py
...
tests/base.py ...
simple_example.py
...
examples/simple_example.py ...
conftest.py
...
tests/conftest.py ...
kml.py
...
fastkml/kml.py ...
about.py
...
fastkml/about.py ...
repr_eq_test.py
...
tests/repr_eq_test.py ...
read_kml.py
...
examples/read_kml.py ...
config_test.py
...
tests/config_test.py ...
xAL.xsd
...
fastkml/schema/xAL.xsd ...
ne_110m_admin_0_countries.README.html
...
examples/ne_110m_admin_0_countries.README.html ...
kml22gx.xsd
...
fastkml/schema/kml22gx.xsd ...
working_with_kml.rst
...
docs/working_with_kml.rst ...
create_kml_files.rst
...
docs/create_kml_files.rst ...
quickstart.rst
...
docs/quickstart.rst ...
run-all-tests.yml
...
.github/workflows/run-all-tests.yml ...
pyproject.toml
...
pyproject.toml ...
.pre-commit-config.yaml
...
.pre-commit-config.yaml ...
gx_cascading_style.kml
...
examples/gx_cascading_style.kml ...
fastkml.rst
...
docs/fastkml.rst ...
README.rst
...
README.rst ...
atom-author-link.xsd
...
fastkml/schema/atom-author-link.xsd ...
index.rst
...
docs/index.rst ...
configuration.rst
...
docs/configuration.rst ...
alternatives.rst
...
docs/alternatives.rst ...
ogckml22.xsd
...
fastkml/schema/ogckml22.xsd ...
README.md
...
examples/README.md ...
Document-places.kml
...
tests/ogc_conformance/data/kml/Document-places.kml ...
ne_110m_admin_0_countries.prj
...
examples/ne_110m_admin_0_countries.prj ...
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores