Skip to content

Commit 04164d2

Browse files
committed
Adding PyPi
1 parent 98e044c commit 04164d2

3 files changed

Lines changed: 54 additions & 18 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Wheels
1+
name: Build
22

33
on:
44
push:
@@ -66,16 +66,16 @@ jobs:
6666
env:
6767
GITHUB_ACTIONS: true
6868

69-
- name: Build wheel
70-
run: python -m build --wheel
69+
- name: Build wheel and sdist
70+
run: python -m build
7171
env:
7272
GITHUB_ACTIONS: true
7373

74-
- name: Upload wheel artifact
74+
- name: Upload artifacts
7575
uses: actions/upload-artifact@v4
7676
with:
77-
name: wheel-${{ matrix.os }}-py${{ matrix.python-version }}
78-
path: dist/*.whl
77+
name: dist-${{ matrix.os }}-py${{ matrix.python-version }}
78+
path: dist/*
7979
retention-days: 7
8080

8181
- name: Upload compiled library
@@ -105,29 +105,24 @@ jobs:
105105
- name: Organize compiled libraries
106106
run: |
107107
mkdir -p release-libs
108-
# Copy and rename for each platform/python to ensure uniqueness
109108
find artifacts -name "*.dll" -exec cp {} release-libs/ \; || true
110109
find artifacts -name "*.so" -exec cp {} release-libs/ \; || true
111110
find artifacts -name "*.dylib" -exec cp {} release-libs/ \; || true
112-
113-
# Renaissance naming for native libs to match what setup.py expects
114-
# We rename them to include the OS name if they are distinct
115-
# Actually, if we just upload the .whl, most users will get the lib from the whl.
116-
# But for source installs, we provide these as fallbacks.
117111
ls -la release-libs/
118112
119-
- name: Organize wheels
113+
- name: Organize dist files
120114
run: |
121-
mkdir -p release-wheels
122-
find artifacts -name "*.whl" -exec cp {} release-wheels/ \;
123-
ls -la release-wheels/
115+
mkdir -p release-dist
116+
find artifacts -name "*.whl" -exec cp {} release-dist/ \;
117+
find artifacts -name "*.tar.gz" -exec cp {} release-dist/ \;
118+
ls -la release-dist/
124119
125120
- name: Create Release
126121
uses: softprops/action-gh-release@v1
127122
with:
128123
files: |
129124
release-libs/*
130-
release-wheels/*
125+
release-dist/*
131126
draft: false
132127
prerelease: false
133128
generate_release_notes: true

.github/workflows/pypi.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PyPi
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
pypi-publish:
10+
name: Publish to PyPI
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/pycnn
15+
permissions:
16+
id-token: write
17+
18+
steps:
19+
- name: Download all artifacts
20+
uses: actions/download-artifact@v4
21+
with:
22+
path: artifacts
23+
24+
- name: Organize dist files
25+
run: |
26+
mkdir -p dist
27+
# We only need the wheels and sdist.
28+
# We can find them in the 'dist-*' artifacts created by build-wheels.yml
29+
find artifacts -name "*.whl" -exec cp {} dist/ \;
30+
find artifacts -name "*.tar.gz" -exec cp {} dist/ \;
31+
ls -la dist/
32+
33+
- name: Publish package distributions to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
packages-dir: dist/

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
<p align="center">
77
<a href="https://github.com/77axel/PyCNN/actions/workflows/ci.yml"><img src="https://github.com/77axel/PyCNN/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
8-
<a href="https://github.com/77axel/PyCNN/actions/workflows/build-wheels.yml"><img src="https://github.com/77axel/PyCNN/actions/workflows/build-wheels.yml/badge.svg" alt="Build Wheels"></a>
8+
<a href="https://github.com/77axel/PyCNN/actions/workflows/pypi.yml"><img src="https://github.com/77axel/PyCNN/actions/workflows/pypi.yml/badge.svg" alt="PyPi"></a>
9+
<a href="https://github.com/77axel/PyCNN/actions/workflows/build-wheels.yml"><img src="https://github.com/77axel/PyCNN/actions/workflows/build-wheels.yml/badge.svg" alt="Build"></a>
910
<img src="https://img.shields.io/github/v/tag/77AXEL/PyCNN?label=Release&color=orange" alt="Version">
1011
<img src="https://img.shields.io/badge/Open_Source-Yes-lighgreen" alt="Open Source">
1112
<img src="https://img.shields.io/github/contributors/77axel/PyCNN.svg" alt="Contributors">
@@ -89,6 +90,10 @@ xcode-select --install
8990

9091
## 📌 Installation
9192

93+
```bash
94+
pip install pycnn
95+
```
96+
Or using:
9297
```bash
9398
pip install git+https://github.com/77AXEL/PyCNN.git
9499
```

0 commit comments

Comments
 (0)