Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ jobs:
pip install flake8

- name: Build cython modules in-place
env:
TA_INCLUDE_PATH: /usr/include
TA_LIBRARY_PATH: /usr/lib
run: |
python setup.py build_ext --inplace
ldd talib/_ta_lib*.so | grep -E 'libta-lib\.so[^ ]* => /'

- name: Lint with flake8
run: |
Expand Down
51 changes: 4 additions & 47 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ jobs:
- name: Build wheels
uses: pypa/cibuildwheel@v4.2.1
env:
CIBW_BEFORE_ALL: |
bash ./tools/build_talib_linux.sh
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
CIBW_ENVIRONMENT_PASS_LINUX: TALIB_C_VER CFLAGS
CIBW_ENVIRONMENT_PASS_LINUX: CFLAGS
CFLAGS: -D_GNU_SOURCE
CIBW_TEST_SKIP: "cp*-musllinux*"
CIBW_TEST_COMMAND: >
Expand All @@ -39,12 +37,7 @@ jobs:
CIBW_ARCHS_LINUX: x86_64
CIBW_BUILD_FRONTEND: build
CIBW_ENVIRONMENT_LINUX : >
TA_LIBRARY_PATH="ta-lib-install/lib"
TA_INCLUDE_PATH="ta-lib-install/include"
PIP_NO_BUILD_ISOLATION=false
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
export LD_LIBRARY_PATH="/project/ta-lib-install/lib:$LD_LIBRARY_PATH"
auditwheel repair -w {dest_dir} {wheel}
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
Expand All @@ -62,11 +55,9 @@ jobs:
- name: Build wheels
uses: pypa/cibuildwheel@v4.2.1
env:
CIBW_BEFORE_ALL: |
bash ./tools/build_talib_linux.sh
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2
CIBW_ENVIRONMENT_PASS_LINUX: TALIB_C_VER CFLAGS
CIBW_ENVIRONMENT_PASS_LINUX: CFLAGS
CFLAGS: -D_GNU_SOURCE
CIBW_TEST_SKIP: "cp*-musllinux*"
CIBW_TEST_COMMAND: >
Expand All @@ -75,12 +66,7 @@ jobs:
CIBW_ARCHS_LINUX: aarch64
CIBW_BUILD_FRONTEND: build
CIBW_ENVIRONMENT_LINUX : >
TA_LIBRARY_PATH="ta-lib-install/lib"
TA_INCLUDE_PATH="ta-lib-install/include"
PIP_NO_BUILD_ISOLATION=false
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
export LD_LIBRARY_PATH="/project/ta-lib-install/lib:$LD_LIBRARY_PATH"
auditwheel repair -w {dest_dir} {wheel}
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
Expand All @@ -99,9 +85,6 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Build TA-Lib C Library
run: tools/build_talib_windows.cmd
shell: cmd
- name: Build wheels
uses: pypa/cibuildwheel@v4.2.1
env:
Expand All @@ -112,8 +95,6 @@ jobs:
MSBUILDTREATHIGHERTOOLSVERSIONASCURRENT: 1
CIBW_ARCHS_WINDOWS: AMD64
CIBW_ENVIRONMENT_WINDOWS: >
TA_LIBRARY_PATH="ta-lib-$TALIB_C_VER\\_build;$LIB"
TA_INCLUDE_PATH="ta-lib-$TALIB_C_VER\\include;$INCLUDE"
PIP_NO_BUILD_ISOLATION=false
- name: Upload wheel
uses: actions/upload-artifact@v7
Expand All @@ -133,9 +114,6 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
- name: Build TA-Lib C library
run: tools/build_talib_windows.cmd
shell: cmd
- name: Build wheels
uses: pypa/cibuildwheel@v4.2.1
env:
Expand All @@ -146,8 +124,6 @@ jobs:
MSBUILDTREATHIGHERTOOLSVERSIONASCURRENT: 1
CIBW_ARCHS_WINDOWS: x86
CIBW_ENVIRONMENT_WINDOWS: >
TA_LIBRARY_PATH="ta-lib-$TALIB_C_VER\\_build;$LIB"
TA_INCLUDE_PATH="ta-lib-$TALIB_C_VER\\include;$INCLUDE"
PIP_NO_BUILD_ISOLATION=false
- name: Upload wheel
uses: actions/upload-artifact@v7
Expand All @@ -167,9 +143,6 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
with:
arch: arm64
- name: Build TA-Lib C Library
run: tools/build_talib_windows.cmd
shell: cmd
- name: Build wheels
uses: pypa/cibuildwheel@v4.2.1
env:
Expand All @@ -180,8 +153,6 @@ jobs:
MSBUILDTREATHIGHERTOOLSVERSIONASCURRENT: 1
CIBW_ARCHS_WINDOWS: ARM64
CIBW_ENVIRONMENT_WINDOWS: >
TA_LIBRARY_PATH="ta-lib-$TALIB_C_VER\\_build;$LIB"
TA_INCLUDE_PATH="ta-lib-$TALIB_C_VER\\include;$INCLUDE"
PIP_NO_BUILD_ISOLATION=false
- name: Upload wheel
uses: actions/upload-artifact@v7
Expand All @@ -200,20 +171,13 @@ jobs:
- name: Build wheels
uses: pypa/cibuildwheel@v4.2.1
env:
CIBW_BEFORE_ALL: |
bash ./tools/build_talib_macos.sh
CIBW_TEST_COMMAND: >
cd .. &&
pytest -k "not RSI and not threading" {project}/tests
CIBW_ARCHS_MACOS: x86_64
CIBW_ENVIRONMENT_MACOS : >
TA_LIBRARY_PATH="ta-lib-install/lib"
TA_INCLUDE_PATH="ta-lib-install/include"
MACOSX_DEPLOYMENT_TARGET=13.7
PIP_NO_BUILD_ISOLATION=false
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
export MACOSX_DEPLOYMENT_TARGET=13.7
export DYLD_LIBRARY_PATH="/Users/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/ta-lib-install/lib:$DYLD_LIBRARY_PATH"
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
Expand All @@ -231,20 +195,13 @@ jobs:
- name: Build wheels
uses: pypa/cibuildwheel@v4.2.1
env:
CIBW_BEFORE_ALL: |
bash ./tools/build_talib_macos.sh
CIBW_TEST_COMMAND: >
cd .. &&
pytest -k "not RSI and not threading" {project}/tests
CIBW_ARCHS_MACOS: arm64
CIBW_ENVIRONMENT_MACOS : >
TA_LIBRARY_PATH="ta-lib-install/lib"
TA_INCLUDE_PATH="ta-lib-install/include"
MACOSX_DEPLOYMENT_TARGET=14.0
PIP_NO_BUILD_ISOLATION=false
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
export MACOSX_DEPLOYMENT_TARGET=14.0
export DYLD_LIBRARY_PATH="/Users/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/ta-lib-install/lib:$DYLD_LIBRARY_PATH"
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
0.8.3
=====

