Skip to content

Conversation

@ishiland
Copy link
Owner

@ishiland ishiland commented Mar 31, 2025

  • fix segmentation fault
  • remove python 2.7 support, only 3.8+ supported now
  • add type hints & better comments
  • refactor ctypes library loading
  • black formatting
  • gh actions for testing and releases

- remove python 2.7 support
- add type hints
- better comments
- passing tests
@ishiland ishiland requested a review from Copilot March 31, 2025 00:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request (v1.1.0) prepares the library for Python 3.8+ by removing Python 2.7 support, adding type hints throughout the codebase, and refactoring various components including C library loading and documentation.

  • Updated type annotations and formatting for improved readability and reliability
  • Refactored the ctypes library loading logic and removed legacy modules (e.g., sysutils)
  • Enhanced CI integration with GitHub Actions and updated documentation/examples

Reviewed Changes

Copilot reviewed 25 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/ (various) Updated test definitions and formatting
tasks.py, geosupport/sysutils.py Removed legacy code
setup.py, geosupport/*, geosupport/config.py Added type hints, logging, and refactored library loading
examples/, docs/, README.md Updated formatting and documentation for clarity and style
.github/workflows/ci.yml Added CI pipeline steps using GitHub Actions
Files not reviewed (3)
  • .devcontainer/Dockerfile: Language not supported
  • .devcontainer/devcontainer.json: Language not supported
  • appveyor/build.ps1: Language not supported

Comment on lines 23 to 24
GEOLIB: Any = None

Copy link

Copilot AI Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of a global variable 'GEOLIB' may lead to race conditions in multi-threaded or multi-instance scenarios. It is recommended to encapsulate the loaded library within the Geosupport class instance to improve thread safety.

Suggested change
GEOLIB: Any = None
# GEOLIB: Any = None

Copilot uses AI. Check for mistakes.
Comment on lines 5 to 7
def __init__(self, message: str, result: Dict[str, Any] = {}) -> None:
super(GeosupportError, self).__init__(message)
self.result = result
Copy link

Copilot AI Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a mutable default argument (an empty dict) in the constructor may lead to unexpected behavior. It is recommended to use a default value of None and then assign an empty dict inside the method.

Suggested change
def __init__(self, message: str, result: Dict[str, Any] = {}) -> None:
super(GeosupportError, self).__init__(message)
self.result = result
def __init__(self, message: str, result: Dict[str, Any] = None) -> None:
super(GeosupportError, self).__init__(message)
self.result = result if result is not None else {}

Copilot uses AI. Check for mistakes.
@ishiland ishiland merged commit 12d5495 into master Mar 31, 2025
4 of 6 checks passed
@ishiland ishiland deleted the master-update branch March 31, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants