From be2c88ca81e53375a75f2ceba06b1ac636e9b1ff9f894c513e8933250b104cfa Mon Sep 17 00:00:00 2001 From: Nico Krapp Date: Fri, 6 Sep 2024 08:08:47 +0000 Subject: [PATCH] Initial Package OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-posthog?expand=0&rev=1 --- .gitattributes | 23 +++++ .gitignore | 1 + posthog-3.6.0.tar.gz | 3 + python-posthog-no-mock.patch | 36 ++++++++ python-posthog-no-six.patch | 158 +++++++++++++++++++++++++++++++++++ python-posthog.changes | 9 ++ python-posthog.spec | 82 ++++++++++++++++++ 7 files changed, 312 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 posthog-3.6.0.tar.gz create mode 100644 python-posthog-no-mock.patch create mode 100644 python-posthog-no-six.patch create mode 100644 python-posthog.changes create mode 100644 python-posthog.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/posthog-3.6.0.tar.gz b/posthog-3.6.0.tar.gz new file mode 100644 index 0000000..7b02a39 --- /dev/null +++ b/posthog-3.6.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27dbf537241a69fb5f6a3e9561caa2d555d5891d95fa65c27ffa6b52d1fb63b6 +size 46518 diff --git a/python-posthog-no-mock.patch b/python-posthog-no-mock.patch new file mode 100644 index 0000000..3e1135c --- /dev/null +++ b/python-posthog-no-mock.patch @@ -0,0 +1,36 @@ +diff -Nru posthog-3.6.0/posthog/test/test_client.py posthog-3.6.0-no-mock/posthog/test/test_client.py +--- posthog-3.6.0/posthog/test/test_client.py 2024-08-28 06:00:44.000000000 +0000 ++++ posthog-3.6.0-no-mock/posthog/test/test_client.py 2024-09-05 16:30:31.956000000 +0000 +@@ -3,7 +3,7 @@ + from datetime import datetime + from uuid import uuid4 + +-import mock ++from unittest import mock + import six + + from posthog.client import Client +diff -Nru posthog-3.6.0/posthog/test/test_consumer.py posthog-3.6.0-no-mock/posthog/test/test_consumer.py +--- posthog-3.6.0/posthog/test/test_consumer.py 2024-08-28 06:00:44.000000000 +0000 ++++ posthog-3.6.0-no-mock/posthog/test/test_consumer.py 2024-09-05 16:30:03.976000000 +0000 +@@ -2,7 +2,7 @@ + import time + import unittest + +-import mock ++from unittest import mock + + try: + from queue import Queue +diff -Nru posthog-3.6.0/posthog/test/test_feature_flags.py posthog-3.6.0-no-mock/posthog/test/test_feature_flags.py +--- posthog-3.6.0/posthog/test/test_feature_flags.py 2024-08-28 06:00:44.000000000 +0000 ++++ posthog-3.6.0-no-mock/posthog/test/test_feature_flags.py 2024-09-05 16:30:19.288000000 +0000 +@@ -1,7 +1,7 @@ + import datetime + import unittest + +-import mock ++from unittest import mock + from dateutil import parser, tz + from freezegun import freeze_time + diff --git a/python-posthog-no-six.patch b/python-posthog-no-six.patch new file mode 100644 index 0000000..16c3a25 --- /dev/null +++ b/python-posthog-no-six.patch @@ -0,0 +1,158 @@ +diff -Nru posthog-3.6.0-no-mock/posthog/client.py posthog-3.6.0-no-six/posthog/client.py +--- posthog-3.6.0-no-mock/posthog/client.py 2024-09-05 16:29:03.332000000 +0000 ++++ posthog-3.6.0-no-six/posthog/client.py 2024-09-05 16:42:49.764000000 +0000 +@@ -5,7 +5,6 @@ + from uuid import UUID + + from dateutil.tz import tzutc +-from six import string_types + + from posthog.consumer import Consumer + from posthog.exception_capture import ExceptionCapture +@@ -21,7 +20,7 @@ + import Queue as queue + + +-ID_TYPES = (numbers.Number, string_types, UUID) ++ID_TYPES = (numbers.Number, str, UUID) + MAX_DICT_SIZE = 50_000 + + +@@ -59,7 +58,7 @@ + # api_key: This should be the Team API Key (token), public + self.api_key = project_api_key or api_key + +- require("api_key", self.api_key, string_types) ++ require("api_key", self.api_key, str) + + self.on_error = on_error + self.debug = debug +@@ -192,7 +191,7 @@ + context = context or {} + require("distinct_id", distinct_id, ID_TYPES) + require("properties", properties, dict) +- require("event", event, string_types) ++ require("event", event, str) + + msg = { + "properties": properties, +@@ -326,7 +325,7 @@ + require("distinct_id", distinct_id, ID_TYPES) + require("properties", properties, dict) + +- require("url", url, string_types) ++ require("url", url, str) + properties["$current_url"] = url + + msg = { +@@ -567,7 +566,7 @@ + send_feature_flag_events=True, + disable_geoip=None, + ): +- require("key", key, string_types) ++ require("key", key, str) + require("distinct_id", distinct_id, ID_TYPES) + require("groups", groups, dict) + +@@ -814,6 +813,6 @@ + def stringify_id(val): + if val is None: + return None +- if isinstance(val, string_types): ++ if isinstance(val, str): + return val + return str(val) +diff -Nru posthog-3.6.0-no-mock/posthog/test/test_client.py posthog-3.6.0-no-six/posthog/test/test_client.py +--- posthog-3.6.0-no-mock/posthog/test/test_client.py 2024-09-05 16:30:31.956000000 +0000 ++++ posthog-3.6.0-no-six/posthog/test/test_client.py 2024-09-05 16:35:59.800000000 +0000 +@@ -4,7 +4,6 @@ + from uuid import uuid4 + + from unittest import mock +-import six + + from posthog.client import Client + from posthog.test.test_utils import FAKE_TEST_API_KEY +@@ -655,7 +654,7 @@ + self.assertFalse(success) + + def test_unicode(self): +- Client(six.u("unicode_key")) ++ Client("unicode_key") + + def test_numeric_distinct_id(self): + self.client.capture(1234, "python event") +diff -Nru posthog-3.6.0-no-mock/posthog/test/test_utils.py posthog-3.6.0-no-six/posthog/test/test_utils.py +--- posthog-3.6.0-no-mock/posthog/test/test_utils.py 2024-09-05 16:29:03.336000000 +0000 ++++ posthog-3.6.0-no-six/posthog/test/test_utils.py 2024-09-05 16:36:51.084000000 +0000 +@@ -3,7 +3,6 @@ + from decimal import Decimal + from uuid import UUID + +-import six + from dateutil.tz import tzutc + + from posthog import utils +@@ -28,7 +27,7 @@ + def test_clean(self): + simple = { + "decimal": Decimal("0.142857"), +- "unicode": six.u("woo"), ++ "unicode": "woo", + "date": datetime.now(), + "long": 200000000, + "integer": 1, +@@ -63,11 +62,7 @@ + self.assertEqual(dict_with_dates, utils.clean(dict_with_dates)) + + def test_bytes(self): +- if six.PY3: +- item = bytes(10) +- else: +- item = bytearray(10) +- ++ item = bytes(10) + utils.clean(item) + + def test_clean_fn(self): +diff -Nru posthog-3.6.0-no-mock/posthog/utils.py posthog-3.6.0-no-six/posthog/utils.py +--- posthog-3.6.0-no-mock/posthog/utils.py 2024-09-05 16:29:03.336000000 +0000 ++++ posthog-3.6.0-no-six/posthog/utils.py 2024-09-05 16:38:19.876000000 +0000 +@@ -6,7 +6,6 @@ + from decimal import Decimal + from uuid import UUID + +-import six + from dateutil.tz import tzlocal, tzutc + + log = logging.getLogger("posthog") +@@ -51,7 +50,7 @@ + return float(item) + if isinstance(item, UUID): + return str(item) +- elif isinstance(item, (six.string_types, bool, numbers.Number, datetime, date, type(None))): ++ elif isinstance(item, (str, bool, numbers.Number, datetime, date, type(None))): + return item + elif isinstance(item, (set, list, tuple)): + return _clean_list(item) +@@ -67,7 +66,7 @@ + + def _clean_dict(dict_): + data = {} +- for k, v in six.iteritems(dict_): ++ for k, v in dict_.items(): + try: + data[k] = clean(v) + except TypeError: +diff -Nru posthog-3.6.0-no-mock/setup.py posthog-3.6.0-no-six/setup.py +--- posthog-3.6.0-no-mock/setup.py 2024-09-05 16:29:03.336000000 +0000 ++++ posthog-3.6.0-no-six/setup.py 2024-09-05 16:38:48.628000000 +0000 +@@ -14,7 +14,7 @@ + PostHog is developer-friendly, self-hosted product analytics. posthog-python is the python package. + """ + +-install_requires = ["requests>=2.7,<3.0", "six>=1.5", "monotonic>=1.5", "backoff>=1.10.0", "python-dateutil>2.1"] ++install_requires = ["requests>=2.7,<3.0", "monotonic>=1.5", "backoff>=1.10.0", "python-dateutil>2.1"] + + extras_require = { + "dev": [ diff --git a/python-posthog.changes b/python-posthog.changes new file mode 100644 index 0000000..f4c164a --- /dev/null +++ b/python-posthog.changes @@ -0,0 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 5 17:07:16 UTC 2024 - Meera Belur + +- Remove dependency on python-six + +------------------------------------------------------------------- +Wed Sep 4 20:34:17 UTC 2024 - Meera Belur + +- Initial Package diff --git a/python-posthog.spec b/python-posthog.spec new file mode 100644 index 0000000..7e65494 --- /dev/null +++ b/python-posthog.spec @@ -0,0 +1,82 @@ +# +# spec file for package python-posthog +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-posthog +Version: 3.6.0 +Release: 0 +Summary: PostHog is developer-friendly, self-hosted product analytics +License: MIT +URL: https://github.com/posthog/posthog-python +Group: Development/Libraries/Python +Source: https://files.pythonhosted.org/packages/source/p/posthog/posthog-%{version}.tar.gz +Patch1: python-posthog-no-mock.patch +Patch2: python-posthog-no-six.patch +BuildRequires: python-rpm-macros +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +# SECTION test requirements +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module pytest-timeout} +BuildRequires: %{python_module freezegun} +BuildRequires: %{python_module backoff >= 1.10.0} +BuildRequires: %{python_module monotonic >= 1.5} +BuildRequires: %{python_module python-dateutil > 2.1} +BuildRequires: %{python_module requests >= 2.7} +# /SECTION +BuildRequires: fdupes +Requires: python-backoff >= 1.10.0 +Requires: python-monotonic >= 1.5 +Requires: python-python-dateutil > 2.1 +Requires: python-requests >= 2.7 +Suggests: python-black +Suggests: python-isort +Suggests: python-flake8 +Suggests: python-flake8-print +Suggests: python-pre-commit +Suggests: python-sentry-sdk +Suggests: python-django +BuildArch: noarch +%python_subpackages + +%description +PostHog is developer-friendly, self-hosted product analytics. Integrate PostHog into any python application + +%prep +%autosetup -p1 -n posthog-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +# these disabled tests require internet access/valid api key +donttest+=" or test_request or test_upload or test_load_feature_flags_wrong_key or test_excepthook" +%pytest --timeout=40 -k "not (testallexcept ${donttest})" -p no:warnings + +%files %{python_files} +%doc README.md +%license LICENSE +%{python_sitelib}/posthog +%{python_sitelib}/posthog-%{version}.dist-info + +%changelog