Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: build native macos arm64 wheel #12029

Open
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

taegyunkim
Copy link
Contributor

@taegyunkim taegyunkim commented Jan 22, 2025

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Jan 22, 2025

CODEOWNERS have been resolved as:

.github/workflows/build_python_3.yml                                    @DataDog/python-guild @DataDog/apm-core-python
ddtrace/internal/datadog/profiling/cmake/AnalysisFunc.cmake             @DataDog/profiling-python
ddtrace/internal/datadog/profiling/crashtracker/CMakeLists.txt          @DataDog/profiling-python
ddtrace/internal/datadog/profiling/ddup/CMakeLists.txt                  @DataDog/profiling-python
ddtrace/internal/datadog/profiling/stack_v2/CMakeLists.txt              @DataDog/profiling-python
pyproject.toml                                                          @DataDog/python-guild

@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Jan 22, 2025

Datadog Report

Branch report: taegyunkim/prof-11189-mac-build
Commit report: ffbaaf4
Test service: dd-trace-py

✅ 0 Failed, 130 Passed, 1468 Skipped, 5m 14.57s Total duration (35m 44.84s time saved)

@pr-commenter
Copy link

pr-commenter bot commented Jan 22, 2025

Benchmarks

Benchmark execution time: 2025-01-24 19:05:02

Comparing candidate commit 73ef0fc in PR branch taegyunkim/prof-11189-mac-build with baseline commit b90fa38 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 384 metrics, 0 unstable metrics.

@taegyunkim taegyunkim changed the title ci: build for arm64 instead of universal2 for mac ci: build native arm64 wheel Jan 23, 2025
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Jan 23, 2025

Datadog Report

Branch report: taegyunkim/prof-11189-mac-build
Commit report: 73ef0fc
Test service: dd-trace-py

✅ 0 Failed, 130 Passed, 1468 Skipped, 4m 27.01s Total duration (36m 9.74s time saved)

@taegyunkim taegyunkim added Profiling Continous Profling changelog/no-changelog A changelog entry is not required for this PR. labels Jan 23, 2025
@taegyunkim taegyunkim changed the title ci: build native arm64 wheel ci: build native macos arm64 wheel Jan 23, 2025
@taegyunkim taegyunkim marked this pull request as ready for review January 23, 2025 16:35
@taegyunkim taegyunkim requested review from a team as code owners January 23, 2025 16:35
Copy link
Contributor

@nsrip-dd nsrip-dd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into an ImportError when trying this on my M1 macbook. I downloaded the python 3.13 macos arm64 wheel from the build artifacts (link) and installed it in a virtual environment, then ran a trivial program with ddtrace-run:

% python3 --version
Python 3.13.0
% pip install ddtrace-2.21.0.dev58+g664c6b2a9-cp313-cp313-macosx_12_0_arm64.whl
... stuff ...
% env DD_PROFILING_ENABLED=true ./venv/bin/ddtrace-run python3 test.py
failed to enable profiling
Traceback (most recent call last):
  File "/Users/nick.ripley/sandbox/python/ddtracepy-pr-12029/venv/lib/python3.13/site-packages/ddtrace/bootstrap/preload.py", line 66, in <module>
    import ddtrace.profiling.auto  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nick.ripley/sandbox/python/ddtracepy-pr-12029/venv/lib/python3.13/site-packages/ddtrace/internal/module.py", line 295, in _exec_module
    self.loader.exec_module(module)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/Users/nick.ripley/sandbox/python/ddtracepy-pr-12029/venv/lib/python3.13/site-packages/ddtrace/profiling/__init__.py", line 5, in <module>
    from .profiler import Profiler  # noqa:F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nick.ripley/sandbox/python/ddtracepy-pr-12029/venv/lib/python3.13/site-packages/ddtrace/internal/module.py", line 295, in _exec_module
    self.loader.exec_module(module)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/Users/nick.ripley/sandbox/python/ddtracepy-pr-12029/venv/lib/python3.13/site-packages/ddtrace/profiling/profiler.py", line 28, in <module>
    from ddtrace.profiling.collector import stack
  File "/Users/nick.ripley/sandbox/python/ddtracepy-pr-12029/venv/lib/python3.13/site-packages/ddtrace/internal/module.py", line 234, in _create_module
    return self.loader.create_module(spec)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
ImportError: dlopen(/Users/nick.ripley/sandbox/python/ddtracepy-pr-12029/venv/lib/python3.13/site-packages/ddtrace/profiling/collector/stack.cpython-313-darwin.so, 0x0002): symbol not found in flat namespace '__PyThread_CurrentExceptions'

Is that expected to work?

@taegyunkim
Copy link
Contributor Author

taegyunkim commented Jan 24, 2025

@nsrip-dd Profiling doesn't support 3.13 yet but it also failed on 3.12 on my m1 mac. I thought I checked this, but turns out not. Thank you for catching this. Found the missing link flag to properly build on mac and not explicitly include libpython as a dependency. Updated cmake and we run delocate-wheel as we used to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog A changelog entry is not required for this PR. Profiling Continous Profling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: module 'ddtrace.internal.datadog.profiling.ddup' has no attribute 'SampleHandle'
3 participants