- [NEW]: Source builds download and verify TA-Lib C 0.8.1, build it as a
static library and link it into the extension. A compiler, CMake and network
access are required; a separate TA-Lib C installation is no longer needed.
Generated C files remain included in source distributions.

- [CHANGE]: Setting ``TA_INCLUDE_PATH`` or ``TA_LIBRARY_PATH`` uses an existing
TA-Lib C installation instead, without downloading or building the C library.
If only one is set, the other uses the standard search paths.

- [CHANGE]: Wheels statically link TA-Lib C through the same build process.

0.8.2
=====

Expand Down
54 changes: 28 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,24 @@ conda install -c conda-forge ta-lib

### Dependencies 🧩

To use TA-Lib for python, you need to have the [TA-Lib](http://ta-lib.org)
already installed. You should probably follow their [installation
directions](https://ta-lib.org/install/) for your platform, but some
suggestions are included below for reference.
Binary wheels include the [TA-Lib](http://ta-lib.org) C library and do not
require a compiler or a separate TA-Lib C installation.

Starting with version 0.8.3, source builds download the pinned TA-Lib C 0.8.1
release, verify its checksum, and build and statically link it into the Python
extension. This requires network access, a C compiler and CMake. On Windows,
source builds require the Microsoft C++ Build Tools. CMake is installed
automatically when using pip's default build isolation.

To use an existing TA-Lib C installation instead, set ``TA_INCLUDE_PATH`` or
``TA_LIBRARY_PATH`` before building. Setting either variable disables the
bundled C build, including its download; if only one is set, the other uses
the standard search paths. These variables accept multiple directories
separated by ``os.pathsep`` (``:`` on Unix, ``;`` on Windows). They apply to
source builds, not prebuilt wheels.

The following instructions are for installing your own TA-Lib C library.
You can also follow its [installation directions](https://ta-lib.org/install/).

> Some Conda Forge users have reported success installing the underlying TA-Lib C
> library using [the libta-lib package](https://anaconda.org/conda-forge/libta-lib):
Expand All @@ -91,7 +105,7 @@ for your architecture:
arch -arm64 brew install ta-lib
```

And perhaps you can set these before installing with `pip`:
To link a source build against the Homebrew installation, set:

```shell
export TA_INCLUDE_PATH="$(brew --prefix ta-lib)/include"
Expand Down Expand Up @@ -143,7 +157,8 @@ fail with ``No such file or directory`` errors.
For convenience, and starting with version 0.6.5, we now build binary wheels
for different operating systems, architectures, and Python versions using
GitHub Actions which include the underlying TA-Lib C library and are easy to
install.
install. Starting with version 0.8.3, this library is statically linked into
the extension.

Supported platforms:

Expand Down Expand Up @@ -173,28 +188,15 @@ using the instructions above.

### Troubleshooting 🛠️

If you get a warning that looks like this:

```shell
setup.py:79: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
```

This typically means `setup.py` can't find the underlying `TA-Lib`
library, a dependency which needs to be installed.

---

If you installed the underlying `TA-Lib` library with a custom prefix
(e.g., with `./configure --prefix=$PREFIX`), then when you go to install
this python wrapper you can specify additional search paths to find the
library and include files for the underlying `TA-Lib` library using the
`TA_LIBRARY_PATH` and `TA_INCLUDE_PATH` environment variables:
this Python wrapper you can select that installation instead of the bundled
build using the `TA_LIBRARY_PATH` and `TA_INCLUDE_PATH` environment variables:

```shell
export TA_LIBRARY_PATH=$PREFIX/lib
export TA_INCLUDE_PATH=$PREFIX/include
python setup.py install # or pip install ta-lib
python -m pip install --no-binary=TA-Lib TA-Lib
```

---
Expand All @@ -218,10 +220,10 @@ common.obj : error LNK2001: unresolved external symbol TA_GetUnstablePeriod
common.obj : error LNK2001: unresolved external symbol TA_GetVersionString
```

This typically means that it can't find the underlying `TA-Lib` library, a
dependency which needs to be installed. On Windows, this could be caused by
installing the 32-bit binary distribution of the underlying `TA-Lib` library,
but trying to use it with 64-bit Python.
When using ``TA_INCLUDE_PATH`` or ``TA_LIBRARY_PATH``, check that they point
to the headers and libraries of a compatible TA-Lib C installation. On Windows,
the library architecture must match Python (for example, a 64-bit Python needs
a 64-bit TA-Lib C library).

---

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["setuptools", "Cython", "numpy"]
requires = ["setuptools", "Cython", "numpy", "cmake"]
build-backend = "setuptools.build_meta"

[project]
name = "TA-Lib"
version = "0.8.2"
version = "0.8.3"
description = "Python wrapper for TA-Lib"
readme = "README.md"
license-files = ["LICENSE"]
Expand Down
Loading
Loading