diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index aa5fefd..04c3fea 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 2f57c5b..22315be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/tests/test_l9format.py b/tests/test_l9format.py index 443ba80..6ce2e2a 100644 --- a/tests/test_l9format.py +++ b/tests/test_l9format.py @@ -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