Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
### High-Level Details

- **Project Type**: Python library package
- **Languages**: Python 3.9+ (tested up to Python 3.14-dev)
- **Languages**: Python 3.10+ (tested up to Python 3.15-dev)
- **Package Manager**: Poetry (pyproject.toml-based)
- **Framework**: Object-oriented design with entity-specific classes
- **Target Runtime**: Python 3.9-3.13 in production
- **Target Runtime**: Python 3.10-3.14 in production
- **Repository Size**: ~1000+ Python files across core library and tests
- **Key Features**: Two execution modes (normal and "fast run"), comprehensive data type support, OAuth authentication, SPARQL query support

Expand Down Expand Up @@ -166,7 +166,7 @@ wikibaseintegrator/

Located in `.github/workflows/`:

1. **`python-pytest.yaml`** - Tests on Python 3.9-3.14-dev, Ubuntu + httpbin service
1. **`python-pytest.yaml`** - Tests on Python 3.10-3.15-dev, Ubuntu + httpbin service
2. **`python-lint.yaml`** - Code quality checks (isort, mypy, pylint, codespell, flynt)
3. **`codeql.yml`** - Security scanning
4. **`publish-to-pypi.yaml`** - Package publishing
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- name: Install poetry
run: pipx install poetry

- name: Set up Python 3.13
- name: Set up Python 3.14
uses: actions/setup-python@v6.2.0
with:
python-version: '3.13'
python-version: '3.14'
cache: 'poetry'

# Need to install poetry again in the new python version
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Install poetry
run: pipx install poetry

- name: Set up Python 3.13
- name: Set up Python 3.14
uses: actions/setup-python@v6.2.0
with:
python-version: '3.13'
python-version: '3.14'
cache: 'poetry'

# Need to install poetry again in the new python version
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ jobs:

strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', '3.14-dev' ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14', '3.15-dev' ]

steps:
- uses: actions/checkout@v6

- name: Install pipx
run: apt update && apt install -y pipx && pipx ensurepath

- name: Install dependencies for Python 3.14-dev
if: matrix.python-version == '3.14-dev'
- name: Install dependencies for Python 3.15-dev
if: matrix.python-version == '3.15-dev'
run: apt install -y build-essential libffi-dev

- name: Update path
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The main differences between these two libraries are :
* A complete rewrite of the library with a more object-oriented architecture allowing for easy interaction, data
validation and extended functionality
* Add support for reading and writing Lexeme, MediaInfo and Property entities
* Python 3.9 to 3.13 support, validated with unit tests
* Python 3.10 to 3.14 support, validated with unit tests
* Type hints implementation for arguments and return, checked with mypy static type checker
* Add OAuth 2.0 login method
* Add logging module support
Expand Down Expand Up @@ -334,7 +334,7 @@ Here is a list of different projects that use the library:
# Installation #

The easiest way to install WikibaseIntegrator is to use the `pip` package manager. WikibaseIntegrator supports Python
3.9 and above. If Python 2 is installed, `pip` will lead to an error indicating missing dependencies.
3.10 and above. If Python 2 is installed, `pip` will lead to an error indicating missing dependencies.

