Skip to content

Build a static TA-Lib C when none is installed; add opt-in TSAN build - #770

Open
Tapanhaz wants to merge 7 commits into
TA-Lib:masterfrom
Tapanhaz:build/static-talib-fallback
Open

Tapanhaz wants to merge 7 commits into
TA-Lib:masterfrom
Tapanhaz:build/static-talib-fallback

Conversation

@Tapanhaz

Copy link
Copy Markdown
Contributor

Changes

  1. Static TA-Lib C fallback (setup.py):
    • A system TA-Lib is used only if its reported version (TA_GetVersionString) is >= TALIB_C_VER.
    • Otherwise the release tarball is built with CMake as a static library and linked into talib._ta_lib.
  2. sdist ships .pyx only: cythonization now happens inside build_ext, and include talib/*.c is removed from MANIFEST.in.
  3. CI:
    • wheels, tests and test-dev no longer build TA-Lib C by hand.
    • Custom auditwheel/delocate repair commands are dropped.
    • test-dev.yml builds C dev through TALIB_C_URL.
  4. TSAN (opt-in):
    • TA_TSAN=1 builds the extension and a static TA-Lib C with ThreadSanitizer.
    • make test-tsan runs the threading tests.
    • tsan.yml runs the suite on free-threaded 3.14t and 3.15t using prebuilt TSAN images.

@mrjbq7

mrjbq7 commented Oct 14, 2026

Copy link
Copy Markdown
Member

What's the point of this PR?

@mrjbq7

mrjbq7 commented Oct 14, 2026

Copy link
Copy Markdown
Member

There's a bunch of issue with this, not least of which is I want to ship the C files so that cython is not required to install this module...

@Tapanhaz

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, I'll close this.

For the record, the point was: pip builds from source fails
unless TA-Lib C is already installed. This builds a pinned TA-Lib C statically
when no suitable system copy is available, so pip install works without a
manual TA-Lib C install.

On Cython: pip fetches it automatically through build-system.requires, so users
never install it by hand. I see the case you want to keep, installs without
Cython (--no-build-isolation, distro builds).

Happy to revisit a narrower version if there's interest.

@Tapanhaz Tapanhaz closed this Oct 14, 2026
@mrjbq7 mrjbq7 reopened this Oct 14, 2026
@mrjbq7

mrjbq7 commented Oct 14, 2026

Copy link
Copy Markdown
Member

Sorry, I'm not against your PR, I just didn't understand it.

so the main motivation is install from the source code should be able to build against TA-Lib static C library , like the wheels do?

@Tapanhaz

Copy link
Copy Markdown
Contributor Author

Yes. When installing from source, the build currently needs TA-Lib C installed first. With this
change it builds a pinned TA-Lib C as a static library and links it in when no
suitable system copy is found, so the result is self-contained, like the wheels.

Nothing changes if a suitable TA-Lib is already installed (version >= TALIB_C_VER)
or if TA_INCLUDE_PATH / TA_LIBRARY_PATH are set, so packagers aren't affected.

@mrjbq7

mrjbq7 commented Oct 16, 2026

Copy link
Copy Markdown
Member

I'm considering a version of this change. While I test it, are there platforms or architectures or versions of Python that we don't have support for that is motivating this change for you?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants