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
18 changes: 12 additions & 6 deletions .github/workflows/confidence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
include:
- python-version: '3.9'
tox-env: py39-min
- python-version: '3.10'
tox-env: py310
- python-version: '3.11'
tox-env: py311
- python-version: '3.12'
tox-env: py312

steps:
- uses: actions/checkout@v4
Expand All @@ -26,9 +34,7 @@ jobs:
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Install dependencies
run: |
uv pip install --system -e ".[dev]"
uv pip install --system tox tox-gh-actions
- name: Install tox
run: uv pip install --system tox tox-uv
- name: Test with tox
run: tox
run: tox -e ${{ matrix.tox-env }}
10 changes: 5 additions & 5 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install build tools
run: uv pip install --system build
- name: Build package
run: python -m build
run: uv build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
27 changes: 5 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,6 @@ coverage.xml
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

Expand All @@ -72,26 +61,20 @@ target/
# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

.DS_store

.idea/

# uv
uv.lock
.venv/
.venv/

.mypy_cache/
.pytest_cache/
.ruff_cache/
20 changes: 7 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Spotify Confidence is a Python library for A/B test analysis. It provides conven
### Setup
```bash
# Install with development dependencies (including tox-uv)
uv pip install -e ".[dev]"
uv pip install -e . --group dev
```

### Testing
Expand All @@ -34,17 +34,14 @@ uv run tox

### Code Quality
```bash
# Format code with black (line length: 119)
uv run black spotify_confidence tests
# Run linting
uv run ruff check

# Check formatting without making changes
uv run black --check --diff spotify_confidence tests

# Lint with flake8 (max line length: 120)
uv run flake8 spotify_confidence tests
# Run formatting
uv run ruff format

# Run all quality checks (as done in CI)
uv run black --check --diff spotify_confidence tests && uv run flake8 spotify_confidence tests && uv run pytest
uv run ruff check && uv run ruff format && uv run pytest
```

### Build
Expand Down Expand Up @@ -151,7 +148,4 @@ The project uses `tox-uv` to leverage uv's fast package installation and environ

## Code Style

- Black formatting with 119 character line length
- Flake8 linting with max line length 120
- Ignored flake8 rules: E203, E231, W503
- Excluded from linting: `.venv`, `.tox`, `dist`, `build`, `scratch.py`, `confidence_dev`
Uses ruff linting and formatting.
8 changes: 4 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Ready to contribute? Here's how to set up `confidence` for local development.
3. Set up your development environment using uv::

$ uv venv
$ uv pip install -e ".[dev]"
$ uv pip install -e . --group dev

This creates a virtual environment and installs the package in editable mode with all development dependencies.

Expand All @@ -89,9 +89,9 @@ Ready to contribute? Here's how to set up `confidence` for local development.

6. When you're done making changes, check that your changes pass all quality checks::

$ uv run black spotify_confidence tests --line-length 119 # Format code
$ uv run flake8 spotify_confidence tests # Lint code
$ uv run pytest # Run tests
$ uv run ruff format # Format code
$ uv run ruff check # Lint code
$ uv run pytest # Run tests

To test across all supported Python versions (3.9, 3.10, 3.11, 3.12)::

Expand Down
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
History
=======

in development
--------------
* Modernize infrastructure (pyproject.toml, uv, ruff, update dependencies)

4.0.0 (2024-11-24)
------------------
* Update mininum requirement for Chartify to avoid cropping bug in `chrome-webdriver`
Expand Down
96 changes: 0 additions & 96 deletions Makefile

This file was deleted.

12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ dependencies = [
"ipywidgets>=8.0.0",
]

[project.optional-dependencies]
[dependency-groups]
dev = [
"build",
"twine",
"black>=23.7.0",
"flake8>=6.0.0",
"ruff>=0.14.11",
"tox>=4.0.0",
"tox-uv>=1.0.0",
"pytest>=7.0.0",
Expand All @@ -47,9 +46,12 @@ where = ["."]
include = ["spotify_confidence*"]
namespaces = false

[tool.black]
[tool.ruff]
line-length = 119
target-version = ["py39", "py310", "py311", "py312"]
extend-exclude = ["examples/"]

[tool.ruff.format]
quote-style = "double"

[tool.pytest.ini_options]
addopts = "-v -n auto --cov=spotify_confidence --cov-report=html --cov-report=xml --cov-report=term-missing"
Expand Down
9 changes: 5 additions & 4 deletions spotify_confidence/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
# limitations under the License.

from importlib.metadata import version as _version
from .analysis.bayesian.bayesian_models import BetaBinomial

from spotify_confidence.analysis.frequentist.chi_squared import ChiSquared
from spotify_confidence.analysis.frequentist.experiment import Experiment
from spotify_confidence.analysis.frequentist.sample_size_calculator import SampleSizeCalculator
from spotify_confidence.analysis.frequentist.t_test import StudentsTTest
from spotify_confidence.analysis.frequentist.z_test import ZTest
from spotify_confidence.analysis.frequentist.z_test_linreg import ZTestLinreg
from spotify_confidence.analysis.frequentist.experiment import Experiment
from spotify_confidence.analysis.frequentist.sample_size_calculator import SampleSizeCalculator
from .samplesize.sample_size_calculator import SampleSize

from . import examples
from .analysis.bayesian.bayesian_models import BetaBinomial
from .options import options
from .samplesize.sample_size_calculator import SampleSize

__version__ = _version("spotify_confidence")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
# limitations under the License.

from abc import ABC, abstractmethod
from typing import Union, Iterable, Tuple, List
from typing import Iterable, List, Tuple, Union

from pandas import DataFrame

from spotify_confidence.chartgrid import ChartGrid

from ..constants import NIM_TYPE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we probably shouldn't use . and .. in imports. As long as we have the right init files it should be possible to from spotify_confidence.analysis import constants.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this one was also only reordered, we can change that in a follow-up PR

from .confidence_computer_abc import ConfidenceComputerABC
from .confidence_grapher_abc import ConfidenceGrapherABC
from ..constants import NIM_TYPE


class ConfidenceABC(ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from abc import ABC, abstractmethod
from typing import Union, Iterable, List, Tuple
from typing import Iterable, List, Tuple, Union

from pandas import DataFrame

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# limitations under the License.

from abc import ABC, abstractmethod
from typing import Union, Iterable
from typing import Iterable, Union

from pandas import DataFrame

from spotify_confidence.chartgrid import ChartGrid

from ..constants import NIM_TYPE


Expand Down
Loading