-
Notifications
You must be signed in to change notification settings - Fork 0
WIP Support installing pyGinkgo via pip #86
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
base: main
Are you sure you want to change the base?
Changes from all commits
e93879c
bfdc645
209e39d
a4b73bb
24b04be
7935bff
73f0cbc
19c3f13
7e73731
4761bb1
c3572dc
ffb1440
8cc2eaa
d26180c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Upload Python Package to PyPI when a Release is Created | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
pypi-publish: | ||
name: Publish release to PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/pyGinkgo | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel | ||
- name: Build package | ||
run: | | ||
python setup.py sdist bdist_wheel # Could also be python -m build | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,12 +21,12 @@ The tests successfully run on the following Python versions: | |||||
### Prerequisites | ||||||
|
||||||
- Python 3.x | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- Ginkgo | ||||||
- Ginkgo (preinstalled, otherwise it will be cloned during build) | ||||||
- Pybind11 | ||||||
- Ninja # if you want to use cmake presets | ||||||
- [pybind11-stubgen](https://pypi.org/project/pybind11-stubgen/) # if you want to use [stubs generation](#stubs-generation) | ||||||
|
||||||
### Building the module | ||||||
### Building the module via Cmake | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
1. **Clone the repository**: | ||||||
```bash | ||||||
|
@@ -61,6 +61,17 @@ To run a particular test, say 'pyginkgo_import_test': | |||||
ctest -R pyginkgo_import_test | ||||||
``` | ||||||
|
||||||
### Building the module via pip | ||||||
You can invoke the build and installation process via pip, this however will require the same dependencies to be present as with the default Cmake installation. | ||||||
To install pyGinkgo from source use | ||||||
```bash | ||||||
pip install . | ||||||
``` | ||||||
or alternatively getting it from PyPi | ||||||
```bash | ||||||
pip install pyGinkgo | ||||||
``` | ||||||
|
||||||
### Stubs generation | ||||||
From [Python mypy documentation](https://mypy.readthedocs.io/en/stable/stubgen.html): | ||||||
> A stub file (see [PEP 484](https://peps.python.org/pep-0484/)) contains only type hints for the public interface of a module, with empty function bodies. Mypy can use a stub file instead of the real implementation to provide type information for the module. They are useful for third-party modules whose authors have not yet added type hints (and when no stubs are available in typeshed) and C extension modules (which mypy can’t directly process). | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,35 +3,57 @@ name = "pyGinkgo" | |||||
version = "0.0.0" | ||||||
description = "PyGinkgo is a Python binding for the Ginkgo framework, providing access to Ginkgo's powerful linear algebra capabilities from Python." | ||||||
authors = [ | ||||||
{name = "Keshvi Tuteja ", email = "[email protected]"}, | ||||||
{name = "Gregor Olenik", email = "[email protected]"}, | ||||||
{name = "Keshvi Tuteja", email= "[email protected]"}, | ||||||
{name = "Roman Mishchuk", email= "[email protected]"}, | ||||||
{name = "Yu-Hsiang M. Tsai", email= "[email protected]"}, | ||||||
{name = "Gregor Olenik", email = "[email protected]"}, | ||||||
] | ||||||
license = {text = "MIT"} | ||||||
readme="Readme.md" | ||||||
readme="README.md" | ||||||
classifiers = [ | ||||||
"Intended Audience :: Developers", | ||||||
"Programming Language :: Python :: 3", | ||||||
"Programming Language :: C++", | ||||||
"License :: OSI Approved :: MIT License", | ||||||
"Operating System :: OS Independent", | ||||||
"Environment :: GPU", | ||||||
"Topic :: Scientific/Engineering", | ||||||
"Topic :: Scientific/Engineering :: Artificial Intelligence", | ||||||
"Topic :: Scientific/Engineering :: Mathematics", | ||||||
] | ||||||
requires-python = ">=3.6" | ||||||
keywords = ["sparse-linear-algebra", "high-performance-computing", "krylov-methods", "spmv", "gpu-computing"] | ||||||
requires-python = ">=3.8" | ||||||
dependencies = [ | ||||||
"numpy", | ||||||
"pybind11", | ||||||
"pybind11==2.12.0" | ||||||
] | ||||||
|
||||||
[build-system] | ||||||
requires = ["py-build-cmake~=0.5.0"] | ||||||
build-backend = "py_build_cmake.build" | ||||||
|
||||||
[tool.py-build-cmake.module] | ||||||
name = "pyGinkgo" | ||||||
|
||||||
[tool.py-build-cmake.sdist] | ||||||
include = ["CMakeLists.txt", "src", "cmake/*", "tests"] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
[tool.py-build-cmake.cmake] | ||||||
minimum_version="3.20" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Is there any reason for 3.20? |
||||||
build_type="Release" | ||||||
build_args=["-j", "8"] | ||||||
|
||||||
[project_urls] | ||||||
Documentation= "https://obr.readthedocs.io/" | ||||||
Documentation= "https://github.com/Helmholtz-AI-Energy/pyGinkgo/blob/main/README.md" | ||||||
Changelog= "https://github.com/Helmholtz-AI-Energy/pyGinkgo/blob/main/CHANGELOG.md" | ||||||
Issues= "https://github.com/Helmholtz-AI-Energy/pyGinkgo/issues" | ||||||
|
||||||
[project.optional-dependencies] | ||||||
doc = [ | ||||||
"sphinx==6.2.1", | ||||||
"sphinx-autoapi==3.0.0", | ||||||
"sphinxcontrib.applehelp==1.0.7", | ||||||
"furo", | ||||||
"myst_parser", | ||||||
] | ||||||
test = [ | ||||||
"pytest", | ||||||
] | ||||||
|
||||||
[tool.cibuildwheel] | ||||||
build-verbosity = 1 | ||||||
environment = { PY_BUILD_CMAKE_VERBOSE="1" } | ||||||
test-command = "pytest {package}/tests" | ||||||
test-extras = ["test"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can take a look on https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/run-job-variations
I think we need to publish several python version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, but this is just for testing. I was a bit reluctant to add more versions here since a single build takes already 40minutes. i fear that we might run out of ci credits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. When we open source this repo, github action will give unlimited credits for ci