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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.lock linguist-generated -diff
33 changes: 33 additions & 0 deletions .github/workflows/push_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to PyPI.org

on:
pull_request:
branches: [main]
release:
types: [published]
push:
tags:
- v*

jobs:
pypi:
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@v6

- uses: astral-sh/setup-uv@v7
with:
python-version: 3.13

- name: Build Packages
run: |
uv build --wheel

- name: Sanity Check
run: |
uv run --isolated --no-project --with dist/diffprivlib* python -c 'import diffprivlib_logger'

- name: Publish Packages
if: github.event_name == 'release' || github.ref_type == 'tag'
run: |
uv publish --check-url https://pypi.org/simple --token ${{ secrets.PYPI_TOKEN }}
42 changes: 14 additions & 28 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
name: Smoke Test

on:
push:
branches:
- main
pull_request:
branches: [main]
push:
branches: [main]


jobs:
python-test:
runs-on: ubuntu-22.04
runs-on: ubuntu-slim

strategy:
matrix:
python-version: [3.11]
python-version: [ 3.11, 3.12, 3.13, 3.14 ]

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Cache pip dependencies
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('python/setup.cfg') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest

- name: Install package
run: python -m pip install -e .
- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Test
run: cd tests && pytest -v
- name: Run tests
run: uv run pytest -v tests
48 changes: 45 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
[tool.black]
line-length = 79
include = '\.pyi?$'
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "diffprivlib-logger"
version = "0.0.4"
description="A logger wrapper for DiffPrivLib"
readme = "README.md"
requires-python = ">=3.10, <4"
authors = [
{ name = "Data Science Competence Center", email = "[email protected]" },
{ name = "Swiss Federal Statistical Office" },
]
license = "MIT"
keywords = [
"diffprivlib",
"logger",
"serialiser",
"deserialiser",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = [
"scikit-learn>=0.24",
"numpy >= 2.0.0",
"scikit-learn >= 1.4.0",
"scipy >= 1.13.0",
"joblib >= 0.16.0",
"setuptools >= 49.0.0",
]

[project.urls]
Homepage = "https://github.com/dscc-admin/lomas/"

[project.optional-dependencies]
test = [
"pytest>=8.3",
]
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

32 changes: 0 additions & 32 deletions setup.py

This file was deleted.

32 changes: 32 additions & 0 deletions src/diffprivlib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# MIT License
#
# Copyright (C) IBM Corporation 2019
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
Differential Privacy Library for Python
=======================================

The IBM Differential Privacy Library is a library for writing, executing and experimenting with differential privacy.
The Library includes a basic differential privacy mechanisms, the building blocks of differential privacy; tools for
basic data analysis with differential privacy; and machine learning models that satisfy differential privacy.

"""
from diffprivlib import mechanisms
from diffprivlib import models
from diffprivlib import tools
from diffprivlib.accountant import BudgetAccountant

__version__ = '0.6.7'
Loading