Skip to content

Commit 3171193

Browse files
authored
fix: makefile for posthog_analytics release (#248)
1 parent 1db6e45 commit 3171193

File tree

6 files changed

+61
-6
lines changed

6 files changed

+61
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.4.1 - 2025-06-07
2+
3+
- empty point release to fix the posthog_analytics release
4+
15
## 4.4.0 - 2025-06-09
26

37
- Use the new `/flags` endpoint for all feature flag evaluations (don't fall back to `/decide` at all)

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@ release_analytics:
1616
rm -rf posthoganalytics
1717
mkdir posthoganalytics
1818
cp -r posthog/* posthoganalytics/
19-
find ./posthoganalytics -type f -exec sed -i '' -e 's/from posthog /from posthoganalytics /g' {} \;
20-
find ./posthoganalytics -type f -exec sed -i '' -e 's/from posthog\./from posthoganalytics\./g' {} \;
19+
find ./posthoganalytics -type f -not -path "*/__pycache__/*" -exec sed -i '' -e 's/from posthog /from posthoganalytics /g' {} \;
20+
find ./posthoganalytics -type f -not -path "*/__pycache__/*" -exec sed -i '' -e 's/from posthog\./from posthoganalytics\./g' {} \;
2121
rm -rf posthog
2222
python setup_analytics.py sdist bdist_wheel
2323
twine upload dist/*
2424
mkdir posthog
25-
find ./posthoganalytics -type f -exec sed -i '' -e 's/from posthoganalytics /from posthog /g' {} \;
26-
find ./posthoganalytics -type f -exec sed -i '' -e 's/from posthoganalytics\./from posthog\./g' {} \;
25+
find ./posthoganalytics -type f -not -path "*/__pycache__/*" -exec sed -i '' -e 's/from posthoganalytics /from posthog /g' {} \;
26+
find ./posthoganalytics -type f -not -path "*/__pycache__/*" -exec sed -i '' -e 's/from posthoganalytics\./from posthog\./g' {} \;
2727
cp -r posthoganalytics/* posthog/
2828
rm -rf posthoganalytics
29+
rm -f pyproject.toml
30+
cp pyproject.toml.backup pyproject.toml
31+
rm -f pyproject.toml.backup
2932

3033
e2e_test:
3134
.buildscripts/e2e.sh

posthog/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "4.4.0"
1+
VERSION = "4.4.1"
22

33
if __name__ == "__main__":
44
print(VERSION, end="") # noqa: T201

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ dev = [
5151
"pre-commit",
5252
"pydantic",
5353
"ruff",
54+
"tomli",
55+
"tomli_w",
5456
]
5557
test = [
5658
"mock>=2.0.0",

setup_analytics.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
11
import os
22
import sys
3+
import tomli
4+
import tomli_w
5+
import shutil
36

47
try:
58
from setuptools import setup
69
except ImportError:
710
from distutils.core import setup
811

912
# Don't import analytics-python module here, since deps may not be installed
10-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "posthog"))
13+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "posthoganalytics"))
1114
from version import VERSION # noqa: E402
1215

16+
17+
# Copy the original pyproject.toml as backup
18+
shutil.copy("pyproject.toml", "pyproject.toml.backup")
19+
20+
# Read the original pyproject.toml
21+
with open("pyproject.toml", "rb") as f:
22+
config = tomli.load(f)
23+
24+
# Override specific values
25+
config["project"]["name"] = "posthoganalytics"
26+
config["tool"]["setuptools"]["dynamic"]["version"] = {
27+
"attr": "posthoganalytics.version.VERSION"
28+
}
29+
30+
# Rename packages from posthog.* to posthoganalytics.*
31+
if "packages" in config["tool"]["setuptools"]:
32+
new_packages = []
33+
for package in config["tool"]["setuptools"]["packages"]:
34+
if package == "posthog":
35+
new_packages.append("posthoganalytics")
36+
elif package.startswith("posthog."):
37+
new_packages.append(package.replace("posthog.", "posthoganalytics.", 1))
38+
else:
39+
new_packages.append(package)
40+
config["tool"]["setuptools"]["packages"] = new_packages
41+
42+
# Overwrite the original pyproject.toml
43+
with open("pyproject.toml", "wb") as f:
44+
tomli_w.dump(config, f)
45+
1346
long_description = """
1447
PostHog is developer-friendly, self-hosted product analytics.
1548
posthog-python is the python package.

uv.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)