Skip to content

Commit 2739fef

Browse files
committed
fix tests and add new versions
1 parent 4a4eceb commit 2739fef

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ jobs:
5555
fail-fast: false
5656
matrix:
5757
include:
58-
# Ubuntu - test all stable Python versions (3.9 to 3.13)
58+
# Ubuntu - test all Python versions (3.8 to 3.13)
59+
- os: ubuntu-latest
60+
python-version: '3.8'
5961
- os: ubuntu-latest
6062
python-version: '3.9'
6163
- os: ubuntu-latest
@@ -67,19 +69,31 @@ jobs:
6769
- os: ubuntu-latest
6870
python-version: '3.13'
6971

70-
# macOS - test representative Python versions
72+
# macOS - test all Python versions (3.8 to 3.13)
73+
- os: macos-latest
74+
python-version: '3.8'
7175
- os: macos-latest
7276
python-version: '3.9'
77+
- os: macos-latest
78+
python-version: '3.10'
7379
- os: macos-latest
7480
python-version: '3.11'
81+
- os: macos-latest
82+
python-version: '3.12'
7583
- os: macos-latest
7684
python-version: '3.13'
7785

78-
# Windows - test representative Python versions
86+
# Windows - test all Python versions (3.8 to 3.13)
87+
- os: windows-latest
88+
python-version: '3.8'
7989
- os: windows-latest
8090
python-version: '3.9'
91+
- os: windows-latest
92+
python-version: '3.10'
8193
- os: windows-latest
8294
python-version: '3.11'
95+
- os: windows-latest
96+
python-version: '3.12'
8397
- os: windows-latest
8498
python-version: '3.13'
8599

backtrader/mixins/singleton.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"""
2121
import threading
2222
import weakref
23-
from typing import Any
23+
from typing import Any, Dict, Optional
2424

2525

2626
class SingletonMixin:
@@ -41,7 +41,7 @@ class SingletonMixin:
4141

4242
# Class-level storage for singleton instances
4343
# Using WeakValueDictionary for automatic cleanup
44-
_instances: dict[type, Any] = weakref.WeakValueDictionary()
44+
_instances: Dict[type, Any] = weakref.WeakValueDictionary()
4545
_lock = threading.Lock()
4646

4747
def __new__(cls, *args, **kwargs):
@@ -86,7 +86,7 @@ def _reset_instance(cls):
8686
del cls._instances[cls]
8787

8888
@classmethod
89-
def _get_instance(cls) -> Any | None:
89+
def _get_instance(cls) -> Optional[Any]:
9090
"""Get the current singleton instance if it exists.
9191
9292
Returns:

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
long_description_content_type="text/markdown", # Long description content type
1717
url="https://gitee.com/yunjinqi/backtrader.git", # Project URL
1818
install_requires=[
19-
# Use flexible numpy version for Python 3.9-3.13 compatibility
19+
# Use flexible numpy version for Python 3.8-3.13 compatibility
2020
"numpy>=1.20.0,<3.0.0",
2121
"pytz>=2021.1",
2222
"pandas>=1.3.0",
@@ -43,6 +43,7 @@
4343
}, # List of project dependencies
4444
classifiers=[
4545
"Programming Language :: Python :: 3",
46+
"Programming Language :: Python :: 3.8",
4647
"Programming Language :: Python :: 3.9",
4748
"Programming Language :: Python :: 3.10",
4849
"Programming Language :: Python :: 3.11",

0 commit comments

Comments
 (0)