Repository navigation
chore: build with uv, stop shipping tests in wheels, and clean up CI warnings - #1301
marandaneto wants to merge 8 commits into
Conversation
SDK performance: posthog-pythonBenchmarks completed. No changes flagged for review. Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate. View all results
Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals. Each shard uses its own runner; compare Before PR against With PR within a row, not across shards. Compared 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
dustinbyrne
left a comment
There was a problem hiding this comment.
The uv build migration, posthoganalytics mirror build/local-prep scripts (make build_release_analytics and make prep_local), wheel/sdist test exclusions (py.typed retained), warning filters, and the Django middleware asgiref-absent fallback implementation look solid.
Left one inline concern on the new TestCoroutineDetectionWithoutAsgiref test, where warnings.catch_warnings() exits before iscoroutinefunction(...) is invoked.
AI-assisted review.
💡 Motivation and Context
The latest CI and release logs passed, but they carried warnings worth fixing:
python setup.py sdist bdist_wheel. setuptools printssetup.py install is deprecated ... This deprecation is overdueon every release, so a future setuptools version could break publishing.setup.pyandsetup_analytics.pypassedlicense="MIT License"whilepyproject.tomlsetslicense = "MIT". Every build and install job printed`license` overwritten by `pyproject.toml`.pytest-asyncio, so pytest warned about the unknownasyncio_modeandasyncio_default_fixture_loop_scopeoptions.asyncio.iscoroutinefunction, which is deprecated and removed in 3.16. Some tests also triggered expected event loop policy andfork()warnings.The published
posthogandposthoganalyticswheels also shipped the whole SDK test suite asposthog.test(148 files, about 2.9 MB of a 5.2 MB unpacked wheel). This was not a deliberate choice. It goes back to the initial commit in 2020, which copied Segment'sanalytics-pythonsetup (packages=['analytics', 'analytics.test']). Later commits kept adding test packages to the list. Nothing outside the test suite imports these modules, including the PostHog app's use ofposthoganalytics.💚 How did you test it?
make build_releaseandmake build_release_analytics, then compared them with the v8.2.0 build frommain.posthog/test(orposthoganalytics/test). No other file was added or removed.setup.py. A build from a clean checkout includes no test files in the source archive or the wheel.Author,Author-email,Maintainer,Maintainer-emailandProject-URLvalues as 8.2.1.pyproject.tomlnow sets theAuthorandMaintainernames that used to come fromsetup.py.Home-page. It duplicatedProject-URL: Homepage, which has the same URL and is the field newer packaging standards use.twine checkpasses. The working tree is clean afterbuild_release_analytics.posthogwith warnings turned into errors.posthoginside it.make prep_localagainst a scratch copy of the repo and installed the resultingposthoganalyticspackage.posthog/testsuite on Python 3.13 with 0 warnings, down from 249. Three fork tests intest_metrics_autocapture.pyfail on macOS, and they fail the same way onmain.asgirefimport and check that async functions and callables marked by olderasgirefare both detected as async without deprecation warnings. They pass on Python 3.10, 3.13 and 3.14. The marked-callable test fails against an intermediate version of the fallback that only usedinspect.iscoroutinefunction.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileChanges
Makefilebuilds both packages withuv build --out-dir dist.setup.pyis removed.pyproject.tomllists name-only author and maintainer entries, so the published metadata keeps theAuthor: PosthogandMaintainer: PostHogfields thatsetup.pyused to set.setup_analytics.pyonly rewritespyproject.tomlfor theposthoganalyticsmirror. It no longer callssetup().make prep_localuses the same script instead of sed edits tosetup.py.pyproject.tomldrops theposthog.test*packages and excludestest/**from package data. Without the exclusion, setuptools still copies the test files into the wheel as data files of theposthogpackage.setup_analytics.pyapplies the same exclusion toposthoganalytics.setup.py.pytest-asyncio.test_client.pyandtest_feature_flags.py. Warning emission is still asserted intest_evaluate_flags.py.secret_keyinstead of the deprecatedpersonal_api_key.fork()filter those specific warnings.asynciodeprecation and another flag getter deprecation, from the filtered tests.asgirefis not installed, now usesinspect.iscoroutinefunction. It also accepts callables marked with the_is_coroutineattribute that olderasgirefversions set. This keeps the old detection on every Python version without calling the deprecated function.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
inspect.iscoroutinefunctionfallback would stop detecting callables marked by olderasgirefversions. The fallback now checks that marker explicitly, and a regression test covers it. The final autoreview reported no findings.gh api --paginate --slurp --jq, whichghrejects, so its merge queue check never works. That is left for a separate PR.