Skip to content

Commit a6d8205

Browse files
authored
Merge pull request #131 from lucasimi/develop
Develop
2 parents 7745025 + 50aaccd commit a6d8205

File tree

4 files changed

+68
-24
lines changed

4 files changed

+68
-24
lines changed

.github/workflows/deploy.yml

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ on:
66
- 'v[0-9]+.[0-9]+.[0-9]+'
77

88
jobs:
9-
deploy-job:
9+
build_locally:
10+
name: Build locally
1011
runs-on: ubuntu-latest
1112
steps:
1213
- name: Check out repository code
13-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1415
- name: Install Python
1516
uses: actions/setup-python@v4
1617
with:
@@ -19,19 +20,55 @@ jobs:
1920
run: |
2021
python -m pip install twine build
2122
python -m pip install -e .
22-
- name: Build package
23+
- name: Build package locally
2324
run: |
24-
python -m build --sdist --wheel
25+
python -m build
2526
python -m twine check dist/*
26-
- name: Upload package to TestPyPI
27-
run: |
28-
python -m twine upload -r testpypi dist/* --verbose
29-
env:
30-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME_TEST }}
31-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }}
32-
- name: Upload package to PyPI
33-
run: |
34-
python -m twine upload -r pypi dist/* --verbose
35-
env:
36-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
37-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
27+
28+
build_wheels:
29+
name: Build wheels on ${{ matrix.os }}
30+
runs-on: ${{ matrix.os }}
31+
strategy:
32+
matrix:
33+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Build wheels
37+
uses: pypa/cibuildwheel@v2.19.2
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
41+
path: ./wheelhouse/*.whl
42+
43+
build_sdist:
44+
name: Build source distribution
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Build sdist
50+
run: pipx run build --sdist
51+
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: cibw-sdist
55+
path: dist/*.tar.gz
56+
57+
upload_pypi:
58+
needs: [build_wheels, build_sdist]
59+
runs-on: ubuntu-latest
60+
environment: pypi
61+
permissions:
62+
id-token: write
63+
steps:
64+
- uses: actions/download-artifact@v4
65+
with:
66+
# unpacks all CIBW artifacts into dist/
67+
pattern: cibw-*
68+
path: dist
69+
merge-multiple: true
70+
71+
- uses: pypa/gh-action-pypi-publish@release/v1
72+
with:
73+
# To test:
74+
repository-url: https://test.pypi.org/legacy/

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ keywords = ["tda", "mapper", "topology", "topological data analysis"]
1919
dependencies = [
2020
"matplotlib>=3.3.4",
2121
"networkx>=2.5",
22-
"numpy>=1.20.1",
22+
"numpy>=1.20.1, <2.0.0",
2323
"plotly>=4.14.3"
2424
]
2525
requires-python = ">=3.6"
2626

2727
[project.optional-dependencies]
2828
dev = ["coverage", "pandas", "scikit-learn"]
2929

30+
[tool.setuptools.package-data]
31+
"tdamapper.utils" = ["_metrics.c", "_metrics.pyx"]
32+
3033
[project.urls]
3134
Homepage = "https://github.com/lucasimi/tda-mapper-python"
3235
Documentation = "https://tda-mapper.readthedocs.io"

setup.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
from Cython.Build import cythonize
44

55

6+
ext_modules = [
7+
Extension(
8+
name='tdamapper.utils._metrics',
9+
sources=[
10+
'src/tdamapper/utils/_metrics.pyx',
11+
],
12+
),
13+
]
14+
615
setup(
7-
ext_modules=cythonize([
8-
Extension(
9-
name="tdamapper.utils._metrics",
10-
sources=["src/tdamapper/utils/_metrics.pyx"],
11-
),
12-
])
16+
ext_modules=cythonize(ext_modules),
1317
)

src/tdamapper/utils/_metrics.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cpdef inline double euclidean(double[:] x, double[:] y) nogil:
1717
return sqrt(norm_squared)
1818

1919

20-
cdef inline double minkowski(int p, double[:] x, double[:] y) nogil:
20+
cpdef inline double minkowski(int p, double[:] x, double[:] y) nogil:
2121
cdef double norm_p = 0.0
2222
cdef Py_ssize_t i, n = x.shape[0]
2323
for i in range(n):

0 commit comments

Comments
 (0)