Skip to content
Open
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
8 changes: 4 additions & 4 deletions .github/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
repos:
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.3.0
hooks:
- id: flake8
exclude: docs/conf.py
args: ["--config", ".github/configurations/python_linters/.flake8"]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 8.0.1
hooks:
- id: isort
args: ["--settings-path", ".github/configurations/python_linters/.isort.cfg", "--filter-files", "--skip", "venv"]
args: ["--settings-path", ".github/configurations/python_linters/.isort.cfg", "--profile", "black", "--filter-files", "--skip", "venv"]

- repo: https://github.com/psf/black
rev: 23.9.1
rev: 26.5.1
hooks:
- id: black
args: ["--config", ".github/configurations/python_linters/.black"]
39 changes: 12 additions & 27 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
id: diff_check
run: |
git branch -a --list | cat
PYTHON_CODE_CHANGES=$(git diff --compact-summary origin/${{ github.base_ref }} -- routingfilter/* | wc -l)
PYTHON_CODE_CHANGES=$(git diff --compact-summary origin/${{ github.base_ref }} -- routingfilter routing_test.py test_data pyproject.toml .github/workflows/python-app.yml .github/configurations | wc -l)
echo "python_code=$PYTHON_CODE_CHANGES" >> "$GITHUB_OUTPUT"

build:
Expand All @@ -40,35 +40,20 @@ jobs:
id: setup_python
uses: actions/setup-python@v7
with:
python-version: "3.10"
- name: "Cache venv"
id: cache_venv
uses: actions/cache@v6
with:
path: venv
key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dependencies
if: steps.cache_venv.outputs.cache-hit != 'true'
run: |
if [ -d "venv" ]; then rm -rf venv; fi
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install flake8 black isort pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Show which copy is under test
run: python -c "import pathlib, routingfilter; print(pathlib.Path(routingfilter.__file__).resolve())"
- name: "Lint with black"
run: |
source venv/bin/activate
black ./routingfilter --config .github/configurations/python_linters/.black --check --diff
run: black ./routingfilter --config .github/configurations/python_linters/.black --check --diff
- name: Lint with flake8
run: |
source venv/bin/activate
flake8 ./routingfilter --config .github/configurations/python_linters/.flake8 --show-source
run: flake8 ./routingfilter --config .github/configurations/python_linters/.flake8 --show-source
- name: "Isort check"
run: |
source venv/bin/activate
isort ./routingfilter --sp .github/configurations/python_linters/.isort.cfg --profile black --filter-files --check-only --diff
run: isort ./routingfilter --sp .github/configurations/python_linters/.isort.cfg --profile black --filter-files --check-only --diff
- name: Test with pytest
run: |
source ./venv/bin/activate
pytest routing_test.py
run: python -m pytest routing_test.py
44 changes: 19 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
.vscode
venv
.ropeproject

# compiled source
*.com
*.class
*.dll
*.exe
*.o
*.so
# IDE and editors
.idea/
.vscode/
.ropeproject/

# Virtual environments
venv/
.venv/

# Byte-compiled files
__pycache__/
*.pyc

# packages
*.7z
*.dmg
*.iso
*.jar
*.rar
# Caches
.pytest_cache/

# logs and databases
# Logs and databases
*.log
*.log.*
*.sql
*.sqlite

# Environment files
.env

# OS generated files
.DS_Store
.DS_Store?
._*

# Pycharm
.idea/

# Documentation
docs/_build
docs/_build/

# Build files
build/
dist/
routingfilter.egg-info/
*.egg-info/
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/RoutingFilter.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
## 2.5.x
### 2.5.0
#### Changes
* Fixed type hints and improved filter robustness, cleaned `.gitignore`
* Migrated packaging metadata from `setup.py` to `pyproject.toml`: removed `setup.py`, `requirements.txt`, `requirements_dev.txt` and `MANIFEST.in`. Development dependencies are now the `dev` extra, installed with `pip install -e ".[dev]"`
* Python 3.12 is now the minimum required version (was 3.10)
* Updated linters and aligned the pre-commit hook revisions with the `dev` extra pins
## 2.4.x
### 2.4.0
#### Bugfix
* Fixed bug in CI about isort execution and cache
#### Changes
* Updated linters, required Python version (>3.10) and Github Actions
* Updated linters, required Python version (>3.10) and GitHub Actions
* Removed dependency from `IPy` in favor of `ipdaddress`
## 2.3.x
### 2.3.3
Expand Down Expand Up @@ -65,7 +72,7 @@
## 1.6.x
### 1.6.3
#### Bugfix
* Fix overwriting of certego field
* Fix overwriting of `certego` field
### 1.6.2
#### Bugfix
* Added filter in routing_filter
Expand Down Expand Up @@ -147,7 +154,7 @@
* An exception is returned (instead of False) when processing a wrong filter type
### 1.1.0
#### Changes
* Changed match output to to list of dicts, to allow multiple rules with different tags to match
* Changed match output to list of dicts, to allow multiple rules with different tags to match
* Now the method laod_from_dicts returns nothing; a new getter has been added to retrieve the currently loaded rules

## 1.0.x
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ All commands are run from the **repository root** (not from the inner `routingfi

```bash
# Install for development
pip install -r requirements.txt -r requirements_dev.txt
pip install -e ".[dev]"
pre-commit install -c .github/.pre-commit-config.yaml

# Run the full test suite
Expand Down Expand Up @@ -93,4 +93,4 @@ Extensive real examples of both rules and events live in `test_data/` (`test_rul

## Release process

Update `requirements.txt`/`setup.py` if needed, add a `CHANGELOG.md` entry, bump the version in `setup.py`, merge to `master`, then publish a GitHub release tagged with the version — CI (`python-publish.yml`) publishes to PyPI automatically.
Update the dependencies in `pyproject.toml` if needed, add a `CHANGELOG.md` entry, bump `version` in `pyproject.toml`, merge to `master`, then publish a GitHub release tagged with the version — CI (`python-publish.yml`) publishes to PyPI automatically.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
i# Contributing to pcapoptikon
# Contributing to RoutingFilter

Thank you for your interest in contributing to Certego’s Open Source projects! To protect you, our users, and the integrity of the software, we require all contributors to accept our **Contributor License Agreement (CLA)**.

Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ routing.match(test_event_1)
See the [online documentation](https://routingfilter.readthedocs.io/en/latest/) for further details.

### Release steps
* (If needed) Update the requirements in `requirements.txt` and `setup.py`
* (If needed) Update the dependencies in `pyproject.toml`
* Add a new entry in `CHANGELOG.md` with the new version number
* Update the version number in `setup.py`
* Update the version number in `pyproject.toml`
* Commit and merge the changes into `master` branch
* Publish a new release with the version number as a tag: the CI will automatically publish the new version un PyPI
* Publish a new release with the version number as a tag: the CI will automatically publish the new version on PyPI

### Benchmark tests
In order to launch the benchmark tests, run ```python routing_benchmark.py```

### Development
* Install `pip install -r requirements.txt` and `pip install -r requirements_dev.txt` in your local virtual environment
* Install `pip install -e ".[dev]"` in your local virtual environment
* Setup pre-commit: `pre-commit install -c .github/.pre-commit-config.yaml`

### License
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#
import os
import sys

import sphinx_rtd_theme

# sys.path.insert(0, os.path.abspath('.'))
Expand Down
38 changes: 34 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
[build-system]
requires = [
"setuptools>=60",
"wheel"
requires = ["setuptools>=77"]
build-backend = "setuptools.build_meta"

[project]
name = "routingfilter"
version = "2.5.0"
description = "Generic Business Logic Implementation for Routing objects as python dictionaries"
readme = "README.md"
requires-python = ">=3.12"
license = "LGPL-3.0-or-later"
license-files = ["LICENSE.txt"]
authors = [{ name = "Certego S.r.l.", email = "support@certego.net" }]
dependencies = ["macaddress~=2.0.2"]
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
]
build-backend = "setuptools.build_meta"

[project.optional-dependencies]
# The linter pins below must stay in sync with the hook revisions in .github/.pre-commit-config.yaml: nothing enforces it automatically.
dev = [
"black==26.5.1",
"flake8==7.3.0",
"isort==8.0.1",
"pre-commit==4.6.2",
"pytest",
]

[project.urls]
Homepage = "https://github.com/certego/RoutingFilter"

[tool.setuptools.packages.find]
include = ["routingfilter*"]
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements_dev.txt

This file was deleted.

Loading