diff --git a/.github/workflows/python-ci-tests.yml b/.github/workflows/python-ci-tests.yml index 47f860e1..dc4b9a23 100644 --- a/.github/workflows/python-ci-tests.yml +++ b/.github/workflows/python-ci-tests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9, '3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] name: Python ${{ matrix.python-version }} Build steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c39aaf6d..4c6a63d0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: hooks: - id: add-trailing-comma - repo: https://github.com/PyCQA/flake8 - rev: 3.8.4 + rev: 7.1.0 hooks: - id: flake8 name: Check project styling diff --git a/setup.cfg b/setup.cfg index fdc0c861..ae2bcfaf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.0.1 +current_version = 3.0.2 commit = True tag = True diff --git a/setup.py b/setup.py index 80edabb4..d6a9cd0d 100644 --- a/setup.py +++ b/setup.py @@ -38,20 +38,20 @@ def get_long_description(): 'Topic :: Security', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - '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', ], keywords='stix stix2 json cti cyber threat intelligence', packages=find_packages(exclude=['*.test', '*.test.*']), - python_requires='>=3.8', + python_requires='>=3.10', install_requires=[ 'pytz', 'requests', 'simplejson', - 'stix2-patterns>=1.2.0', + 'stix2-patterns>=2.1.2', ], project_urls={ 'Documentation': 'https://stix2.readthedocs.io/', diff --git a/stix2/test/v20/test_pattern_equivalence.py b/stix2/test/v20/test_pattern_equivalence.py index aab85336..04d71891 100644 --- a/stix2/test/v20/test_pattern_equivalence.py +++ b/stix2/test/v20/test_pattern_equivalence.py @@ -10,12 +10,12 @@ @pytest.mark.parametrize( "patt1, patt2", [ ( - "[a:b=1] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z'", - "[a:b=1 OR (a:c=2 AND a:b=1)] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z'", + "[a:b=1] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z'", + "[a:b=1 OR (a:c=2 AND a:b=1)] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z'", ), ( - "[a:b=1] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z' WITHIN 2 SECONDS", - "[a:b=1 OR (a:c=2 AND a:b=1)] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z' WITHIN 2 SECONDS", + "[a:b=1] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z' WITHIN 2 SECONDS", + "[a:b=1 OR (a:c=2 AND a:b=1)] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z' WITHIN 2 SECONDS", ), ( "[a:b=1] REPEATS 2 TIMES REPEATS 2 TIMES", @@ -30,12 +30,12 @@ def test_startstop_equivalent(patt1, patt2): @pytest.mark.parametrize( "patt1, patt2", [ ( - "[a:b!=1] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z'", - "[a:b!=1] START '1977-09-29T07:41:03Z' STOP '1996-09-18T22:46:07Z'", + "[a:b!=1] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z'", + "[a:b!=1] START t'1977-09-29T07:41:03Z' STOP t'1996-09-18T22:46:07Z'", ), ( - "[a:b<1] REPEATS 2 TIMES START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z'", - "[a:b<1] REPEATS 2 TIMES START '1977-09-29T07:41:03Z' STOP '1996-09-18T22:46:07Z'", + "[a:b<1] REPEATS 2 TIMES START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z'", + "[a:b<1] REPEATS 2 TIMES START t'1977-09-29T07:41:03Z' STOP t'1996-09-18T22:46:07Z'", ), ( "[a:b=1] REPEATS 2 TIMES REPEATS 2 TIMES", diff --git a/stix2/test/v20/test_pattern_expressions.py b/stix2/test/v20/test_pattern_expressions.py index 9579ef4c..624f1ae5 100644 --- a/stix2/test/v20/test_pattern_expressions.py +++ b/stix2/test/v20/test_pattern_expressions.py @@ -2,6 +2,7 @@ import pytest import pytz +from stix2patterns.exceptions import ParseException import stix2 from stix2.pattern_visitor import create_pattern_object @@ -551,11 +552,11 @@ def test_parsing_qualified_expression(): def test_parsing_start_stop_qualified_expression(): - patt_obj = create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START '2016-06-01T00:00:00Z' STOP '2017-03-12T08:30:00Z'", version="2.0") + patt_obj = create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START t'2016-06-01T00:00:00Z' STOP t'2017-03-12T08:30:00Z'", version="2.0") assert str( patt_obj, - ) == "[ipv4-addr:value = '1.2.3.4'] START '2016-06-01T00:00:00Z' STOP '2017-03-12T08:30:00Z'" + ) == "[ipv4-addr:value = '1.2.3.4'] START t'2016-06-01T00:00:00Z' STOP t'2017-03-12T08:30:00Z'" def test_parsing_mixed_boolean_expression_1(): @@ -585,8 +586,8 @@ def test_parsing_quoted_second_path_component(): def test_parsing_illegal_start_stop_qualified_expression(): - with pytest.raises(ValueError): - create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START '2016-06-01' STOP '2017-03-12T08:30:00Z'", version="2.0") + with pytest.raises(ParseException): + create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START t'2016-06-01' STOP t'2017-03-12T08:30:00Z'", version="2.0") def test_list_constant(): @@ -631,7 +632,7 @@ def test_ast_class_override_string_constant(): def test_ast_class_override_startstop_qualifier(): patt_ast = create_pattern_object( - "[a:b=1] START '1993-01-20T01:33:52.592Z' STOP '2001-08-19T23:50:23.129Z'", + "[a:b=1] START t'1993-01-20T01:33:52.592Z' STOP t'2001-08-19T23:50:23.129Z'", "Testing", "stix2.test.v20.pattern_ast_overrides", version="2.0", ) @@ -646,4 +647,4 @@ def test_ast_class_override_startstop_qualifier(): assert isinstance( patt_ast.qualifier, StartStopQualifierForTesting, ) - assert str(patt_ast) == "[a:b = 1] START '1993-01-20T01:33:52.592Z' STOP '2001-08-19T23:50:23.129Z'" + assert str(patt_ast) == "[a:b = 1] START t'1993-01-20T01:33:52.592Z' STOP t'2001-08-19T23:50:23.129Z'" diff --git a/stix2/test/v21/test_timestamp_precision.py b/stix2/test/v21/test_timestamp_precision.py index 831bd7a0..5579627f 100644 --- a/stix2/test/v21/test_timestamp_precision.py +++ b/stix2/test/v21/test_timestamp_precision.py @@ -9,7 +9,7 @@ parse_into_datetime, to_enum, ) -_DT = datetime.datetime.utcnow() +_DT = datetime.datetime.now(datetime.timezone.utc) # intentionally omit microseconds from the following. We add it in as # needed for each test. _DT_STR = _DT.strftime("%Y-%m-%dT%H:%M:%S") @@ -55,7 +55,7 @@ def test_stix_datetime_now(): def test_stix_datetime(): - dt = datetime.datetime.utcnow() + dt = datetime.datetime.now(datetime.timezone.utc) sdt = STIXdatetime(dt, precision=Precision.SECOND) assert sdt.precision is Precision.SECOND diff --git a/stix2/version.py b/stix2/version.py index 5679339f..cb1c8b95 100644 --- a/stix2/version.py +++ b/stix2/version.py @@ -1,3 +1,3 @@ -__version__ = "3.0.1" +__version__ = "3.0.2" DEFAULT_VERSION = '2.1' # Default version will always be the latest STIX 2.X version diff --git a/tox.ini b/tox.ini index bc7bd5b6..d8ec9331 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38,py39,py310,py311,py312,packaging,pre-commit-check +envlist = py310,py311,py312,py313,py314,packaging,pre-commit-check [testenv] deps = @@ -19,6 +19,7 @@ passenv = GITHUB_* [testenv:packaging] deps = twine + setuptools commands = python setup.py sdist bdist_wheel --universal twine check dist/* @@ -31,8 +32,8 @@ commands = [gh-actions] python = - 3.8: py38 - 3.9: py39 3.10: py310 - 3.11: py311, packaging, pre-commit-check + 3.11: py311 3.12: py312 + 3.13: py313 + 3.14: py314, packaging, pre-commit-check