Skip to content

Commit a8487c3

Browse files
committed
Deprecate EOL python versions and migrate to pyproject.toml
1 parent b53d315 commit a8487c3

File tree

13 files changed

+167
-158
lines changed

13 files changed

+167
-158
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ on: [push]
44

55
jobs:
66
test:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-24.04
88
strategy:
99
matrix:
10-
python-version: ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy2', 'pypy3']
10+
python-version: ['3.9', '3.10', '3.11', '3.12', 'pypy3']
1111

1212
steps:
1313
- uses: actions/checkout@v2
@@ -18,8 +18,7 @@ jobs:
1818
- name: Install dependencies
1919
run: |
2020
python -m pip install --upgrade pip
21-
pip install -e .
22-
pip install -r requirements-testing.txt
21+
pip install -e .[test]
2322
- name: Test with pytest
2423
run: |
2524
pytest test_mixpanel.py

BUILD.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ Release process::
88
6. Rebuild docs and publish to GitHub Pages (if appropriate -- see below)
99
7. Publish to PyPI. (see below)
1010

11+
Install test and developer environment modules::
12+
pip install -e .[test,dev]
13+
1114
Run tests::
1215

13-
tox
16+
python -m tox - runs all tests against all configured environments in the pyproject.toml
1417

1518
Publish to PyPI::
1619

17-
pip install twine wheel
18-
python setup.py sdist bdist_wheel
19-
twine upload dist/*
20+
python -m build
21+
python -m twine upload dist/*
2022

2123
Build docs::
2224

23-
pip install sphinx
24-
python setup.py build_sphinx
25+
python -m sphinx -b html docs docs/_build/html
2526

2627
Publish docs to GitHub Pages::
2728

28-
pip install ghp-import
29-
ghp-import -n -p build/sphinx/html
29+
python -m ghp_import -n -p docs/_build/html

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v5.0.0
2+
* Set minimum supported python version to 3.9, deprecating support for end-of-life versions of python
3+
* Convert setup.py to pyproject.toml
4+
15
v4.9.0
26
* To reduce TLS cert friction, use requests rather than directly using urllib3.
37
Reinstate TLS cert validation by default. (#103)

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2013-2021 Mixpanel, Inc.
1+
Copyright 2013-2025 Mixpanel, Inc.
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

TODO.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
- [x] Upgrade requirements-testing package to support 3.9+
2+
- [x] Verify that tests work against python 3.9
3+
4+
- [] Consider upgrading README.rst files to .md
5+
6+
- [] Swap tox with UV?
7+
- [] Convert github CI workflows to support latest python
8+
9+
- [x] License needs an update?
10+
- [] Update changelist file - In progress
11+
- [] Update README file -
12+
- [] Update Build file
13+
14+
- [] Add support for latest python versions?

demo/subprocess_consumer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ def do_tracking(project_token, distinct_id, queue):
3838
'''
3939
consumer = QueueWriteConsumer(queue)
4040
mp = Mixpanel(project_token, consumer)
41-
for i in xrange(100):
41+
for i in range(100):
4242
event = 'Tick'
4343
mp.track(distinct_id, event, {'Tick Number': i})
44-
print 'tick {0}'.format(i)
44+
print(f'tick {i}')
4545

4646
queue.put(None) # tell worker we're out of jobs
4747

@@ -64,7 +64,7 @@ def do_sending(queue):
6464
if __name__ == '__main__':
6565
# replace token with your real project token
6666
token = '0ba349286c780fe53d8b4617d90e2d01'
67-
distinct_id = ''.join(random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for x in xrange(32))
67+
distinct_id = ''.join(random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for x in range(32))
6868

6969
queue = multiprocessing.Queue()
7070
sender = multiprocessing.Process(target=do_sending, args=(queue,))

mixpanel/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
Analytics updates. :class:`~.Consumer` and :class:`~.BufferedConsumer` allow
1515
callers to customize the IO characteristics of their tracking.
1616
"""
17-
from __future__ import absolute_import, unicode_literals
1817
import datetime
1918
import json
2019
import logging
@@ -23,11 +22,9 @@
2322

2423
import requests
2524
from requests.auth import HTTPBasicAuth
26-
import six
27-
from six.moves import range
2825
import urllib3
2926

30-
__version__ = '4.10.1'
27+
__version__ = '4.11.0'
3128
VERSION = __version__ # TODO: remove when bumping major version.
3229

3330
logger = logging.getLogger(__name__)
@@ -620,7 +617,7 @@ def _write_request(self, request_url, json_message, api_key=None, api_secret=Non
620617
verify=self._verify_cert,
621618
)
622619
except Exception as e:
623-
six.raise_from(MixpanelException(e), e)
620+
raise MixpanelException(e) from e
624621

625622
try:
626623
response_dict = response.json()
@@ -733,6 +730,6 @@ def _flush_endpoint(self, endpoint):
733730
mp_e = MixpanelException(orig_e)
734731
mp_e.message = batch_json
735732
mp_e.endpoint = endpoint
736-
six.raise_from(mp_e, orig_e)
733+
raise mp_e from orig_e
737734
buf = buf[self._max_size:]
738735
self._buffers[endpoint] = buf

pyproject.toml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "mixpanel"
7+
dynamic = ["version"]
8+
description = "Official Mixpanel library for Python"
9+
readme = "README.rst"
10+
license = "Apache-2.0"
11+
authors = [
12+
{name = "Mixpanel, Inc.", email = "[email protected]"},
13+
]
14+
requires-python = ">=3.9"
15+
dependencies = [
16+
"requests>=2.32.5",
17+
]
18+
keywords = ["mixpanel", "analytics"]
19+
classifiers = [
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.9",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
]
27+
28+
[project.urls]
29+
Homepage = "https://github.com/mixpanel/mixpanel-python"
30+
31+
[project.optional-dependencies]
32+
test = [
33+
"pytest>=8.4.1",
34+
"responses>=0.25.8",
35+
]
36+
dev = [
37+
"tox>=4.28.4",
38+
"build",
39+
"twine",
40+
"sphinx",
41+
"ghp-import",
42+
]
43+
44+
[tool.setuptools.dynamic]
45+
version = {attr = "mixpanel.__version__"}
46+
47+
[tool.setuptools.packages.find]
48+
exclude = ["tests*"]
49+
50+
[tool.tox]
51+
envlist = ["py39", "py310", "py311", "py312"]
52+
53+
[tool.tox.env_run_base]
54+
extras = ["test"]
55+
commands = [
56+
["pytest", "{posargs}"],
57+
]

requirements-testing.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)