File tree Expand file tree Collapse file tree 11 files changed +83
-19
lines changed
Expand file tree Collapse file tree 11 files changed +83
-19
lines changed Original file line number Diff line number Diff line change 88
99jobs :
1010 test :
11- name : Python ${{ matrix.python }}
11+ name : Build ( Python ${{ matrix.python }})
1212 runs-on : ubuntu-latest
1313 strategy :
1414 matrix :
1515 python : ['3.9', '3.10', '3.11']
1616
1717 env :
18+ TERM : xterm-256color
1819 RELEASE_FILE : ${{ github.event.repository.name }}-${{ github.event.release.tag_name || github.sha }}-py${{ matrix.python }}
1920
2021 steps :
Original file line number Diff line number Diff line change 1+ name : Install Test
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - main
8+
9+ jobs :
10+ test :
11+ name : Install (Python ${{ matrix.python }})
12+ runs-on : ubuntu-latest
13+ env :
14+ TERM : xterm-256color
15+ strategy :
16+ matrix :
17+ python : ['3.9', '3.10', '3.11']
18+
19+ steps :
20+ - name : Checkout Code
21+ uses : actions/checkout@v4
22+
23+ - name : Set up Python ${{ matrix.python }}
24+ uses : actions/setup-python@v5
25+ with :
26+ python-version : ${{ matrix.python }}
27+
28+ - name : Stub files & Patch install.sh
29+ run : |
30+ mkdir -p boot/firmware
31+ touch boot/firmware/config.txt
32+ sed -i "s|/boot/firmware|`pwd`/boot/firmware|g" install.sh
33+ sed -i "s|sudo raspi-config|raspi-config|g" pyproject.toml
34+ touch raspi-config
35+ chmod +x raspi-config
36+ echo `pwd` >> $GITHUB_PATH
37+
38+ - name : Run install.sh
39+ run : |
40+ ./install.sh --unstable --force
Original file line number Diff line number Diff line change 88
99jobs :
1010 test :
11- name : linting & spelling
11+ name : Linting & Spelling
1212 runs-on : ubuntu-latest
1313 env :
1414 TERM : xterm-256color
Original file line number Diff line number Diff line change 88
99jobs :
1010 test :
11- name : Python ${{ matrix.python }}
11+ name : Test ( Python ${{ matrix.python }})
1212 runs-on : ubuntu-latest
13+ env :
14+ TERM : xterm-256color
1315 strategy :
1416 matrix :
1517 python : ['3.9', '3.10', '3.11']
1618
1719 steps :
1820 - name : Checkout Code
19- uses : actions/checkout@v3
21+ uses : actions/checkout@v4
2022
2123 - name : Set up Python ${{ matrix.python }}
2224 uses : actions/setup-python@v5
Original file line number Diff line number Diff line change @@ -66,5 +66,5 @@ You can optionally run `sudo raspi-config` or the graphical Raspberry Pi Configu
6666Some of the examples have additional dependencies. You can install them with:
6767
6868``` bash
69- pip install
70- ```
69+ pip install -r requirements-examples.txt
70+ ```
Original file line number Diff line number Diff line change @@ -95,6 +95,14 @@ Press Ctrl+C to exit.
9595""" )
9696```
9797
98+ If your examples need additional dependencies, then list them in:
99+
100+ ```
101+ requirements-examples.txt
102+ ```
103+
104+ Otherwise, just delete this file to avoid unnecessarily prompting the user.
105+
98106## Install / Uninstall Scripts
99107
100108If your package directory (` PROJECT_NAME/ ` ) differs from your library name, you should update ` install.sh ` and ` uninstall.sh ` and hard-code the correct library name.
Original file line number Diff line number Diff line change @@ -166,6 +166,12 @@ function pip_pkg_install {
166166 check_for_error
167167}
168168
169+ function pip_requirements_install {
170+ # A null Keyring prevents pip stalling in the background
171+ PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $PYTHON -m pip install -r " $@ "
172+ check_for_error
173+ }
174+
169175while [[ $# -gt 0 ]]; do
170176 K=" $1 "
171177 case $K in
335341
336342printf " \n"
337343
344+ if [ -f " requirements-examples.txt" ]; then
345+ if confirm " Would you like to install example dependencies?" ; then
346+ inform " Installing dependencies from requirements-examples.txt..."
347+ pip_requirements_install requirements-examples.txt
348+ fi
349+ fi
350+
351+ printf " \n"
352+
338353# Use pdoc to generate basic documentation from the installed module
339354
340355if confirm " Would you like to generate documentation?" ; then
Original file line number Diff line number Diff line change 11[build-system ]
2- requires = [" hatchling" , " hatch-fancy-pypi-readme" ]
2+ requires = [" hatchling" , " hatch-fancy-pypi-readme" , " hatch-requirements-txt " ]
33build-backend = " hatchling.build"
44
55[project ]
66name = " PROJECT_NAME"
7- dynamic = [" version" , " readme" ]
7+ dynamic = [" version" , " readme" , " optional-dependencies " ]
88description = " __DESCRIPTION__"
99license = {file = " LICENSE" }
1010requires-python = " >= 3.7"
@@ -36,6 +36,9 @@ classifiers = [
3636]
3737dependencies = []
3838
39+ [tool .hatch .metadata .hooks .requirements_txt .optional-dependencies ]
40+ example-depends = [" requirements-examples.txt" ]
41+
3942[project .urls ]
4043GitHub = " https://www.github.com/pimoroni/PROJECT_NAME-python"
4144Homepage = " https://www.pimoroni.com"
@@ -48,7 +51,8 @@ include = [
4851 " PROJECT_NAME" ,
4952 " README.md" ,
5053 " CHANGELOG.md" ,
51- " LICENSE"
54+ " LICENSE" ,
55+ " requirements-examples.txt"
5256]
5357
5458[tool .hatch .build .targets .sdist ]
@@ -108,6 +112,6 @@ ignore = [
108112]
109113
110114[tool .pimoroni ]
111- apt_packages = [" git " ]
115+ apt_packages = []
112116configtxt = []
113- commands = [" false " ]
117+ commands = []
Original file line number Diff line number Diff line change 55twine
66hatch
77hatch-fancy-pypi-readme
8+ hatch-requirements-txt
89tox
910pdoc
You can’t perform that action at this time.
0 commit comments