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

Add dependency for python 3.8, reenable sdist #53

Merged
merged 1 commit into from
Feb 13, 2024
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
127 changes: 62 additions & 65 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,11 @@ jobs:
# os: windows-2022

# Exclude macOS builds for now
- is-full-run: false
os: macos-12
- os: macos-12
# is-full-run: false # FIXME https://github.com/Point72/csp/issues/33

- is-full-run: false
os: macos-14
- os: macos-14
# is-full-run: false # FIXME https://github.com/Point72/csp/issues/33

# Exclude Python 3.8, 3.10, 3.11 builds
- is-full-run: false
Expand Down Expand Up @@ -466,15 +466,13 @@ jobs:
run: python -m pip install -U *manylinux2014*.whl --target .
if: ${{ runner.os == 'Linux' }}

# Note, on mac we must install the x86 wheel, the arm64 wheel
# would need an arm machine to test
- name: Install wheel (OSX)
- name: Install wheel (OSX x86)
run: python -m pip install -U *x86*.whl --target .
if: ${{ runner.os == 'macOS' && matrix.python-version != '3.11' }}
if: ${{ runner.os == 'macOS' && runner.arch == 'X64' }}

- name: Install wheel (OSX 3.11+)
run: python -m pip install -U *universal*.whl --target .
if: ${{ runner.os == 'macOS' && matrix.python-version == '3.11' }}
- name: Install wheel (OSX arm)
run: python -m pip install -U *arm64*.whl --target .
if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }}

- name: Install wheel (windows)
run: python -m pip install -U (Get-ChildItem .\*.whl | Select-Object -Expand FullName) --target .
Expand All @@ -496,60 +494,59 @@ jobs:
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Stage Four - Build / test the SDist #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# test_sdist:
# needs:
# - initialize
# - build_sdist

# strategy:
# matrix:
# os:
# - ubuntu-22.04
# python-version:
# - 3.9

# runs-on: ${{ matrix.os }}

# # if: ${{ needs.initialize.outputs.FULL_RUN == 'true' }}

# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# submodules: recursive

# - name: Set up Python ${{ matrix.python-version }}
# uses: ./.github/actions/setup-python
# with:
# version: '${{ matrix.python-version }}'

# - name: Set up Caches
# uses: ./.github/actions/setup-caches
# with:
# cibuildwheel: 'cp39'

# # Python
# - name: Install python dependencies
# run: make requirements

# # Download sdist
# - uses: actions/download-artifact@v4
# with:
# name: csp-sdist
# path: dist/

# # Install sdist
# - name: Install sdist
# run: python -m pip install -U dist/csp*.tar.gz --target .
# env:
# CCACHE_DIR: /host/home/runner/work/csp/csp/.ccache
# VCPKG_DEFAULT_BINARY_CACHE: /host/home/runner/vcpkg_cache

# # Test sdist
# - name: Run tests against from-scratch sdist build
# run: make test

##########################################################################################################################
test_sdist:
needs:
- initialize
- build_sdist

strategy:
matrix:
os:
- ubuntu-22.04
python-version:
- 3.9

runs-on: ${{ matrix.os }}

if: ${{ needs.initialize.outputs.FULL_RUN == 'true' }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'

- name: Set up Caches
uses: ./.github/actions/setup-caches
with:
cibuildwheel: 'cp39'

# Python
- name: Install python dependencies
run: make requirements

# Download sdist
- uses: actions/download-artifact@v4
with:
name: csp-sdist
path: dist/

# Install sdist
- name: Install sdist
run: python -m pip install -U -vvv dist/csp*.tar.gz --target .
env:
CCACHE_DIR: /home/runner/work/csp/csp/.ccache
VCPKG_DEFAULT_BINARY_CACHE: /home/runner/vcpkg_cache
VCPKG_DOWNLOADS: /home/runner/vcpkg_download_cache

# Test sdist
- name: Run tests against from-scratch sdist build
run: make test


#################################
Expand Down
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ option(CSP_BUILD_GPROF "Hook into gprof for profiling" OFF)
option(CSP_MANYLINUX "Build for python's manylinux setup" OFF)
option(CSP_USE_VCPKG "Build with vcpkg dependencies" ON)
option(CSP_USE_CCACHE "Build with ccache caching" OFF)
option(CSP_USE_LD_CLASSIC_MAC "On macOS, link with ld_classic" OFF)

# Extension options
option(CSP_BUILD_KAFKA_ADAPTER "Build kafka adapter" ON)
Expand Down Expand Up @@ -115,8 +116,11 @@ if(MACOS)
set(THREADS_PREFER_PTHREAD_FLAG ON)

# for exception unwinding on macOS
check_linker_flag(CXX "-Wl,-ld_classic" HAS_LD_CLASSIC_MAC)
if(HAS_LD_CLASSIC_MAC)
# TODO this does not work, which would be the
# proper cmake way of doing it, so instead we
# use a vanilla option
# check_linker_flag(CXX "-Wl,-ld_classic" CSP_USE_LD_CLASSIC_MAC)
if(CSP_USE_LD_CLASSIC_MAC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-ld_classic")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-ld_classic")
endif()
Expand Down
9 changes: 6 additions & 3 deletions csp/tests/test_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from csp import profiler, ts
from csp.tests.test_dynamic import DynData, gen_basket, random_keys

from .test_showgraph import _cant_find_graphviz


@csp.graph
def stats_graph():
Expand Down Expand Up @@ -153,9 +155,10 @@ def graph3():

with profiler.Profiler() as p:
results = csp.run(graph3, starttime=st, endtime=st + timedelta(seconds=100))
with tempfile.NamedTemporaryFile(prefix="foo", suffix=".png", mode="w") as temp_file:
temp_file.close()
csp.show_graph(graph3, graph_filename=temp_file.name)
if not _cant_find_graphviz():
with tempfile.NamedTemporaryFile(prefix="foo", suffix=".png", mode="w") as temp_file:
temp_file.close()
csp.show_graph(graph3, graph_filename=temp_file.name)

prof = p.results()
self.assertEqual(prof.cycle_count, 100)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ version = "0.1.0"
requires-python = ">=3.8"

dependencies = [
"backports.zoneinfo; python_version<'3.9'",
"numpy",
"pandas",
"psutil",
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
os.environ["OSX_DEPLOYMENT_TARGET"] = os.environ.get("OSX_DEPLOYMENT_TARGET", "10.13")
os.environ["MACOSX_DEPLOYMENT_TARGET"] = os.environ.get("OSX_DEPLOYMENT_TARGET", "10.13")

if hasattr(platform, "mac_ver") and platform.mac_ver()[0].startswith("14"):
cmake_args.append("-DCSP_USE_LD_CLASSIC_MAC=ON")

if which("ccache"):
cmake_args.append("-DCSP_USE_CCACHE=On")

Expand Down
Loading