diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9ec99b8..a8dc027d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 @@ -54,6 +54,6 @@ jobs: - name: Install ncat run: sudo apt-get install ncat - name: Start up the mock servers - run: cd code42-mock-servers; docker-compose up -d --build + run: cd code42-mock-servers; docker compose up -d --build - name: Run the integration tests run: sleep 15; tox -e integration diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2aa02626..38ace65f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 64645e65..55779389 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,7 +12,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: '3.8' + python-version: '3.9' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/CHANGELOG.md b/CHANGELOG.md index d5369176..e1f36d6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The intended audience of this file is for py42 consumers -- as such, changes that don't affect how a consumer would use the library (e.g. adding unit tests, updating documentation, etc) are not captured here. +## Unreleased + +## Changed + +- Updated the user-agent prefix for compatibility with Incydr conventions. + +## Removed + +- Removed support for end-of-life python versions 3.6, 3.7, 3.8. + ## 1.18.0 - 2023-11-30 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5527425d..6ff27506 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,13 +50,13 @@ pyenv virtualenv 3.9.10 code42cli pyenv activate code42cli ``` -**Note**: The CLI supports pythons versions 3.6 through 3.9 for end users. However due to some of the build dependencies, you'll need a version >=3.7 for your virtual environment. Use `pyenv --versions` to see all versions available for install. There are some known issues installing python 3.6 with pyenv on certain OS. +**Note**: The CLI supports pythons versions 3.9 through 3.12 for end users. Use `pyenv --versions` to see all versions available for install. Use `source deactivate` to exit the virtual environment and `pyenv activate code42cli` to reactivate it. ### Windows/Linux -Install a version of python 3.6 or higher from [python.org](https://python.org). +Install a version of python 3.9 or higher from [python.org](https://python.org). Next, in a directory somewhere outside the project, create and activate your virtual environment: ```bash @@ -86,7 +86,7 @@ point to your virtual environment, and you should be ready to go! ## Run a full build -We use [tox](https://tox.readthedocs.io/en/latest/#) to run our build against Python 3.6, 3.7, and 3.8. When run locally, `tox` will run only against the version of python that your virtual envrionment is running, but all versions will be validated against when you [open a PR](#opening-a-pr). +We use [tox](https://tox.readthedocs.io/en/latest/#) to run our build against Python 3.9, 3.10, 3.11 and 3.12. When run locally, `tox` will run only against the version of python that your virtual envrionment is running, but all versions will be validated against when you [open a PR](#opening-a-pr). To run all the unit tests, do a test build of the documentation, and check that the code meets all style requirements, simply run: @@ -97,7 +97,7 @@ If the full process runs without any errors, your environment is set up correctl ## Coding Style -Use syntax and built-in modules that are compatible with Python 3.6+. +Use syntax and built-in modules that are compatible with Python 3.9+. ### Style linter diff --git a/docs/conf.py b/docs/conf.py index 94ced009..87a5ab36 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,7 +43,7 @@ ] # Add myst_parser types to suppress warnings -suppress_warnings = ["myst.header"] +suppress_warnings = ["myst.header", "myst.xref_missing"] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -61,7 +61,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +# language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/setup.py b/setup.py index 72965d45..694c4a7e 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ package_dir={"": "src"}, include_package_data=True, zip_safe=False, - python_requires=">=3.6.2, <4", + python_requires=">=3.9, <4", install_requires=[ "chardet", "click>=7.1.1", @@ -40,7 +40,7 @@ "ipython>=7.16.3;python_version<'3.8'", "ipython>=8.10.0;python_version>='3.8'", "pandas>=1.1.3", - "py42>=1.26.0", + "py42>=1.27.2", "setuptools>=66.0.0", ], extras_require={ @@ -53,9 +53,9 @@ "importlib-metadata<5.0", ], "docs": [ - "sphinx==4.4.0", - "myst-parser==0.16", - "sphinx_rtd_theme==1.0.0", + "sphinx==8.1.3", + "myst-parser==4.0.0", + "sphinx_rtd_theme==3.0.2", "sphinx-click", ], }, @@ -65,9 +65,10 @@ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "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 :: Implementation :: CPython", ], entry_points={"console_scripts": ["code42=code42cli.main:cli"]}, diff --git a/src/code42cli/main.py b/src/code42cli/main.py index 9be3d29f..519d2d21 100644 --- a/src/code42cli/main.py +++ b/src/code42cli/main.py @@ -7,10 +7,11 @@ import click from click_plugins import with_plugins from pkg_resources import iter_entry_points -from py42.settings import set_user_agent_suffix +from py42.settings import set_user_agent_prefix from code42cli import BANNER from code42cli import PRODUCT_NAME +from code42cli.__version__ import __version__ from code42cli.click_ext.groups import ExceptionHandlingGroup from code42cli.cmds.alert_rules import alert_rules from code42cli.cmds.alerts import alerts @@ -39,7 +40,7 @@ def exit_on_interrupt(signal, frame): # Sets part of the user agent string that py42 attaches to requests for the purposes of # identifying CLI users. -set_user_agent_suffix(PRODUCT_NAME) +set_user_agent_prefix(f"{PRODUCT_NAME}/{__version__} (Code42; code42.com )") CONTEXT_SETTINGS = { "help_option_names": ["-h", "--help"], diff --git a/src/code42cli/output_formats.py b/src/code42cli/output_formats.py index 114fb706..2b2ab51f 100644 --- a/src/code42cli/output_formats.py +++ b/src/code42cli/output_formats.py @@ -1,7 +1,6 @@ import csv import io import json -import warnings from itertools import chain from typing import Generator @@ -17,9 +16,6 @@ from code42cli.util import find_format_width from code42cli.util import format_to_table -# remove this once we drop support for Python 3.7 -warnings.filterwarnings("ignore", category=FutureWarning) - CEF_DEFAULT_PRODUCT_NAME = "Advanced Exfiltration Detection" CEF_DEFAULT_SEVERITY_LEVEL = "5" diff --git a/tests/test_output_formats.py b/tests/test_output_formats.py index 4c98f95c..d8295dac 100644 --- a/tests/test_output_formats.py +++ b/tests/test_output_formats.py @@ -2,7 +2,7 @@ from collections import OrderedDict import pytest -from numpy import NaN +from numpy import nan as NaN from pandas import DataFrame import code42cli.output_formats as output_formats_module diff --git a/tox.ini b/tox.ini index e8cea7f8..b69f3de9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{312,311,310,39,38,37} + py{312,311,310,39} docs style skip_missing_interpreters = true @@ -25,9 +25,9 @@ commands = [testenv:docs] deps = - sphinx == 4.4.0 - myst-parser == 0.17.2 - sphinx_rtd_theme == 1.0.0 + sphinx == 8.1.3 + myst-parser == 4.0.0 + sphinx_rtd_theme == 3.0.2 sphinx-click whitelist_externals = bash