Skip to content

Conversation

@sveinbjornt
Copy link
Contributor

@sveinbjornt sveinbjornt commented May 10, 2025

  • Updated CI to use uv for faster dependency installations. Now testing on CPython 3.9, 3.13 and PyPy 3.9,3.10
  • Yfirlestur header link now points to Málfríður
  • Updated package dependency versions
  • Addressed various typing and linter complaints
  • Fixed currency and petrol qmodules, which relied on the now-defunct apis.is portal
  • Various other minor stuff

@sveinbjornt sveinbjornt marked this pull request as draft May 10, 2025 18:00
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 PR makes several improvements and cleanup changes across the codebase. Key changes include replacing outdated future imports and typing_extensions with updated typing imports throughout, updating copyright years and external URLs, and adjusting workflow configurations to support newer Python versions and installation commands.

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
templates/container.html Changed the external URL for the "Yfirlestur" navigation link.
templates/about.html Updated copyright year from 2024 to 2025.
search.py Consolidated typing imports to include TypedDict.
scrapers/default.py Removed future import and added noqa comments for bare excepts.
scraper.py Removed future import as part of cleanup.
routes/loc.py Consolidated typing imports and updated exception handling.
queries/*.py (various) Updated typing import statements and removed future imports consistently.
processors/disabled/attribs.py Removed future import.
main.py Updated module import and minor logging message tweaks.
images.py Changed image data extraction from r.raw.data to r.content.
db/models.py Added noqa comment for DateTime import comment.
README.md Updated copyright year to 2025.
.github/workflows/python-package.yml Expanded Python version matrix and updated installation commands.

@sveinbjornt sveinbjornt self-assigned this May 10, 2025
@sveinbjornt sveinbjornt marked this pull request as ready for review May 11, 2025 21:52
@sveinbjornt sveinbjornt requested a review from Copilot May 11, 2025 21:52
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 PR makes several targeted changes including modernizing type imports by replacing typing_extensions.TypedDict with typing.TypedDict and removing obsolete future imports, updating dependency URLs for currency and petrol data, and refining CI workflows for faster dependency installations via uv. Key changes include:

  • Adjustments across multiple modules to migrate away from future imports and legacy type hints.
  • API endpoint updates in queries/petrol.py and queries/currency.py to reflect current external service configurations.
  • Updates to the CI configuration in .github/workflows/python-package.yml for broader Python version support and faster dependency installation.

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
search.py Migrates TypedDict import to built-in typing.
scrapers/default.py Adds "# noqa: E722" comments to bare except clauses for linter compliance.
scraper.py Removes future import; trivial refactor.
routes/loc.py Replaces bare except with "except Exception:" for improved error catching.
queries/* Consistently remove future imports and update TypedDict imports in several modules.
queries/petrol.py Changes the petrol API endpoint and updates the key used to access station data.
queries/currency.py Updates currency exchange rate fetching to use Arion Bank’s XML API with added error handling.
main.py Refactors import paths (e.g. reynir module) and adjusts import order with inline noqa directives.
images.py Refactors image response handling to use r.content for BytesIO wrapping.
db/models.py Adds a clarifying noqa comment for an imported DateTime re-export.
README.md Updates the copyright year from 2023 to 2025.
.github/workflows/python-package.yml Expands the Python version matrix and changes dependency installation commands to use uv.
Comments suppressed due to low confidence (10)

queries/util/openai_gpt.py:25

  • Migrating the TypedDict import to the built-in typing module is a good modernization step. Verify that related types from typing_extensions (like NotRequired) are properly imported elsewhere.
from typing import Any, Dict, Iterable, List, Mapping, Tuple, TypedDict

queries/util/init.py:31

  • Using the built-in TypedDict ensures consistency with modern Python. Ensure that all utility modules remain aligned with this update.
from typing import ( Any, Mapping, ... , TypedDict,

queries/gpt.py:39

  • Removing the redundant import of TypedDict from typing_extensions in favor of the built-in version is a sound update. Confirm that NotRequired is still correctly imported from typing_extensions where needed.
from typing ... TypedDict,

processors/disabled/attribs.py:46

  • Removing the future import for annotations is acceptable, as long as the intended behavior is preserved in the current Python version.
from queries import QueryStateDict

main.py:66

  • The updated import path for Greynir version correctly reflects the module restructuring. Ensure that all related version calls are consistently updated.
from reynir import __version__ as greynir_version

README.md:238

  • Updating the copyright year helps keep the documentation current.
Greynir is Copyright © 2025 [Miðeind ehf.](https://mideind.is)

queries/schedules.py:30

  • The updated import statement reflects current Python standards by using built-in TypedDict. Confirm that all usages of TypedDict in this module are compatible.
from typing import List, Dict, Optional, Tuple, Any, cast, TypedDict

queries/petrol.py:114

  • Updating the petrol API endpoint and switching from using 'results' to 'stations' aligns the code with upstream changes. Verify that downstream consumers and error handling are updated accordingly.
_PETROL_API = "https://raw.githubusercontent.com/gasvaktin/gasvaktin/refs/heads/master/vaktin/gas.min.json"

queries/currency.py:204

  • Switching the currency exchange data source to Arion Bank’s XML API is a significant change. Verify that error handling, timeout settings, and XML parsing logic are robust against changes in the API's structure.
_ARION_EXCHR_XML_API_URL = "https://www.arionbanki.is/markadir/gjaldmidlar/gengi/xml-export"

.github/workflows/python-package.yml:39

  • Expanding the Python version matrix increases CI test coverage across environments. Verify that all dependencies are compatible with these versions.
python-version: ["3.9", "3.13", "pypy3.9", "pypy3.10"]

@sveinbjornt
Copy link
Contributor Author

@vthorsteinsson This good to merge?

@sveinbjornt sveinbjornt merged commit e9935e4 into master May 15, 2025
8 checks passed
@sveinbjornt sveinbjornt deleted the fixes branch May 15, 2025 18:28
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.

3 participants