diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 4247d7946..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,126 +0,0 @@ -version: 2.1 -orbs: - codecov: codecov/codecov@3.2.4 - -jobs: - build: - docker: - - image: cimg/python:3.10 - working_directory: /home/circleci/msprime - steps: - - checkout - - run: sudo chown -R circleci:circleci * - - restore_cache: - # Note: we put a v{x} suffix at the end of the cache key so that - # we can invalidate the cache when we need to. Note that we need - # to update the key in the ``save_cache`` block below also when - # doing that. - key: msprime-{{ .Branch }}-v5 - - run: - name: Checkout submodules - command: | - git submodule update --init --recursive - # Write out the status for debugging purposes. Are we checked out at tags? - git submodule status --recursive - - run: - name: Install dependencies and set path - command: | - sudo apt-get update - sudo apt-get install libgsl0-dev libcunit1-dev libconfig-dev ninja-build valgrind clang - pip install uv - uv venv - uv pip install -r pyproject.toml --extra test - # way to set path persistently https://circleci.com/docs/2.0/env-vars/#setting-path - echo 'export PATH=/home/circleci/.local/bin:$PATH' >> $BASH_ENV - - save_cache: - key: msprime-{{ .Branch }}-v5 - paths: - - "/home/circleci/.local" - - - run: - name: Compile Python - command: | - source .venv/bin/activate - make allchecks - - - run: - name: Run highlevel tests - # Run tests without background threads - command: | - source .venv/bin/activate - pytest --cov=msprime --cov-report=xml --cov-branch -n 0 tests - - - codecov/upload: - flags: python - token: CODECOV_TOKEN - - - run: - name: Delete coverage - command: | - rm .coverage - - - run: - name: Compile C with gcc - command: | - source .venv/bin/activate - CFLAGS=--coverage meson lib/ build-gcc && ninja -C build-gcc - - - run: - name: Run the low-level tests. - command: | - source .venv/bin/activate - ninja -C build-gcc test - - - run: - name: Run gcov manually, as the one used in codecov doesn't work here. - command: | - gcov -pb -o ./build/temp.linux*/msprime msprime/_msprimemodule.c - cd build-gcc - # TODO should be able to do this with 'find', but it's tricky and opaque. - gcov -pb ./libmsprime.a.p/fenwick.c.gcno ../lib/fenwick.c - gcov -pb ./libmsprime.a.p/msprime.c.gcno ../lib/msprime.c - gcov -pb ./libmsprime.a.p/mutgen.c.gcno ../lib/mutgen.c - gcov -pb ./libmsprime.a.p/object_heap.c.gcno ../lib/object_heap.c - gcov -pb ./libmsprime.a.p/interval_map.c.gcno ../lib/interval_map.c - gcov -pb ./libmsprime.a.p/util.c.gcno ../lib/util.c - gcov -pb ./libmsprime.a.p/likelihood.c.gcno ../lib/likelihood.c - gcov -pb ./libmsprime.a.p/rate_map.c.gcno ../lib/rate_map.c - cd .. - - - codecov/upload: - flags: C - token: CODECOV_TOKEN - - - run: - name: Valgrind for C tests. - command: | - valgrind --leak-check=full --error-exitcode=1 ./build-gcc/test_core - valgrind --leak-check=full --error-exitcode=1 ./build-gcc/test_ancestry - valgrind --leak-check=full --error-exitcode=1 ./build-gcc/test_fenwick - valgrind --leak-check=full --error-exitcode=1 ./build-gcc/test_likelihood - valgrind --leak-check=full --error-exitcode=1 ./build-gcc/test_mutations - valgrind --leak-check=full --error-exitcode=1 ./build-gcc/test_rate_map - valgrind --leak-check=full --error-exitcode=1 ./build-gcc/test_sweeps - - - run: - name: Make sure we can build a distribution. - command: | - source .venv/bin/activate - python -m build --sdist - python -m build --wheel - python -m twine check dist/*.tar.gz --strict - - - run: - name: Install from the distribution tarball - command: | - mkdir installtest - cd installtest - python -m venv venv - source venv/bin/activate - pip install --upgrade setuptools pip - pip install ../dist/*.whl - python -c 'import msprime; print(msprime.__version__)' - - # We should still be able to import without the newick module - python -m pip uninstall -y newick - python -c 'import msprime; print(msprime.__version__)' diff --git a/.github/workflows/debug-windows.yml b/.github/workflows/debug-windows.yml new file mode 100644 index 000000000..67f5a57de --- /dev/null +++ b/.github/workflows/debug-windows.yml @@ -0,0 +1,53 @@ +name: Debug Windows + +on: + pull_request: + +jobs: + debug-windows: + name: Debug Windows Python 3.13 + runs-on: windows-latest + defaults: + run: + shell: bash + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v4.2.2 + with: + submodules: true + + - name: Set up Python 3.13 + uses: actions/setup-python@v5.4.0 + with: + python-version: "3.13" + + - name: Fix windows symlinks + run: | + rm lwt_interface + cp -r --dereference git-submodules/tskit/python/lwt_interface ./lwt_interface + + - name: Install GSL (Windows) + run: | + vcpkg install gsl:x64-windows + # Add GSL DLL directory to PATH for runtime + $vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT + if (-not $vcpkgRoot) { $vcpkgRoot = "C:\vcpkg" } + $gslBinPath = Join-Path $vcpkgRoot "installed\x64-windows\bin" + echo "$gslBinPath" >> $env:GITHUB_PATH + Write-Output "Added to PATH: $gslBinPath" + shell: powershell + + - name: Install pip deps + run: | + pip install uv + uv pip install --system -r pyproject.toml --extra test + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 56b086330..000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Docs -on: - pull_request: - push: - branches: [main] - tags: - - '*' - merge_group: -jobs: - Docs: - uses: tskit-dev/.github/.github/workflows/docs-build-template.yml@v1 - with: - additional-setup: sudo apt-get install -y libgsl0-dev - make-command: make cmodule \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 3ca3ea03d..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Tests - -on: - pull_request: - push: - branches: [main, test] - merge_group: - -jobs: - pre-commit: - name: Lint - uses: tskit-dev/.github/.github/workflows/lint.yml@v2 - - test: - name: Python - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python: [ "3.10", 3.13 ] - os: [ macos-latest, ubuntu-24.04, windows-latest ] - defaults: - run: - shell: bash - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: Checkout - uses: actions/checkout@v4.2.2 - with: - submodules: true - - - name: Set up Python 3.10 - uses: actions/setup-python@v5.4.0 - with: - python-version: "${{ matrix.python }}" - - - name: Fix windows symlinks - # This is horrible, but the "git config core.symlinks true" didn't work. - if: matrix.os == 'windows-latest' - run: | - rm lwt_interface - cp -r --dereference git-submodules/tskit/python/lwt_interface ./lwt_interface - - - name: Install GSL (macOS) - if: matrix.os == 'macos-latest' - run: brew install gsl - - - name: Install GSL (Windows) - if: matrix.os == 'windows-latest' - run: | - vcpkg install gsl:x64-windows - # Add GSL DLL directory to PATH for runtime - $vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT - if (-not $vcpkgRoot) { $vcpkgRoot = "C:\vcpkg" } - $gslBinPath = Join-Path $vcpkgRoot "installed\x64-windows\bin" - echo "$gslBinPath" >> $env:GITHUB_PATH - Write-Output "Added to PATH: $gslBinPath" - shell: powershell - - - name: Install GSL (Ubuntu) - if: matrix.os == 'ubuntu-24.04' - run: sudo apt-get update && sudo apt-get install -y libgsl-dev - - - name: Install pip deps - run: | - pip install uv - uv pip install --system -r pyproject.toml --extra test - - - name: Build module and run tests - if: matrix.os != 'windows-latest' - run: | - python setup.py build_ext --inplace - pytest -xvs -n0 - - - name: Build wheel and run tests - if: matrix.os == 'windows-latest' - shell: powershell - run: | - uv pip install --system build delvewheel - python -m build --wheel - $vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT - if (-not $vcpkgRoot) { $vcpkgRoot = 'C:\vcpkg' } - $gslBinPath = Join-Path $vcpkgRoot 'installed\x64-windows\bin' - # Ensure GSL bin is on PATH for this session - $env:PATH = "$gslBinPath;$env:PATH" - # Repair wheel(s) to bundle DLLs - $whls = Get-ChildItem -Path dist -Filter '*.whl' - if ($whls) { - foreach ($w in $whls) { - delvewheel repair $w.FullName -w dist --add-path $gslBinPath - } - } else { - Write-Error 'No wheel files found in dist/' - exit 1 - } - # Remove source package directory to ensure pip installs wheel - if (Test-Path msprime) { Remove-Item -Recurse -Force msprime } - # Install repaired wheel(s) - Get-ChildItem -Path dist -Filter '*.whl' | ForEach-Object { pip install $_.FullName } - pytest -xvs -n0 \ No newline at end of file diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml deleted file mode 100644 index 40d3ebbea..000000000 --- a/.github/workflows/wheels.yml +++ /dev/null @@ -1,254 +0,0 @@ -name: Binary wheels - -on: - push: - branches: - - main - - test - tags: - - '*' - release: - types: [published] - -jobs: - OSX: - name: Build ${{ matrix.os }} - ${{ matrix.python }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-13, macos-14, macos-15] - python: ["3.10", 3.11, 3.12, 3.13] - steps: - - name: Checkout - uses: actions/checkout@v4.2.2 - with: - submodules: true - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5.4.0 - with: - python-version: ${{ matrix.python }} - - name: Install deps - run: | - brew install gsl - pip install --upgrade pip build - - name: Build Wheel (arm64) - if: matrix.os == 'macos-14' || matrix.os == 'macos-15' - run: | - export PLAT="arm64" - export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64" - export CFLAGS+=" -arch arm64" - export CXXFLAGS+=" -arch arm64" - export ARCHFLAGS=$OLDARCHFLAGS - export ARCHFLAGS+=" -arch arm64" - export CPPFLAGS+=" -arch arm64" - export LDFLAGS+=" -arch arm64" - python -m build --wheel - - name: Build Wheel (x86_64) - if: matrix.os == 'macos-13' - run: | - export PLAT="x86_64" - export _PYTHON_HOST_PLATFORM="macosx-11.0-x86_64" - export CFLAGS+=" -arch x86_64" - export CXXFLAGS+=" -arch x86_64" - export ARCHFLAGS=$OLDARCHFLAGS - export ARCHFLAGS+=" -arch x86_64" - export CPPFLAGS+=" -arch x86_64" - export LDFLAGS+=" -arch x86_64" - python -m build --wheel - - name: Delocate to bundle dynamic libs - run: | - pip install delocate - delocate-wheel -v dist/*.whl - - name: Upload Wheels - uses: actions/upload-artifact@v4.6.1 - with: - name: osx-wheel-${{ matrix.os }}-${{ matrix.python }} - path: dist - - Windows: - name: Build Windows - ${{ matrix.python }} - runs-on: windows-latest - strategy: - matrix: - python: ["3.10", 3.11, 3.12, 3.13] - arch: [x64] - steps: - - name: Checkout - uses: actions/checkout@v4.2.2 - with: - submodules: true - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5.4.0 - with: - python-version: ${{ matrix.python }} - architecture: ${{ matrix.arch }} - - name: Install GSL via vcpkg - run: | - vcpkg install gsl:${{ matrix.arch }}-windows - shell: cmd - - name: Install deps - run: | - pip install --upgrade pip build delvewheel - - name: Fix windows symlinks - run: | - if (Test-Path "lwt_interface") { Remove-Item -Recurse -Force "lwt_interface" } - Copy-Item -Recurse "git-submodules/tskit/python/lwt_interface" "./lwt_interface" - shell: powershell - - name: Build Wheel - run: | - # The symlink fix above confuses setuptools_scm - $tag = git describe --tags --exact-match HEAD 2>$null - if ($tag) { - $env:SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MSPRIME = $tag - } - python -m build --wheel - - name: Bundle dynamic libs - run: | - $vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT - if (-not $vcpkgRoot) { $vcpkgRoot = "C:\vcpkg" } - $gslBinPath = Join-Path $vcpkgRoot "installed\x64-windows\bin" - $env:PATH = "$gslBinPath;$env:PATH" - delvewheel repair dist/*.whl -w dist/ --add-path "$gslBinPath" - shell: powershell - - name: Upload Wheels - uses: actions/upload-artifact@v4.6.1 - with: - name: win-wheel-${{ matrix.python }} - path: dist - - manylinux: - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4.2.2 - with: - submodules: true - - name: Set up Python 3.10 - uses: actions/setup-python@v5.4.0 - with: - python-version: "3.10" - - name: Build sdist - shell: bash - run: | - pip install --upgrade pip build - python -m build --sdist - - name: Upload sdist - uses: actions/upload-artifact@v4.6.1 - with: - name: sdist - path: dist - - name: Build wheels in docker - shell: bash - run: | - docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2014_x86_64 bash .github/workflows/docker/buildwheel.sh - - - name: Upload Wheels - uses: actions/upload-artifact@v4.6.1 - with: - name: linux-wheels - path: dist/wheelhouse - - OSX-test: - name: Test ${{ matrix.os }} - ${{ matrix.python }} - needs: ['OSX'] - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-13, macos-14, macos-15] - python: ["3.10", 3.11, 3.12, 3.13] - steps: - - name: Download wheels - uses: actions/download-artifact@v4.2.0 - with: - name: osx-wheel-${{ matrix.os }}-${{ matrix.python }} - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5.4.0 - with: - python-version: ${{ matrix.python }} - - name: Install wheel and test - run: | - python -VV - # Install the local wheel - pip install numpy newick>=1.3.0 tskit>=0.5.2 demes>=0.2 - pip install msprime --no-index --only-binary msprime -f . - python -c "import msprime" - msp simulate 10 tmp.trees - tskit info tmp.trees - tskit provenances tmp.trees - - manylinux-test: - runs-on: ubuntu-24.04 - needs: ['manylinux'] - strategy: - matrix: - python: ["3.10", 3.11, 3.12, 3.13] - steps: - - name: Download wheels - uses: actions/download-artifact@v4.2.0 - with: - name: linux-wheels - - name: Set up Python - uses: actions/setup-python@v5.4.0 - with: - python-version: ${{ matrix.python }} - - name: Install wheel and test - run: | - python -VV - # Install the local wheel - pip install numpy newick demes - pip install --no-dependencies msprime --no-index --only-binary msprime -f . - pip install tskit - python -c "import msprime" - msp simulate 10 tmp.trees - tskit info tmp.trees - tskit provenances tmp.trees - - - Windows-test: - runs-on: windows-latest - needs: ['Windows'] - strategy: - matrix: - python: ["3.10", 3.11, 3.12, 3.13] - steps: - - name: Download wheels - uses: actions/download-artifact@v4.2.0 - with: - name: win-wheel-${{ matrix.python }} - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5.4.0 - with: - python-version: ${{ matrix.python }} - - name: Install wheel and test - run: | - python -VV - pip install numpy newick>=1.3.0 tskit>=0.5.2 demes>=0.2 - pip install msprime --no-index --only-binary msprime -f . - python -c "import msprime" - msp simulate 10 tmp.trees - tskit info tmp.trees - tskit provenances tmp.trees - - PyPI_Upload: - runs-on: ubuntu-24.04 - environment: release - needs: ['OSX-test', 'manylinux-test', 'Windows-test'] - permissions: - id-token: write - steps: - - name: Download all - uses: actions/download-artifact@v4.2.0 - - name: Move to dist - run: | - mkdir dist - cp */*.{whl,gz} dist/. - # Windows wheels have different naming pattern - if [ -d "win-wheel"* ]; then cp win-wheel*/*.whl dist/. || true; fi - - name: Publish distribution to Test PyPI - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@v1.12.4 - with: - repository_url: https://test.pypi.org/legacy/ - - name: Publish distribution to PRODUCTION PyPI - if: github.event_name == 'release' - uses: pypa/gh-action-pypi-publish@v1.12.4