```bash
python -m pip install wikibaseintegrator
Expand Down
944 changes: 60 additions & 884 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ documentation = "https://wikibaseintegrator.readthedocs.io"
keywords = ["wikibase", "wikidata", "mediawiki", "sparql"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Development Status :: 4 - Beta",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
Expand All @@ -39,7 +39,7 @@ classifiers = [
Changelog = "https://github.com/LeMyst/WikibaseIntegrator/releases"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.10"
backoff = "^2.2.1"
mwoauth = "^0.4.0"
oauthlib = "^3.2.2"
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/entityschema.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional, Union
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType

Expand All @@ -10,7 +10,7 @@ class EntitySchema(BaseDataType):
"""
DTYPE = 'entity-schema'

def __init__(self, value: Optional[Union[str, int]] = None, **kwargs: Any):
def __init__(self, value: str | int | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -20,7 +20,7 @@ def __init__(self, value: Optional[Union[str, int]] = None, **kwargs: Any):
super().__init__(**kwargs)
self.set_value(value=value)

def set_value(self, value: Optional[Union[str, int]] = None):
def set_value(self, value: str | int | None = None):
assert isinstance(value, (str, int)) or value is None, f'Expected str or int, found {type(value)} ({value})'

if value:
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/form.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType

Expand All @@ -16,7 +16,7 @@ class Form(BaseDataType):
}}
'''

def __init__(self, value: Optional[str] = None, **kwargs: Any):
def __init__(self, value: str | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -37,7 +37,7 @@ def __init__(self, value: Optional[str] = None, **kwargs: Any):
super().__init__(**kwargs)
self.set_value(value=value)

def set_value(self, value: Optional[str] = None):
def set_value(self, value: str | None = None):
assert isinstance(value, str) or value is None, f"Expected str, found {type(value)} ({value})"

if value:
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/geoshape.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType

Expand All @@ -16,7 +16,7 @@ class GeoShape(BaseDataType):
}}
'''

def __init__(self, value: Optional[str] = None, **kwargs: Any):
def __init__(self, value: str | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -39,7 +39,7 @@ def __init__(self, value: Optional[str] = None, **kwargs: Any):
super().__init__(**kwargs)
self.set_value(value=value)

def set_value(self, value: Optional[str] = None):
def set_value(self, value: str | None = None):
assert isinstance(value, str) or value is None, f"Expected str, found {type(value)} ({value})"

if value:
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/globecoordinate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType
from wikibaseintegrator.models import Claim
Expand All @@ -18,7 +18,7 @@ class GlobeCoordinate(BaseDataType):
}}
'''

def __init__(self, latitude: Optional[float] = None, longitude: Optional[float] = None, altitude: Optional[float] = None, precision: Optional[float] = None, globe: Optional[str] = None, wikibase_url: Optional[str] = None,
def __init__(self, latitude: float | None = None, longitude: float | None = None, altitude: float | None = None, precision: float | None = None, globe: str | None = None, wikibase_url: str | None = None,
**kwargs: Any):
"""
Constructor, calls the superclass BaseDataType
Expand All @@ -34,7 +34,7 @@ def __init__(self, latitude: Optional[float] = None, longitude: Optional[float]
super().__init__(**kwargs)
self.set_value(latitude=latitude, longitude=longitude, altitude=altitude, precision=precision, globe=globe, wikibase_url=wikibase_url)

def set_value(self, latitude: Optional[float] = None, longitude: Optional[float] = None, altitude: Optional[float] = None, precision: Optional[float] = None, globe: Optional[str] = None, wikibase_url: Optional[str] = None):
def set_value(self, latitude: float | None = None, longitude: float | None = None, altitude: float | None = None, precision: float | None = None, globe: str | None = None, wikibase_url: str | None = None):
# https://github.com/wikimedia/Wikibase/blob/174450de8fdeabcf97287604dbbf04d07bb5000c/repo/includes/Rdf/Values/GlobeCoordinateRdfBuilder.php#L120
precision = precision or 1 / 3600
globe = globe or str(config['COORDINATE_GLOBE_QID'])
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/item.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional, Union
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType

Expand All @@ -16,7 +16,7 @@ class Item(BaseDataType):
}}
'''

def __init__(self, value: Optional[Union[str, int]] = None, **kwargs: Any):
def __init__(self, value: str | int | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -26,7 +26,7 @@ def __init__(self, value: Optional[Union[str, int]] = None, **kwargs: Any):
super().__init__(**kwargs)
self.set_value(value=value)

def set_value(self, value: Optional[Union[str, int]] = None):
def set_value(self, value: str | int | None = None):
assert isinstance(value, (str, int)) or value is None, f'Expected str or int, found {type(value)} ({value})'

if value:
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/lexeme.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional, Union
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType

Expand All @@ -16,7 +16,7 @@ class Lexeme(BaseDataType):
}}
'''

def __init__(self, value: Optional[Union[str, int]] = None, **kwargs: Any):
def __init__(self, value: str | int | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -26,7 +26,7 @@ def __init__(self, value: Optional[Union[str, int]] = None, **kwargs: Any):
super().__init__(**kwargs)
self.set_value(value=value)

def set_value(self, value: Optional[Union[str, int]] = None):
def set_value(self, value: str | int | None = None):
assert isinstance(value, (str, int)) or value is None, f"Expected str or int, found {type(value)} ({value})"

if value:
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/monolingualtext.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType
from wikibaseintegrator.wbi_config import config
Expand All @@ -17,7 +17,7 @@ class MonolingualText(BaseDataType):
}}
'''

def __init__(self, text: Optional[str] = None, language: Optional[str] = None, **kwargs: Any):
def __init__(self, text: str | None = None, language: str | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -28,7 +28,7 @@ def __init__(self, text: Optional[str] = None, language: Optional[str] = None, *
super().__init__(**kwargs)
self.set_value(text=text, language=language)

def set_value(self, text: Optional[str] = None, language: Optional[str] = None):
def set_value(self, text: str | None = None, language: str | None = None):
language = language or str(config['DEFAULT_LANGUAGE'])

assert isinstance(text, str) or text is None, f"Expected str, found {type(text)} ({text})"
Expand Down
4 changes: 1 addition & 3 deletions wikibaseintegrator/datatypes/musicalnotation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional

from wikibaseintegrator.datatypes.string import String


Expand All @@ -9,7 +7,7 @@ class MusicalNotation(String):
"""
DTYPE = 'musical-notation'

def set_value(self, value: Optional[str] = None):
def set_value(self, value: str | None = None):
assert isinstance(value, str) or value is None, f"Expected str, found {type(value)} ({value})"

if value:
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/property.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional, Union
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType

Expand All @@ -16,7 +16,7 @@ class Property(BaseDataType):
}}
'''

def __init__(self, value: Optional[Union[str, int]] = None, **kwargs: Any):
def __init__(self, value: str | int | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -27,7 +27,7 @@ def __init__(self, value: Optional[Union[str, int]] = None, **kwargs: Any):
super().__init__(**kwargs)
self.set_value(value=value)

def set_value(self, value: Optional[Union[str, int]] = None):
def set_value(self, value: str | int | None = None):
assert isinstance(value, (str, int)) or value is None, f"Expected str or int, found {type(value)} ({value})"

if value:
Expand Down
10 changes: 5 additions & 5 deletions wikibaseintegrator/datatypes/quantity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Optional, Union
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType
from wikibaseintegrator.wbi_config import config
Expand All @@ -17,8 +17,8 @@ class Quantity(BaseDataType):
}}
'''

def __init__(self, amount: Optional[Union[str, int, float]] = None, upper_bound: Optional[Union[str, int, float]] = None, lower_bound: Optional[Union[str, int, float]] = None, unit: Union[str, int] = '1',
wikibase_url: Optional[str] = None, **kwargs: Any):
def __init__(self, amount: str | int | float | None = None, upper_bound: str | int | float | None = None, lower_bound: str | int | float | None = None, unit: str | int = '1',
wikibase_url: str | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -33,8 +33,8 @@ def __init__(self, amount: Optional[Union[str, int, float]] = None, upper_bound:
super().__init__(**kwargs)
self.set_value(amount=amount, upper_bound=upper_bound, lower_bound=lower_bound, unit=unit, wikibase_url=wikibase_url)

def set_value(self, amount: Optional[Union[str, int, float]] = None, upper_bound: Optional[Union[str, int, float]] = None, lower_bound: Optional[Union[str, int, float]] = None, unit: Union[str, int] = '1',
wikibase_url: Optional[str] = None):
def set_value(self, amount: str | int | float | None = None, upper_bound: str | int | float | None = None, lower_bound: str | int | float | None = None, unit: str | int = '1',
wikibase_url: str | None = None):
wikibase_url = wikibase_url or str(config['WIKIBASE_URL'])

unit = str(unit or '1')
Expand Down
6 changes: 3 additions & 3 deletions wikibaseintegrator/datatypes/sense.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Optional
from typing import Any

from wikibaseintegrator.datatypes.basedatatype import BaseDataType

Expand All @@ -16,7 +16,7 @@ class Sense(BaseDataType):
}}
'''

def __init__(self, value: Optional[str] = None, **kwargs: Any):
def __init__(self, value: str | None = None, **kwargs: Any):
"""
Constructor, calls the superclass BaseDataType

Expand All @@ -26,7 +26,7 @@ def __init__(self, value: Optional[str] = None, **kwargs: Any):
super().__init__(**kwargs)
self.set_value(value=value)

def set_value(self, value: Optional[str] = None):
def set_value(self, value: str | None = None):
assert isinstance(value, str) or value is None, f"Expected str, found {type(value)} ({value})"

if value:
Expand Down
Loading
Loading