Skip to content

chore: a big update #422

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

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
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
3 changes: 0 additions & 3 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- "main"
- "develop"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches: [main, develop]

Expand Down Expand Up @@ -59,7 +57,6 @@ jobs:
- uses: pre-commit/action@v3.0.1

semgrep:
if: github.actor != 'dependabot[bot]'
uses: splunk/sast-scanning/.github/workflows/sast-scan.yml@main
secrets:
SEMGREP_KEY: ${{ secrets.SEMGREP_PUBLISH_TOKEN }}
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ name: docs
on:
push:
branches:
- main
- "main"
- "develop"
pull_request:
branches:
- "main"
- "develop"
jobs:
deploy:
runs-on: ubuntu-latest
Expand All @@ -17,4 +22,9 @@ jobs:
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
- run: |
poetry install
poetry run mkdocs gh-deploy --force
- name: Deploy to GitHub Pages
if: github.ref_name == 'main'
run: poetry run mkdocs gh-deploy --force --strict
- name: Build Docs
if: github.ref_name != 'main'
run: poetry run mkdocs build --strict
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
rev: v3.3.2
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/myint/docformatter
Expand Down
1 change: 0 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
branches:
[
"+([0-9])?(.{+([0-9]),x}).x",
"main",
{ name: "develop", prerelease: "beta", channel: "beta" },
],
Expand Down
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# README
# solnlib

Splunk Solutions SDK is an open source packaged solution for getting data into Splunk using modular inputs.
This SDK is used by Splunk Add-on builder, and Splunk UCC based add-ons and is intended for use by partner
developers. This SDK/Library extends the Splunk SDK for python
![PyPI](https://img.shields.io/pypi/v/solnlib)
![Python](https://img.shields.io/pypi/pyversions/solnlib.svg)
![PyPI monthly downloads](https://img.shields.io/pypi/dm/solnlib)

## What is solnlib?

`solnlib` is an open source Python library designed to be used in Splunk technology add-ons.

It allows to:
* interact with Splunk's KVStore to manage checkpoints
* read, update and delete secrets in Splunk's credential store
* manipulate with Splunk's .conf files
* and many more

Documentation is available [here](https://splunk.github.io/addonfactory-solutions-library-python/).

Expand All @@ -14,9 +24,13 @@ If you are a part of the community use: https://splunk-usergroups.slack.com/arch

## Support

Splunk Solutions SDK is an open source product developed by Splunkers. This SDK is not "Supported Software" by Splunk, Inc. issues and defects can be reported
`solnlib` is an open source product developed by Splunkers. This SDK is not "Supported Software" by Splunk, Inc. issues and defects can be reported
via the public issue tracker.

## Contributing Guidelines

Go to [contributing Guidelines in the repo](docs/contributing.md) or [published version](https://splunk.github.io/solnlib/contributing/).

## License

* Configuration and documentation licensed subject to [APACHE-2.0](LICENSE)
Configuration and documentation licensed subject to [APACHE-2.0](LICENSE).
3 changes: 3 additions & 0 deletions docs/alerts_rest_client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# alerts_rest_client.py

::: solnlib.alerts_rest_client
38 changes: 38 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Contributing Guidelines

We welcome contributions from the community! This guide will help you understand our contribution process and requirements.

## Development guidelines

1. Small PRs ([blogpost](https://testing.googleblog.com/2024/07/in-praise-of-small-pull-requests.html))
1. When fixing a bug, include a test that reproduces the issue in the same pull request (the test should fail without your changes)
1. If you are refactoring, ensure adequate test coverage exists for the target area. If coverage is insufficient, create tests in a separate pull request first. This approach provides a safety net for validating current behavior and simplifies code reviews.

## Build and Test

Prerequisites:

- Poetry 1.5.1 [Installation guide](https://python-poetry.org/docs/#installing-with-the-official-installer)

### Install dependencies

```bash
poetry install
```

### Unit tests

```bash
poetry run pytest tests/unit
```

### Linting and Type-checking

`solnlib` uses the [`pre-commit`](https://pre-commit.com) framework for linting and type-checking.
Consult with `pre-commit` documentation about what is the best way to install the software.

To run it locally:

```bash
pre-commit run --all-files
```
12 changes: 11 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
site_name: Splunk Solutions SDK
site_name: solnlib
site_author: Splunk
site_url: "https://splunk.github.io/solnlib/"
edit_uri: "tree/main/docs/"
remote_branch: gh-pages

repo_name: Splunk Solutions Library
repo_url: "https://github.com/splunk/addonfactory-solutions-library-python"

theme:
name: "material"
Expand Down Expand Up @@ -31,13 +38,16 @@ plugins:
nav:
- Home: index.md
- Release 6.0.0: release_6_0_0.md
- Contributing: contributing.md
- References:
- modular_input:
- "checkpointer.py": modular_input/checkpointer.md
- "event.py": modular_input/event.md
- "event_writer.py": modular_input/event_writer.md
- "modular_input.py": modular_input/modular_input.md
- "acl.py": acl.md
- "alerts_rest_client.py": alerts_rest_client.md
- "bulletin_rest_client.py": bulletin_rest_client.md
- "credentials.py": credentials.md
- "conf_manager.py": conf_manager.md
- "file_monitor.py": file_monitor.md
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

[tool.poetry]
name = "solnlib"
version = "6.1.0-beta.1"
version = "6.0.1"
description = "The Splunk Software Development Kit for Splunk Solutions"
authors = ["Splunk <addonfactory@splunk.com>"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion solnlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@
"utils",
]

__version__ = "6.1.0-beta.1"
__version__ = "6.0.1"
1 change: 0 additions & 1 deletion solnlib/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def splunkd_request(
retry=1,
verify=False,
) -> Optional[requests.Response]:

headers = headers if headers is not None else {}
headers["Authorization"] = f"Splunk {session_key}"
content_type = headers.get("Content-Type")
Expand Down
Loading