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 hosting of built wheel at PyPI - main #297

Merged
merged 65 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3a8be66
Lower NumPy and SciPy version for install
ben-l-p Jun 25, 2024
7a1ac6a
Merge pull request #293 from ImperialCollegeLondon/fix_prevent_numpy2…
rafapalacios Jun 27, 2024
dbd1143
Create pypi_test.yaml
kccwing Aug 28, 2024
cf348f0
Update pypi_test.yaml
kccwing Aug 28, 2024
586d3ac
Update pypi_test.yaml
kccwing Aug 28, 2024
f45ac04
Update pypi_test.yaml
kccwing Aug 28, 2024
2396379
Update pypi_test.yaml
kccwing Aug 28, 2024
8db99ca
Update pypi_test.yaml
kccwing Aug 28, 2024
88ec407
Update pypi_test.yaml
kccwing Aug 28, 2024
56b0950
Update pypi_test.yaml
kccwing Aug 28, 2024
088cc08
Update pypi_test.yaml
kccwing Aug 28, 2024
3deb0dd
Update pypi_test.yaml
kccwing Aug 28, 2024
e96d862
Update pypi_test.yaml
kccwing Aug 28, 2024
7418a8d
Update pypi_test.yaml
kccwing Aug 28, 2024
0add8ca
Update pypi_test.yaml
kccwing Aug 28, 2024
97ed0e0
Update pypi_test.yaml
kccwing Aug 28, 2024
5a40812
Update pypi_test.yaml
kccwing Aug 28, 2024
d5d129b
Update pypi_test.yaml
kccwing Aug 28, 2024
442e417
Update setup.py
kccwing Aug 28, 2024
047ff09
Update setup.py
kccwing Aug 28, 2024
ebb6b4e
Update pypi_test.yaml
kccwing Aug 28, 2024
1132cb2
Update setup.py
kccwing Aug 28, 2024
5372e3b
Update pypi_test.yaml
kccwing Aug 28, 2024
09a9879
Update pypi_test.yaml
kccwing Aug 28, 2024
3ea2da1
Update pypi_test.yaml
kccwing Aug 28, 2024
49bf8d2
Update pypi_test.yaml
kccwing Aug 28, 2024
8f73f16
Update pypi_test.yaml
kccwing Aug 28, 2024
bf674a4
Update pypi_test.yaml
kccwing Aug 28, 2024
0d3edd7
Update pypi_test.yaml
kccwing Aug 28, 2024
2ecb365
Update pypi_test.yaml
kccwing Aug 28, 2024
7e52ca1
Update setup.py
kccwing Aug 28, 2024
cfc187a
change name of package
kccwing Aug 28, 2024
4a15277
mayavi direct dependency removed
kccwing Aug 28, 2024
951f920
Create pypi_build.yaml
kccwing Aug 28, 2024
2971617
Update and rename pypi_test.yaml to pypi_build_test.yaml
kccwing Aug 28, 2024
64ba76f
Update pypi_build_test.yaml
kccwing Aug 28, 2024
5a78562
Update pypi_build_test.yaml
kccwing Aug 29, 2024
560911d
Update pypi_build.yaml
kccwing Aug 29, 2024
348bfe7
Update readme.md for pypi
kccwing Aug 29, 2024
0b229f9
Update readme.md
kccwing Aug 29, 2024
a4be887
Update installation.md for PyPI
kccwing Aug 29, 2024
389baba
Update installation.md
kccwing Aug 29, 2024
fe44484
Update pypi_build_test.yaml
kccwing Aug 29, 2024
f850fec
Addressed and incorporated suggestions from review
kccwing Aug 29, 2024
acb41ff
Deleted as now incorporated into pypi_build
kccwing Aug 29, 2024
ae491be
Update pypi_build.yaml
kccwing Aug 29, 2024
107e467
Update pypi_build.yaml
kccwing Aug 29, 2024
b054baf
Update pypi_build.yaml
kccwing Aug 29, 2024
0b4ea11
Update pypi_build.yaml
kccwing Aug 29, 2024
e20210f
Update pypi_build.yaml
kccwing Aug 29, 2024
b8704e3
Renamed job to distinguish actions
kccwing Aug 29, 2024
9210c61
Name update for readability
kccwing Aug 29, 2024
41a04a8
Update readme.md for removing pypi_test
kccwing Aug 29, 2024
c571ec9
include also tarball to pypi
kccwing Oct 7, 2024
8bd521f
update upload/download-artifact to v4
kccwing Oct 7, 2024
cdd24b6
use older gcc version to improve compatibility
kccwing Oct 7, 2024
5ecf279
update gcc action to 4.8
kccwing Oct 7, 2024
bfdba81
Update pypi_build.yaml
kccwing Oct 7, 2024
1ec190a
ubuntu bionic runner deprecated
kccwing Oct 7, 2024
904e247
Merge branch 'develop' into dev_pypi
kccwing Oct 8, 2024
923bbc6
Merge branch 'main' into dev_pypi
kccwing Oct 8, 2024
70bcd19
renaming pypi repo to be consistent with documentation
kccwing Oct 9, 2024
45ae5e5
pypi rename to ic-sharpy
kccwing Oct 9, 2024
ddbf96c
pypi rename to ic-sharpy
kccwing Oct 9, 2024
1c06e20
pypi rename to ic-sharpy
kccwing Oct 9, 2024
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
90 changes: 90 additions & 0 deletions .github/workflows/pypi_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Create and publish pypi image

