Skip to content
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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_size = 4
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @kenany
109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: CI

on:
push:
branches:
- main

pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review

merge_group:

workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0

- name: Install uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
enable-cache: true

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version-file: .python-version

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Build
run: uv build

mypy:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0

- name: Install uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
enable-cache: true

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version-file: .python-version

- name: Install dependencies
run: uv sync --all-extras --dev

- name: mypy
run: uv run mypy .

ruff-check:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0

- name: Install uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
enable-cache: true

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version-file: .python-version

- name: Install dependencies
run: uv sync --all-extras --dev

- name: ruff
run: uv run ruff check .

ruff-format:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0

- name: Install uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
enable-cache: true

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version-file: .python-version

- name: Install dependencies
run: uv sync --all-extras --dev

- name: ruff format
run: uv run ruff format --check .
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish

on:
release:
types: [published]

workflow_dispatch:

jobs:
publish:
name: publish
runs-on: ubuntu-24.04

environment:
name: pypi
url: https://pypi.org/p/crowdstrike-aidr

permissions:
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
with:
enable-cache: true

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version-file: .python-version

- name: Install dependencies
run: uv sync --locked

- name: Build
run: uv build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__
.mypy_cache
.venv
dist
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 CrowdStrike

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# aidr-python
Python SDK for CrowdStrike AIDR
# CrowdStrike AIDR Python SDK

Python SDK for CrowdStrike AIDR.
59 changes: 59 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.simpleFlake {
inherit self nixpkgs;
name = "aidr-python";
shell = {pkgs ? import <nixpkgs>}:
pkgs.mkShellNoCC {
packages = with pkgs; [
python313
uv
];

env = {};

shellHook = '''';
};
};
}
78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[project]
name = "crowdstrike-aidr"
version = "0.0.0"
description = "Python SDK for CrowdStrike AIDR."
readme = "README.md"
license = "MIT"
authors = [
{ name = "CrowdStrike", email = "support@crowdstrike.com" },
]
classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: Apache Software License"
]

requires-python = ">=3.13"

dependencies = [
"httpx ~=0.28.1",
"pydantic ~=2.12.5",
"typing-extensions ~=4.15.0",
]

[dependency-groups]
dev = [
"mypy ==1.19.0",
"pytest-asyncio ==1.3.0",
"pytest_httpserver ==1.1.3",
"ruff ==0.14.9",
]

[build-system]
requires = ["uv_build ==0.9.13"]
build-backend = "uv_build"

[tool.mypy]
python_version = "3.13"
color_output = true
error_summary = true
implicit_reexport = false
pretty = true
show_column_numbers = true
warn_unused_ignores = true
plugins = ['pydantic.mypy']

[tool.pydantic-mypy]
init_forbid_extra = false
init_typed = true
warn_required_dynamic_aliases = true

[tool.ruff]
line-length = 120
target-version = "py313"

[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # Pyflakes
"FA", # flake8-future-annotations
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"I", # isort
"RUF022", # unsorted-dunder-all
]
ignore = []

[tool.lint.pyupgrade]
# Preserve types, even if a file has `from __future__ import annotations`.
keep-runtime-typing = true
19 changes: 19 additions & 0 deletions scripts/generate-models
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -e

cd -- "$(dirname -- "$0")/.."

uvx --from datamodel-code-generator datamodel-codegen \
--all-exports-scope recursive \
--custom-file-header "# ruff: noqa: E501,UP007,UP045" \
--collapse-root-models \
--enum-field-as-literal all \
--output-model-type pydantic_v2.BaseModel \
--target-python-version 3.13 \
--use-annotated \
--use-field-description \
--use-schema-description \
--use-standard-collections \
--input $1 \
--output models.py
Loading