-
Notifications
You must be signed in to change notification settings - Fork 17
Modernize project structure (pyproject.toml). Use nox for workflows #30
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
Kamforka
merged 4 commits into
TheHive-Project:master
from
JuanTecedor:modernize_and_standarize_project
Jun 7, 2026
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import os | ||
|
|
||
| import nox | ||
|
|
||
| PROJECT_DIR = os.path.dirname(__file__) | ||
| CORTEXUTILS_DIR = os.path.join(PROJECT_DIR, "cortexutils/") | ||
| TESTS_DIR = os.path.join(PROJECT_DIR, "tests/") | ||
|
|
||
| nox.options.default_venv_backend = "none" | ||
| nox.options.keywords = "ci and not test" | ||
|
|
||
|
|
||
| @nox.session(tags=["ci", "lint"]) | ||
| def style(session: nox.Session): | ||
| """Run style checks with ruff.""" | ||
| session.run("ruff", "check", CORTEXUTILS_DIR, TESTS_DIR, __file__) | ||
|
|
||
|
|
||
| @nox.session(tags=["ci", "lint"]) | ||
| def format(session: nox.Session): | ||
| """Run format checks with ruff.""" | ||
| session.run("ruff", "format", "--check", CORTEXUTILS_DIR, TESTS_DIR, __file__) | ||
|
|
||
|
|
||
| @nox.session(tags=["ci", "lint"]) | ||
| def type(session: nox.Session): | ||
| """Run type checks with mypy.""" | ||
| session.run("mypy", "--install-types", "--non-interactive", CORTEXUTILS_DIR) | ||
|
|
||
|
|
||
| @nox.session(tags=["ci", "audit"]) | ||
| def cve(session: nox.Session): | ||
| """Run cve checks with pip-audit.""" | ||
| session.run("pip-audit", PROJECT_DIR) | ||
|
|
||
|
|
||
| @nox.session(tags=["ci", "audit"]) | ||
| def security(session: nox.Session): | ||
| """Run security checks with bandit.""" | ||
| session.run("bandit", "-r", CORTEXUTILS_DIR) | ||
|
|
||
|
|
||
| @nox.session(tags=["ci", "test"]) | ||
| def test(session: nox.Session): | ||
| """Run unit tests with pytest.""" | ||
|
|
||
| if not session.posargs: | ||
| session.run("pytest", "-v", "--cov") | ||
| else: | ||
| session.run("pytest", *session.posargs) | ||
|
|
||
|
|
||
| @nox.session(tags=["cd", "build"]) | ||
| def build(session: nox.Session): | ||
| """Build with the build module.""" | ||
| session.run("rm", "-rf", "build/", "dist/") | ||
| session.run("python", "-m", "build", "--sdist", "--wheel") | ||
|
|
||
|
|
||
| @nox.session(tags=["cd", "upload"]) | ||
| def upload(session: nox.Session): | ||
| """Upload to PyPI using twine.""" | ||
|
|
||
| session.run( | ||
| "bash", | ||
| "-c", | ||
| r""" | ||
| TAG=${GITHUB_REF#refs/*/} | ||
| VERSION=$(grep -Po '(?<=version = ")[^"]*' pyproject.toml) | ||
| if [ "$TAG" != "$VERSION" ]; then | ||
| echo "Tag value and package version are different: ${TAG} != ${VERSION}" | ||
| exit 1 | ||
| else | ||
| echo "Matching tag value and package version!" | ||
| fi | ||
| """, | ||
| ) | ||
| session.run("twine", "upload", "dist/*") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| [build-system] | ||
| requires = ["setuptools", "setuptools-scm"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "cortexutils" | ||
| version = "2.3.0" | ||
| description = "A Python library for including utility classes for Cortex analyzers and responders" | ||
| readme = "README" | ||
| requires-python = ">=3.10" | ||
| dependencies = [] | ||
| license = "AGPL-3.0-or-later" | ||
| keywords = ["cortex", "analyzer", "responder", "thehive"] | ||
| classifiers = [ | ||
| "Development Status :: 5 - Production/Stable", | ||
| "Intended Audience :: Developers", | ||
| "Intended Audience :: Information Technology", | ||
| "Intended Audience :: Science/Research", | ||
| "Natural Language :: English", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "Programming Language :: Python :: 3.14", | ||
| "Topic :: Security", | ||
| "Topic :: Software Development :: Libraries :: Python Modules", | ||
| ] | ||
| authors = [{ name = "TheHive-Project", email = "support@thehive-project.org" }] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/TheHive-Project/cortexutils" | ||
|
|
||
| [project.optional-dependencies] | ||
| audit = ["bandit", "pip-audit"] | ||
| build = ["build", "twine"] | ||
| lint = ["mypy", "ruff", "pre-commit"] | ||
| test = ["pytest", "pytest-cov"] | ||
| dev = ["cortexutils[audit, lint, test, build]", "nox"] | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| include = ["cortexutils*"] | ||
|
|
||
| [tool.coverage.run] | ||
| omit = ["tests/*"] | ||
|
|
||
| [tool.pytest.ini_options] | ||
| testpaths = ["tests"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.