Skip to content

Commit bdc19e4

Browse files
Integ 2841/user agent (#414)
* fix tests, deprecate non-supported python versions, add supported python versions * update user-agent * workflows * docker compose * changelog * bump py42 version
1 parent 42c5cba commit bdc19e4

File tree

11 files changed

+37
-29
lines changed

11 files changed

+37
-29
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
17+
python: ["3.9", "3.10", "3.11", "3.12"]
1818

1919
steps:
2020
- uses: actions/checkout@v2
@@ -54,6 +54,6 @@ jobs:
5454
- name: Install ncat
5555
run: sudo apt-get install ncat
5656
- name: Start up the mock servers
57-
run: cd code42-mock-servers; docker-compose up -d --build
57+
run: cd code42-mock-servers; docker compose up -d --build
5858
- name: Run the integration tests
5959
run: sleep 15; tox -e integration

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
14+
python: ["3.9", "3.10", "3.11", "3.12"]
1515

1616
steps:
1717
- uses: actions/checkout@v2

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Set up Python
1313
uses: actions/setup-python@v1
1414
with:
15-
python-version: '3.8'
15+
python-version: '3.9'
1616
- name: Install dependencies
1717
run: |
1818
python -m pip install --upgrade pip

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
The intended audience of this file is for py42 consumers -- as such, changes that don't affect
99
how a consumer would use the library (e.g. adding unit tests, updating documentation, etc) are not captured here.
1010

11+
## Unreleased
12+
13+
## Changed
14+
15+
- Updated the user-agent prefix for compatibility with Incydr conventions.
16+
17+
## Removed
18+
19+
- Removed support for end-of-life python versions 3.6, 3.7, 3.8.
20+
1121
## 1.18.0 - 2023-11-30
1222

1323
### Added

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ pyenv virtualenv 3.9.10 code42cli
5050
pyenv activate code42cli
5151
```
5252

53-
**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.
53+
**Note**: The CLI supports pythons versions 3.9 through 3.12 for end users. Use `pyenv --versions` to see all versions available for install.
5454

5555
Use `source deactivate` to exit the virtual environment and `pyenv activate code42cli` to reactivate it.
5656

5757
### Windows/Linux
5858

59-
Install a version of python 3.6 or higher from [python.org](https://python.org).
59+
Install a version of python 3.9 or higher from [python.org](https://python.org).
6060
Next, in a directory somewhere outside the project, create and activate your virtual environment:
6161

6262
```bash
@@ -86,7 +86,7 @@ point to your virtual environment, and you should be ready to go!
8686

8787
## Run a full build
8888

89-
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).
89+
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).
9090

9191
To run all the unit tests, do a test build of the documentation, and check that the code meets all style requirements, simply run:
9292

@@ -97,7 +97,7 @@ If the full process runs without any errors, your environment is set up correctl
9797

9898
## Coding Style
9999

100-
Use syntax and built-in modules that are compatible with Python 3.6+.
100+
Use syntax and built-in modules that are compatible with Python 3.9+.
101101

102102
### Style linter
103103

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
]
4444

4545
# Add myst_parser types to suppress warnings
46-
suppress_warnings = ["myst.header"]
46+
suppress_warnings = ["myst.header", "myst.xref_missing"]
4747

4848
# Add any paths that contain templates here, relative to this directory.
4949
templates_path = ["_templates"]
@@ -61,7 +61,7 @@
6161
#
6262
# This is also used if you do content translation via gettext catalogs.
6363
# Usually you set "language" from the command line for these cases.
64-
language = None
64+
# language = None
6565

6666
# List of patterns, relative to source directory, that match files and
6767
# directories to ignore when looking for source files.

