Skip to content

Commit a935284

Browse files
committed
Add support for Python 3.14
1 parent bcc0588 commit a935284

File tree

18 files changed

+838
-290
lines changed

18 files changed

+838
-290
lines changed

.github/workflows/build-v2.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
python-version:
7575
- "3.12"
7676
- "3.13"
77+
- "3.14"
7778
runs-on: ${{ matrix.os }}
7879
defaults:
7980
run:

.github/workflows/build.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
python-version:
6868
- "3.12"
6969
- "3.13"
70+
- "3.14"
7071
# REMINDER: Update EXPECTED_WHEEL_COUNT below when changing Python versions
7172
defaults:
7273
run:
@@ -158,6 +159,8 @@ jobs:
158159
python-version:
159160
- "3.12"
160161
- "3.13"
162+
- "3.14"
163+
# REMINDER: Update EXPECTED_WHEEL_COUNT below when changing Python versions
161164
defaults:
162165
run:
163166
shell: bash
@@ -252,6 +255,8 @@ jobs:
252255
python-version:
253256
- "3.12"
254257
- "3.13"
258+
- "3.14"
259+
# REMINDER: Update EXPECTED_WHEEL_COUNT below when changing Python versions
255260
defaults:
256261
run:
257262
shell: bash
@@ -308,6 +313,7 @@ jobs:
308313
python-version:
309314
- "3.12"
310315
- "3.13"
316+
# REMINDER: Update EXPECTED_WHEEL_COUNT below when changing Python versions
311317
defaults:
312318
run:
313319
shell: bash
@@ -380,7 +386,7 @@ jobs:
380386
CLOUDFLARE_R2_URL: ${{ secrets.CLOUDFLARE_R2_URL }}
381387
CLOUDFLARE_R2_REGION: "auto"
382388
CLOUDFLARE_R2_BUCKET_NAME: "packages"
383-
EXPECTED_WHEEL_COUNT: 6 # 2 Python versions (3.12, 3.13) × 3 platforms (ARM skipped on develop)
389+
EXPECTED_WHEEL_COUNT: 8 # Linux x86 (3) + macOS (3) + Windows (2, no 3.14 support)
384390
steps:
385391
# https://github.com/step-security/harden-runner
386392
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
@@ -444,7 +450,7 @@ jobs:
444450
CLOUDFLARE_R2_URL: ${{ secrets.CLOUDFLARE_R2_URL }}
445451
CLOUDFLARE_R2_REGION: "auto"
446452
CLOUDFLARE_R2_BUCKET_NAME: "packages"
447-
EXPECTED_WHEEL_COUNT: 8 # 2 Python versions (3.12, 3.13) × 4 platforms
453+
EXPECTED_WHEEL_COUNT: 11 # Linux x86 (3) + Linux ARM (3) + macOS (3) + Windows (2, no 3.14 support)
448454
steps:
449455
# https://github.com/step-security/harden-runner
450456
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
@@ -508,7 +514,7 @@ jobs:
508514
CLOUDFLARE_R2_URL: ${{ secrets.CLOUDFLARE_R2_URL }}
509515
CLOUDFLARE_R2_REGION: "auto"
510516
CLOUDFLARE_R2_BUCKET_NAME: "packages"
511-
EXPECTED_WHEEL_COUNT: 8 # 2 Python versions (3.12, 3.13) × 4 platforms
517+
EXPECTED_WHEEL_COUNT: 11 # Linux x86 (3) + Linux ARM (3) + macOS (3) + Windows (2, no 3.14 support)
512518
steps:
513519
# https://github.com/step-security/harden-runner
514520
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1

.pre-commit-config.yaml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,22 @@ repos:
239239
entry: "isort"
240240
args: ["--settings-file", "pyproject.toml"]
241241

242-
- repo: https://github.com/PyCQA/docformatter
243-
rev: v1.7.7
244-
hooks:
245-
- id: docformatter
246-
additional_dependencies: [tomli]
247-
args: [
248-
"--wrap-summaries", "88",
249-
"--wrap-descriptions", "88",
250-
"--make-summary-multi-line",
251-
"--pre-summary-newline",
252-
"--blank",
253-
"--recursive",
254-
"--in-place",
255-
]
242+
# Temporarily disabled due to untokenize incompatibility with Python 3.14
243+
# - repo: https://github.com/PyCQA/docformatter
244+
# rev: v1.7.7
245+
# hooks:
246+
# - id: docformatter
247+
# language_version: python3.13 # Pin to 3.13 due to untokenize incompatibility with 3.14
248+
# additional_dependencies: [tomli]
249+
# args: [
250+
# "--wrap-summaries", "88",
251+
# "--wrap-descriptions", "88",
252+
# "--make-summary-multi-line",
253+
# "--pre-summary-newline",
254+
# "--blank",
255+
# "--recursive",
256+
# "--in-place",
257+
# ]
256258

