Skip to content

Commit

Permalink
[Project] Add python docs deployment (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorOrachyov committed Feb 17, 2022
1 parent 05d81e6 commit 4c8f40a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:

jobs:
build:
# Do not attempt to deploy documentation on forks
if: github.repository_owner == 'JetBrains-Research'
runs-on: ubuntu-latest

steps:
Expand All @@ -23,3 +25,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./html/
destination_dir: cdocs
39 changes: 39 additions & 0 deletions .github/workflows/pydocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Python docs

on:
push:
branches: [ main ]
paths:
- '.github/**'
- 'python/pyspbla/**'

jobs:
documentation:
# Do not attempt to deploy documentation on forks
if: github.repository_owner == 'JetBrains-Research'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8 ]
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install packages
run: python -m pip install pdoc3

- name: Build docs
run: pdoc -o pydocs --html python/pyspbla
env:
SPBLA_DOCS_ONLY: true

- name: Publish to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./pydocs/
destination_dir: pydocs
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ library features and primitives in high-level format with automated resources ma

* **PyPI package:** [https://pypi.org/project/pyspbla/](https://pypi.org/project/pyspbla/)
* **Tutorial:** [https://github.com/JetBrains-Research/spbla/blob/main/docs/tutorial.md](https://github.com/JetBrains-Research/spbla/blob/main/docs/tutorial.md)
* **Getting started:** [https://github.com/JetBrains-Research/spbla/blob/main/docs/getting_started.md](https://github.com/JetBrains-Research/spbla/blob/main/docs/getting_started.md)
* **Extended example:** [https://github.com/JetBrains-Research/spbla/blob/main/docs/getting_started.md](https://github.com/JetBrains-Research/spbla/blob/main/docs/getting_started.md)
* **Getting started:** [https://github.com/JetBrains-Research/spbla/blob/main/docs/getting_started.md](https://github.com/JetBrains-Research/spbla/blob/main/docs/getting_started.md)
* **Contributing guide:** [https://github.com/JetBrains-Research/spbla/blob/master/CONTRIBUTING.md](https://github.com/JetBrains-Research/spbla/blob/master/CONTRIBUTING.md)
* **Python Reference:**
* **C API Reference:** [https://jetbrains-research.github.io/spbla/](https://jetbrains-research.github.io/spbla/)
* **Python Reference:** [https://jetbrains-research.github.io/spbla/pydocs/pyspbla](https://jetbrains-research.github.io/spbla/pydocs/pyspbla)
* **C API Reference:** [https://jetbrains-research.github.io/spbla/cdocs/](https://jetbrains-research.github.io/spbla/cdocs/)
* **Package source code:** [https://github.com/JetBrains-Research/spbla/tree/main/python/pyspbla](https://github.com/JetBrains-Research/spbla/tree/main/python/pyspbla)

### Features summary
Expand All @@ -42,6 +42,15 @@ library features and primitives in high-level format with automated resources ma

- Linux based OS (tested on Ubuntu 20.04)


### Installation

Get the latest package version from PyPI package index:

```shell
$ python3 -m pip install pyspbla
```

### Simple example

Create sparse matrices, compute matrix-matrix product and print the result to the output:
Expand Down
11 changes: 9 additions & 2 deletions python/pyspbla/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def __init__(self):
self.loaded_dll = None
self.backend = "default"

try:
if os.environ["SPBLA_DOCS_ONLY"]:
return
except KeyError:
pass

try:
# Try from config if present
self.load_path = os.environ["SPBLA_PATH"]
Expand Down Expand Up @@ -74,8 +80,9 @@ def __setup_library(self):
bridge.check(status)

def __release_library(self):
status = self.loaded_dll.spbla_Finalize()
bridge.check(status)
if self.loaded_dll is not None:
status = self.loaded_dll.spbla_Finalize()
bridge.check(status)

@classmethod
def __get_lib_path(cls, prefix):
Expand Down

0 comments on commit 4c8f40a

Please sign in to comment.