Skip to content

Commit cfa46f3

Browse files
author
gerrymanoim
authored
BLD: Publish to pypi as part of release. Also publish docs. (#167)
* BLD: Publish to pypi as part of release * BUG: Fix tutorial code * BLD: Also publish docs on release
1 parent 87d69ca commit cfa46f3

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
build-n-publish:
8+
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
9+
runs-on: ubuntu-18.04
10+
steps:
11+
- uses: actions/checkout@2
12+
with:
13+
submodules: 'recursive'
14+
- name: Set up Python 3.8
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.8
18+
- name: Install python dependencies
19+
env:
20+
PYTHONWARNINGS: ignore:DEPRECATION::pip._internal.cli.base_command
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install numpy==1.18.1
24+
- name: Install c++ dependencies (ubuntu)
25+
run: |
26+
sudo apt-get -y install libpcre2-dev libsparsehash-dev doxygen
27+
- name: Set gcc envvars
28+
run: |
29+
echo ::set-env name=CC::gcc-8
30+
echo ::set-env name=CXX::g++-8
31+
- name: Build sdist
32+
run: python setup.py sdist
33+
34+
- name: Publish distribution 📦 to Test PyPI
35+
uses: pypa/gh-action-pypi-publish@master
36+
with:
37+
skip_existing: true
38+
password: ${{ secrets.test_pypi_password }}
39+
repository_url: https://test.pypi.org/legacy/
40+
41+
- name: Install from test and test running
42+
run: |
43+
pip install --extra-index-url https://test.pypi.org/simple libpy
44+
python -c 'import libpy;print(libpy.__version__)'
45+
pip uninstall -y libpy
46+
47+
- name: Publish distribution 📦 to PyPI
48+
uses: pypa/gh-action-pypi-publish@master
49+
with:
50+
skip_existing: true
51+
password: ${{ secrets.pypi_password }}
52+
53+
- name: Install and test running
54+
run: |
55+
pip install libpy
56+
python -c 'import libpy;print(libpy.__version__)
57+
58+
- name: Build the docs
59+
run: |
60+
pip install sphinx sphinx_rtd_theme breathe ipython
61+
make docs
62+
63+
- name: Deploy the docs
64+
uses: peaceiris/actions-gh-pages@v3
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
publish_dir: ./docs/build/html

docs/source/tutorial/libpy_tutorial/classes.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ struct LIBPY_NO_EXPORT to_object<libpy_tutorial::vec3d>
6868

6969
namespace libpy_tutorial {
7070

71+
using namespace std::string_literals;
72+
7173
LIBPY_AUTOMODULE(libpy_tutorial, classes, ({}))
7274
(py::borrowed_ref<> m) {
7375
py::owned_ref t =
74-
py::autoclass<vec3d>(PyModule_GetName(m) + ".Vec3d")
76+
py::autoclass<vec3d>(PyModule_GetName(m.get()) + ".Vec3d"s)
7577
.doc("An efficient 3-vector.") // add a class docstring
7678
.new_<double, double, double>() //__new__ takes parameters
7779
// bind the named methods to Python

0 commit comments

Comments
 (0)