257259
- repo: https://github.com/pre-commit/mirrors-mypy
258260
rev: v1.18.2

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ chrono = { version = "0.4.42", default-features = false, features = [
123123
"clock",
124124
] }
125125
chrono-tz = "0.10.4"
126-
clap = { version = "4.5.50", features = ["derive", "env"] }
126+
clap = { version = "4.5.51", features = ["derive", "env"] }
127127
compare = "0.1.0"
128128
csv = "1.4.0"
129129
dashmap = "6.1.0"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
| Platform | Rust | Python |
1818
| :----------------- | :----- | :-------- |
19-
| `Linux (x86_64)` | 1.90.0 | 3.12-3.13 |
20-
| `Linux (ARM64)` | 1.90.0 | 3.12-3.13 |
21-
| `macOS (ARM64)` | 1.90.0 | 3.12-3.13 |
19+
| `Linux (x86_64)` | 1.90.0 | 3.12-3.14 |
20+
| `Linux (ARM64)` | 1.90.0 | 3.12-3.14 |
21+
| `macOS (ARM64)` | 1.90.0 | 3.12-3.14 |
2222
| `Windows (x86_64)` | 1.90.0 | 3.12-3.13 |
2323

2424
- **Docs**: <https://nautilustrader.io/docs/>

RELEASES.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
Released on TBD (UTC).
44

5+
This release adds support for Python 3.14 with the following limitations:
6+
- Windows platform: Python 3.14 not supported yet (available on Python 3.12-3.13)
7+
- dYdX adapter extras (`[dydx]`) unavailable due to upstream `coincurve` compatibility (available on Python 3.12-3.13)
8+
- Interactive Brokers adapter extras (`[ib]`) unavailable due to upstream `nautilus-ibapi` compatibility (available on Python 3.12-3.13)
9+
510
### Enhancements
11+
- Added support for Python 3.14
612
- Added initial backtest visualization tearsheets with plotly
713
- Added `proxy_url` support for HTTP clients
814
- Added `CAGR` portfolio statistic
@@ -16,18 +22,23 @@ Released on TBD (UTC).
1622
### Breaking Changes
1723
- Dropped support for Python 3.11
1824
- Removed `use_ws_trade_api` config option from Bybit execution client (using WebSocket trade API only)
25+
- dYdX adapter extras (`[dydx]`) unavailable on Python 3.14 due to upstream `coincurve` compatibility (available on Python 3.12-3.13)
26+
- Interactive Brokers adapter extras (`[ib]`) unavailable on Python 3.14 due to upstream `nautilus-ibapi` compatibility (available on Python 3.12-3.13)
1927

2028
### Security
2129
TBD
2230

2331
### Fixes
24-
- Fixed OKX spot margin position reports for borrowing
2532
- Fixed spawned order client_id caching in `ExecAlgorithm`, thanks for reporting @kirill-gr1
2633

2734
### Internal Improvements
2835
- Added BitMEX submit broadcaster
36+
- Added non-mutating swap quote simulation for Pool tickmap profiling (#3123), thanks @filipmacek
2937
- Ported Bybit integration adapter to Rust
3038
- Refactored reading of feather files in catalog (#3114), thanks @faysou
39+
- Repaired OKX spot margin position reports for borrowing, thanks @sunlei
40+
- Repaired Bybit docs links in comment (#3125), thanks @sunlei
41+
- Repaired Bybit HTTP order place (#3127), thanks @sunlei
3142
- Upgraded implied-vol crate (#3115), thanks @faysou
3243

3344
### Documentation Updates

docs/getting_started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
To get started with NautilusTrader, you will need:
44

5-
- A Python 3.12–3.13 environment with the `nautilus_trader` package installed.
5+
- A Python 3.12–3.14 environment with the `nautilus_trader` package installed.
66
- A way to run Python scripts or Jupyter notebooks for backtesting and/or live trading.
77

88
## [Installation](installation.md)

docs/getting_started/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Installation
22

3-
NautilusTrader is officially supported for Python 3.12-3.13 on the following 64-bit platforms:
3+
NautilusTrader is officially supported for Python 3.12-3.14 on the following 64-bit platforms:
44

55
| Operating System | Supported Versions | CPU Architecture |
66
|------------------------|--------------------|-------------------|

nautilus_trader/model/custom.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
# -------------------------------------------------------------------------------------------------
1515

16+
import sys
1617
from dataclasses import dataclass
1718
from typing import Any
1819

@@ -85,7 +86,12 @@ def ts_init(self) -> int:
8586
if "to_dict" not in cls.__dict__:
8687

8788
def to_dict(self) -> dict[str, Any]:
88-
result = {attr: getattr(self, attr) for attr in self.__annotations__}
89+
# Python 3.14+ uses PEP 649 lazy annotations
90+
if sys.version_info >= (3, 14) and hasattr(self.__class__, "__annotate__") and self.__class__.__annotate__:
91+
annotations = self.__class__.__annotate__(1) # 1 = eval annotations
92+
else:
93+
annotations = getattr(self.__class__, "__annotations__", {})
94+
result = {attr: getattr(self, attr) for attr in annotations}
8995

9096
if hasattr(self, "instrument_id"):
9197
result["instrument_id"] = self.instrument_id.value

0 commit comments

Comments
 (0)