setup.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
package_dir={"": "src"},
3030
include_package_data=True,
3131
zip_safe=False,
32-
python_requires=">=3.6.2, <4",
32+
python_requires=">=3.9, <4",
3333
install_requires=[
3434
"chardet",
3535
"click>=7.1.1",
@@ -40,7 +40,7 @@
4040
"ipython>=7.16.3;python_version<'3.8'",
4141
"ipython>=8.10.0;python_version>='3.8'",
4242
"pandas>=1.1.3",
43-
"py42>=1.26.0",
43+
"py42>=1.27.2",
4444
"setuptools>=66.0.0",
4545
],
4646
extras_require={
@@ -53,9 +53,9 @@
5353
"importlib-metadata<5.0",
5454
],
5555
"docs": [
56-
"sphinx==4.4.0",
57-
"myst-parser==0.16",
58-
"sphinx_rtd_theme==1.0.0",
56+
"sphinx==8.1.3",
57+
"myst-parser==4.0.0",
58+
"sphinx_rtd_theme==3.0.2",
5959
"sphinx-click",
6060
],
6161
},
@@ -65,9 +65,10 @@
6565
"License :: OSI Approved :: MIT License",
6666
"Programming Language :: Python",
6767
"Programming Language :: Python :: 3",
68-
"Programming Language :: Python :: 3.6",
69-
"Programming Language :: Python :: 3.7",
70-
"Programming Language :: Python :: 3.8",
68+
"Programming Language :: Python :: 3.9",
69+
"Programming Language :: Python :: 3.10",
70+
"Programming Language :: Python :: 3.11",
71+
"Programming Language :: Python :: 3.12",
7172
"Programming Language :: Python :: Implementation :: CPython",
7273
],
7374
entry_points={"console_scripts": ["code42=code42cli.main:cli"]},

src/code42cli/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
import click
88
from click_plugins import with_plugins
99
from pkg_resources import iter_entry_points
10-
from py42.settings import set_user_agent_suffix
10+
from py42.settings import set_user_agent_prefix
1111

1212
from code42cli import BANNER
1313
from code42cli import PRODUCT_NAME
14+
from code42cli.__version__ import __version__
1415
from code42cli.click_ext.groups import ExceptionHandlingGroup
1516
from code42cli.cmds.alert_rules import alert_rules
1617
from code42cli.cmds.alerts import alerts
@@ -39,7 +40,7 @@ def exit_on_interrupt(signal, frame):
3940

4041
# Sets part of the user agent string that py42 attaches to requests for the purposes of
4142
# identifying CLI users.
42-
set_user_agent_suffix(PRODUCT_NAME)
43+
set_user_agent_prefix(f"{PRODUCT_NAME}/{__version__} (Code42; code42.com )")
4344

4445
CONTEXT_SETTINGS = {
4546
"help_option_names": ["-h", "--help"],

src/code42cli/output_formats.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import csv
22
import io
33
import json
4-
import warnings
54
from itertools import chain
65
from typing import Generator
76

@@ -17,9 +16,6 @@
1716
from code42cli.util import find_format_width
1817
from code42cli.util import format_to_table
1918

20-
# remove this once we drop support for Python 3.7
21-
warnings.filterwarnings("ignore", category=FutureWarning)
22-
2319
CEF_DEFAULT_PRODUCT_NAME = "Advanced Exfiltration Detection"
2420
CEF_DEFAULT_SEVERITY_LEVEL = "5"
2521

tests/test_output_formats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from collections import OrderedDict
33

44
import pytest
5-
from numpy import NaN
5+
from numpy import nan as NaN
66
from pandas import DataFrame
77

88
import code42cli.output_formats as output_formats_module

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{312,311,310,39,38,37}
3+
py{312,311,310,39}
44
docs
55
style
66
skip_missing_interpreters = true
@@ -25,9 +25,9 @@ commands =
2525

2626
[testenv:docs]
2727
deps =
28-
sphinx == 4.4.0
29-
myst-parser == 0.17.2
30-
sphinx_rtd_theme == 1.0.0
28+
sphinx == 8.1.3
29+
myst-parser == 4.0.0
30+
sphinx_rtd_theme == 3.0.2
3131
sphinx-click
3232
whitelist_externals = bash
3333

0 commit comments

Comments
 (0)