on:
# only runs when there are pushes to develop and main for publishing
# and for testing, pull requests to develop and main
# and if there are changes to the build process and github action
push:
branches:
- develop
- main
paths:
- 'setup.py'
- '.github/workflows/pypi*'
pull_request:
branches:
- main
- develop
- 'rc*'

jobs:
create-pypi-image:
name: >-
Create .whl 🛞 from SHARPy distribution
runs-on: ubuntu-20.04
env:
python-version-chosen: "3.10.8"
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.python-version-chosen }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.python-version-chosen }}
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 7
platform: x64
- name: Pre-Install dependencies
run: |
export QT_QPA_PLATFORM='offscreen'
sudo apt install libeigen3-dev
git submodule init
git submodule update
kccwing marked this conversation as resolved.
Show resolved Hide resolved
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Install wheel
run: python3 -m pip install wheel --user
- name: Build a source tarball
run: python setup.py sdist
- name: Build a binary wheel
run: python3 setup.py bdist_wheel
- name: Find the wheel created during pip install
run:
python3 -m pip cache dir
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes
needs:
- create-pypi-image
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ic_sharpy # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# with:
# path: dist/*
11 changes: 9 additions & 2 deletions .github/workflows/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SHARPy GitHub Workflows

There are 4 automated workflows for SHARPy's CI/CD.
There are 4(+1 experimental) automated workflows for SHARPy's CI/CD.

## SHARPy Tests

Expand All @@ -19,5 +19,12 @@ Python code, hence allowing the merge.
Two nearly identical workflows, the only difference is that one pushes the Docker
image to the SHARPy packages. Therefore:

* `docker_build.yaml`: Builds the Docker image but does not push. Runs on changes to the `docker*` workflows, changes to the `utils/` directory (environments) and changes to the `Dockerfile`. Required test for PRs to merge to `develop` and `main`.
* `docker_build_test.yaml`: Builds the Docker image but does not push. Runs on changes to the `docker*` workflows, changes to the `utils/` directory (environments) and changes to the `Dockerfile`. Required test for PRs to merge to `develop` and `main`.
* `docker_build.yaml`: Builds and pushes the Docker image. Runs on pushes to `develop`, `main` and annotated tags.

## Pypi (experimental!)

One workflow with two jobs, the first creates and the second pushes the wheel
artifact to ic-sharpy @ pypi. Therefore:

* `pypi_build.yaml`: Builds and pushes the pypi wheel according to conditions. Runs on changes to the `pypi*` workflow, changes to the `setup.py`, and PRs and pushes to main and develop. Required test for PRs to merge to `develop` and `main`. Publishes on annotated tags.
14 changes: 14 additions & 0 deletions docs/source/content/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,20 @@ python -m unittest

**Enjoy!**

## Obtain SHARPy from PyPI (experimental!)

You can obtain a built version of SHARPy, ic-sharpy, from PyPI [here](https://pypi.org/project/ic-sharpy/).

To install at default directory use
```
python3 -m pip install ic-sharpy
```
To install at current directory use
```
python3 -m pip install --prefix . ic-sharpy
```
The source code can be found at `/lib/python3.10/site-packages/sharpy` and the executable at `/bin/sharpy`.

## Running SHARPy

### Automated tests
Expand Down
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def run(self):
long_description = f.read()
run()
setup(
name="sharpy",
name="ic_sharpy", # due to the name sharpy being taken on pypi
version=__version__,
description="""SHARPy is a nonlinear aeroelastic analysis package developed
at the Department of Aeronautics, Imperial College London. It can be used
Expand Down Expand Up @@ -139,7 +139,7 @@ def run(self):
"colorama",
"dill",
"jupyterlab",
"mayavi @ git+https://github.com/enthought/mayavi.git", #Used for TVTK. Bug in pip install, hence git clone
"mayavi", # github direct dependency removed since pip version is fixed, and also not compatible with pypi
"pandas",
"control",
"openpyxl>=3.0.10",
Expand All @@ -162,8 +162,11 @@ def run(self):
],
},
classifiers=[
"Operating System :: Linux, Mac OS",
"Programming Language :: Python, C++",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.10",
"Programming Language :: Fortran",
"Programming Language :: C++"
],

entry_points={
Expand Down
Loading