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: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
- run: pipx install poetry==2.0.1
- run: pipx install poetry==2.4.1
- run: poetry sync
- run: poetry run pre-commit run --all-files

Expand All @@ -24,21 +24,21 @@ jobs:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- run: pipx install poetry==2.0.1
- run: pipx install poetry==2.4.1
- run: poetry sync
- run: poetry run pytest --cov=altissimo --cov-report=term-missing --cov-fail-under=80

build:
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
- run: pipx install poetry==2.0.1
- run: pipx install poetry==2.4.1
- run: poetry build
72 changes: 72 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build and publish to PyPI

on:
push:
tags:
- "v*"
# Run by hand to publish the current branch to TestPyPI, to check the package
# before a release
workflow_dispatch:

jobs:
build:
name: Test and build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
- run: pipx install poetry==2.4.1
- run: poetry sync --with dev --all-extras
- run: poetry run pytest -q
- name: Check the tag matches the package version
if: startsWith(github.ref, 'refs/tags/')
run: |
version="$(poetry version -s)"
if [ "${GITHUB_REF_NAME}" != "v${version}" ]; then
echo "Tag ${GITHUB_REF_NAME} does not match package version ${version}" >&2
exit 1
fi
- run: poetry build
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: package-dist
path: dist

publish:
name: Publish to PyPI
needs: build
# Only publish tags from this repo. Forks can't publish.
if: github.repository == 'altissimo-hq/mixpanel-python' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: pypi
permissions:
# Mandatory for PyPI Trusted Publishing
id-token: write
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: package-dist
path: dist
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

publish-test:
name: Publish to TestPyPI
needs: build
if: github.repository == 'altissimo-hq/mixpanel-python' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
environment: testpypi
permissions:
# Mandatory for PyPI Trusted Publishing
id-token: write
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: package-dist
path: dist
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: https://test.pypi.org/legacy/
# A version can only be uploaded once, so reruns skip it
skip-existing: true
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ 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.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - Unreleased
## [0.1.0] - 2026-10-26

First release, published to PyPI as `altissimo-mixpanel`. The import name is
`altissimo.mixpanel`. Licensed under Apache-2.0.

### Added

Expand All @@ -28,4 +31,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `MixpanelError` and `MixpanelImportError` exception hierarchy
- Lazy SDK import — zero import-time side effects
- PEP 561 `py.typed` marker
- CI pipeline with lint, test (Python 3.11–3.13), and build stages
- CI pipeline with lint, test (Python 3.11–3.13), and build stages, using Poetry 2.4.1 with actions pinned by
commit
- A publish workflow: tagged releases (`v*`) are tested, checked against the package version, built, and uploaded
to PyPI through Trusted Publishing (environment `pypi`). Running it by hand uploads the current branch to
TestPyPI (environment `testpypi`).
- Renovate configuration, using the shared `altissimo-hq/renovate-config` preset
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ Reusable, typed Mixpanel analytics client for Altissimo projects.

- **Typed API** — full type annotations for all operations
- **Lazy SDK import** — `mixpanel` is imported only when needed, zero import-time side effects
- **Disabled mode** — silently no-op all calls when analytics isn't configured
- **Disabled mode** — no-op all calls when analytics is turned off or isn't configured
- **Error handling** — swallow-and-log by default, configurable via `on_error`
- **Protocol for DI** — `MixpanelClientProtocol` for dependency injection
- **Test helpers** — `FakeMixpanelClient` records all calls in-memory
- **Optional dependency** — works without `mixpanel` installed (fails gracefully)

## Installation

Published on PyPI as [`altissimo-mixpanel`](https://pypi.org/project/altissimo-mixpanel/);
the import name is `altissimo.mixpanel`.

```bash
# With the Mixpanel SDK (recommended)
pip install altissimo-mixpanel[mixpanel]
pip install "altissimo-mixpanel[mixpanel]"

# Without the SDK (for type checking / protocol-only usage)
pip install altissimo-mixpanel
Expand Down Expand Up @@ -217,4 +220,4 @@ poetry run ruff format .

## License

[GPL-3.0-or-later](LICENSE)
[Apache-2.0](LICENSE)
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "altissimo-mixpanel"
version = "0.1.0"
description = "Reusable Mixpanel analytics client for Altissimo projects"
readme = "README.md"
license = "GPL-3.0-or-later"
license = "Apache-2.0"
requires-python = ">=3.11"
authors = [
{ name = "Altissimo HQ" },
Expand All @@ -12,7 +12,6 @@ keywords = ["mixpanel", "analytics", "altissimo"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -32,11 +31,10 @@ Issues = "https://github.com/altissimo-hq/mixpanel-python/issues"
Changelog = "https://github.com/altissimo-hq/mixpanel-python/blob/main/CHANGELOG.md"

[build-system]
requires = ["poetry-core>=2.0"]
requires = ["poetry-core>=2.2.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "altissimo-mixpanel"
packages = [
{ include = "altissimo", from = "src" },
]
Expand Down
4 changes: 4 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>altissimo-hq/renovate-config"]
}
Loading