diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 11fc491..e648b58 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,7 +7,7 @@ assignees: '' --- -**Is your feature request related to a problem? Please describe.** +**Is your feature request related to a problem? Please describe** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** diff --git a/.github/workflows/ci-cd-docs.yml b/.github/workflows/ci-cd-docs.yml index 952488e..ca98e0c 100644 --- a/.github/workflows/ci-cd-docs.yml +++ b/.github/workflows/ci-cd-docs.yml @@ -4,6 +4,8 @@ on: push: branches: - main + tags: + - '*' # Later: \b[0-9]\.[0-9]+\.[0-9]+[ab]?[0-9]?\b pull_request: types: - opened diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 2f3e6a8..7709bda 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -4,6 +4,8 @@ on: push: branches: - main + tags: + - '*' # Later: \b[0-9]\.[0-9]+\.[0-9]+[ab]?[0-9]?\b pull_request: types: - opened @@ -35,8 +37,11 @@ jobs: run: pre-commit run --all-files publish: if: success() && startsWith(github.ref, 'refs/tags') - name: Publish to PyPI + name: Publish release to PyPI runs-on: ubuntu-latest + environment: release + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - name: Checkout uses: actions/checkout@v4 @@ -48,8 +53,5 @@ jobs: run: | python -m pip install --upgrade build python -m build - - name: Publish package distributions to PyPI + - name: Upload package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2c6c86e..bbe94dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.2 + rev: v0.3.5 hooks: - id: ruff args: [ --fix ] @@ -17,8 +17,13 @@ repos: rev: v8.18.2 hooks: - id: gitleaks + - repo: https://github.com/pypa/pip-audit + rev: v2.7.2 + hooks: + - id: pip-audit + args: ["--skip-editable"] - repo: https://github.com/compilerla/conventional-pre-commit - rev: v3.1.0 + rev: v3.2.0 hooks: - id: conventional-pre-commit stages: [commit-msg] diff --git a/CHANGELOG.md b/CHANGELOG.md index 103e173..9842d00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.7.0] - 2014-04-13 +## [0.7.0] - April, 2024 -### Added +### New Features - Beta release implementing what you can find in its [documentation](https://pages.github.com/MAIF/arta). - -### Changed -- Nothing. - -### Removed -- Nothing. diff --git a/NOTICE b/NOTICE index d2d00dc..06538d8 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ This software is licensed under the Apache 2 license, quoted below. -Copyright 2019 MAIF and contributors +Copyright 2024 MAIF and contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of diff --git a/pyproject.toml b/pyproject.toml index 733e49b..fb16593 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,16 +17,16 @@ authors = [ classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", ] dependencies = [ - "omegaconf", - "pydantic", + "omegaconf>=2.0.0", + "pydantic>=1.0.0", ] [project.optional-dependencies] @@ -44,7 +44,7 @@ package-dir = {"" = "src"} where = ["src"] [tool.setuptools.package-data] -"*" = ["py.typed"] +"arta" = ["py.typed"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/src/arta/__init__.py b/src/arta/__init__.py index 8b0528c..5e1ece9 100644 --- a/src/arta/__init__.py +++ b/src/arta/__init__.py @@ -3,8 +3,7 @@ from importlib.metadata import version from arta._engine import RulesEngine -from arta.utils import ConditionExecutionError, RuleExecutionError -__all__ = ["RulesEngine", "ConditionExecutionError", "RuleExecutionError"] +__all__ = ["RulesEngine"] __version__ = version("arta") diff --git a/src/arta/condition.py b/src/arta/condition.py index 4f9a0be..233e3ae 100644 --- a/src/arta/condition.py +++ b/src/arta/condition.py @@ -7,7 +7,8 @@ from abc import ABC, abstractmethod from typing import Any, Callable, Dict, List, Optional, Set -from arta.utils import UPPERCASE_WORD_PATTERN, ConditionExecutionError, ParsingErrorStrategy, parse_dynamic_parameter +from arta.exceptions import ConditionExecutionError +from arta.utils import UPPERCASE_WORD_PATTERN, ParsingErrorStrategy, parse_dynamic_parameter class BaseCondition(ABC): diff --git a/src/arta/exceptions.py b/src/arta/exceptions.py new file mode 100644 index 0000000..fc785ac --- /dev/null +++ b/src/arta/exceptions.py @@ -0,0 +1,13 @@ +"""Custom exceptions.""" + + +class RuleExecutionError(Exception): + """Rule fails during its execution.""" + + pass + + +class ConditionExecutionError(Exception): + """Condition fails during its execution.""" + + pass diff --git a/src/arta/rule.py b/src/arta/rule.py index 15fbe59..5aa1f34 100644 --- a/src/arta/rule.py +++ b/src/arta/rule.py @@ -7,10 +7,9 @@ from typing import Any, Callable, Dict, Optional, Set, Tuple, Type from arta.condition import BaseCondition, StandardCondition +from arta.exceptions import ConditionExecutionError, RuleExecutionError from arta.utils import ( - ConditionExecutionError, ParsingErrorStrategy, - RuleExecutionError, parse_dynamic_parameter, sanitize_regex, ) diff --git a/src/arta/utils.py b/src/arta/utils.py index db1587b..d24f523 100644 --- a/src/arta/utils.py +++ b/src/arta/utils.py @@ -9,18 +9,6 @@ UPPERCASE_WORD_PATTERN: str = r"\b[A-Z_0-9]+\b" -class RuleExecutionError(Exception): - """Exception raised when a Rule fails during its execution.""" - - pass - - -class ConditionExecutionError(Exception): - """Exception raised when a Condition fails during its execution.""" - - pass - - class ParsingErrorStrategy(str, Enum): """Define authorized error handling strategies when a key is missing in the input data.""" diff --git a/tests/unit/test_engine_errors.py b/tests/unit/test_engine_errors.py index 55875a7..d8ce10f 100644 --- a/tests/unit/test_engine_errors.py +++ b/tests/unit/test_engine_errors.py @@ -4,7 +4,7 @@ import pytest from arta import RulesEngine -from arta import ConditionExecutionError, RuleExecutionError +from arta.exceptions import ConditionExecutionError, RuleExecutionError try: from pydantic import v1 as pydantic diff --git a/tests/unit/test_simple_condition.py b/tests/unit/test_simple_condition.py index 583559b..f75d92a 100644 --- a/tests/unit/test_simple_condition.py +++ b/tests/unit/test_simple_condition.py @@ -4,7 +4,7 @@ import pytest from arta import RulesEngine -from arta.utils import ConditionExecutionError, RuleExecutionError +from arta.exceptions import ConditionExecutionError, RuleExecutionError @pytest.mark.parametrize(