Skip to content
Open
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/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
poetry-version: ["1.8.5"]
os: ["ubuntu-22.04", "macos-latest", "windows-latest"]
python-version: ["3.13"]
poetry-version: ["2.3.1"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
21 changes: 8 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@ repository = "https://github.com/leakix/l9format-python"
documentation = "https://github.com/leakix/l9format-python"

[tool.poetry.dependencies]
python = "^3.9"
# Updating to 0.9.0 breaks the support of iso8601.
# The author of serde updated its code to use the stdlib iso8601 support, which
# does not support for instance:
# 2023-10-05T23:30:36.823867784Z
# Bump up to python 3.11 fixes the issue as it seems fixed in the stdlib of 3.11
serde = "^0.8.1"
python = "^3.13"
serde = "^0.9.0"

[tool.poetry.group.dev.dependencies]
black = "^24.10.0"
fire = "^0.7.0"
isort = "^5.12.0"
pip-audit = "^2.7.3"
pytest = "^8.3.4"
ruff = "^0.9.2"
black = "^26.1.0"
fire = "^0.7.1"
isort = "^7.0.0"
pip-audit = "^2.10.0"
pytest = "^9.0.2"
ruff = "^0.14.14"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
20 changes: 20 additions & 0 deletions tests/test_l9format.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,23 @@ def test_l9events_form_ip4scout():
for path in IP4SCOUT_FILES:
c = json.load(open(str(path), "r"))
l9format.L9Event.from_dict(c)


def test_iso8601_nanosecond_parsing():
"""
Test ISO8601 datetime parsing with nanosecond precision.

serde 0.9.0+ uses Python stdlib iso8601 support which handles nanoseconds
correctly in Python 3.11+.
"""
path = TESTS_DIR / "l9event.json"
c = json.load(open(str(path), "r"))
# Use a timestamp with nanosecond precision (9 decimal places)
c["time"] = "2023-10-05T23:30:36.823867784Z"
event = l9format.L9Event.from_dict(c)
assert event.time.year == 2023
assert event.time.month == 10
assert event.time.day == 5
assert event.time.hour == 23
assert event.time.minute == 30
assert event.time.second == 36