Skip to content

Integ 2841/user agent #414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 8, 2025
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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.
Expand Down
17 changes: 9 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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={
Expand All @@ -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",
],
},
Expand All @@ -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"]},
Expand Down
5 changes: 3 additions & 2 deletions src/code42cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down
4 changes: 0 additions & 4 deletions src/code42cli/output_formats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import csv
import io
import json
import warnings
from itertools import chain
from typing import Generator

Expand All @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_output_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{312,311,310,39,38,37}
py{312,311,310,39}
docs
style
skip_missing_interpreters = true
Expand All @@ -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

Expand Down
Loading