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
35 changes: 15 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,30 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version:
- 3.11
- 3.12
- 3.13
- 3.14
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Install poetry
run: |
pipx install poetry
poetry config virtualenvs.path .virtualenvs

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: poetry.lock
enable-cache: true

- name: Set poetry environment
run: poetry env use ${{ matrix.python-version }}
- name: Install build dependencies
run: sudo apt-get install -y gfortran libopenblas-dev pkg-config

- name: Install dependencies
run: poetry install --no-root --no-interaction
run: uv sync --locked

- name: Lint
run: poetry run ruff check unsupervised_bias_detection
if: matrix.python-version == 3.11
run: uv run ruff check unsupervised_bias_detection/cluster

- name: Test
run: poetry run pytest
--color=yes
--full-trace
--showlocals
--verbose
run: uv run pytest
19 changes: 6 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Install poetry
run: |
pipx install poetry
# poetry config virtualenvs.path .virtualenvs

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Publish package to PyPI
- name: Build and publish
run: uv build && uv publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --build --username "__token__" --password $PYPI_TOKEN
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
453 changes: 0 additions & 453 deletions poetry.lock

This file was deleted.

143 changes: 124 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,134 @@
[tool.poetry]
[project]
name = "unsupervised-bias-detection"
version = "0.2.6"
description = "package for unsupervised bias detection"
authors = ["NGO Algorithm Audit (info@algorithmaudit.eu)"]
license = "EUPL-1.2 license"
version = "1.0.0"
description = "Unsupervised detection of bias in data."
readme = "README.md"
requires-python = ">=3.11"
license = "EUPL-1.2 license"
authors = [
{name = "NGO Algorithm Audit", email = "info@algorithmaudit.eu"}
]
dependencies = [
"kmodes>=0.12.2",
"numpy>=2.4.3",
"scikit-learn>=1.8.0",
]

[project.urls]
"Repository" = "https://github.com/NGO-Algorithm-Audit/unsupervised-bias-detection"

[dependency-groups]
dev = [
"fairlearn>=0.13.0",
"pandas>=3.0.1",
"pytest>=9.0.2",
"ruff>=0.15.5",
]

[tool.poetry.dependencies]
python = "^3.11"
numpy = "^1.26.4"
scikit-learn = ">=1.6.1"
kmodes = "^0.12.2"
[tool.pytest.ini_options]
testpaths = ["tests", "unsupervised_bias_detection/cluster"]
addopts = "--verbose --showlocals --full-trace --color=yes --doctest-modules"

[tool.poetry.group.dev.dependencies]
ruff = "^0.2.2"
pytest = "^8.0.2"
pandas = "^2.2.2"
fairlearn = "^0.10.0"
[tool.ruff]
# Set the maximum line length to 88 (Black's default)
line-length = 88

# Assume Python 3.12+
target-version = "py312"

# Exclude common directories
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"__pycache__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]

[tool.ruff.lint]
select = ["D"]
# Enable these rule categories
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"ARG", # flake8-unused-arguments
"SIM", # flake8-simplify
"NPY", # NumPy-specific rules
"PD", # pandas-vet
"RUF", # Ruff-specific rules
"D", # pydocstyle (docstring conventions)
]

# Disable specific rules if needed
ignore = [
"D202", # no blank lines allowed after docstring
"D203", # 1 blank line required before class docstring (conflicts with D211)
"D212", # multi-line docstring summary should start at first line (conflicts with D213)
]

# Allow autofix for all enabled rules (when `--fix` is provided)
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.ruff.lint.per-file-ignores]
# Ignore specific rules in specific files
"__init__.py" = ["F401"] # unused imports in __init__.py
"tests/**/*.py" = [
"S101", # use of assert detected
"ARG", # unused function arguments
"FBT", # boolean trap
]

[tool.ruff.lint.isort]
# Configure import sorting
known-first-party = ["unsupervised_bias_detection"]
force-sort-within-sections = true
split-on-trailing-comma = false

[tool.ruff.lint.mccabe]
# Set complexity threshold
max-complexity = 10

[tool.ruff.format]
# Use double quotes for strings
quote-style = "double"

# Indent with spaces
indent-style = "space"

# Respect magic trailing commas
skip-magic-trailing-comma = false

# Auto-format docstrings
docstring-code-format = true

# Line ending style
line-ending = "auto"
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests for the unsupervised_bias_detection package."""
79 changes: 0 additions & 79 deletions tests/test_bahc.py

This file was deleted.

Loading