Skip to content

Commit 0f55d25

Browse files
committedDec 18, 2020
Use Poetry for dependencies management of docs script
Poetry is already in use for the integration testing code, so it makes sense to use it with all Python code in the repository.
1 parent d269218 commit 0f55d25

File tree

8 files changed

+509
-61
lines changed

8 files changed

+509
-61
lines changed
 

‎.github/workflows/check-links.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ jobs:
5050
restore-keys: |
5151
${{ runner.os }}-pip-
5252
53-
- name: Install Python dependencies
53+
- name: Install Poetry
5454
run: |
5555
python -m pip install --upgrade pip
56-
python -m pip install --requirement "${{ env.DOCUMENTATION_REQUIREMENTS_PATH }}"
56+
python -m pip install poetry
5757
5858
- name: Build documentation website
5959
# Ensure the documentation can build. These docs won't be published.

‎.github/workflows/publish-docs.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ jobs:
3737
needs: publish-determination
3838
if: needs.publish-determination.outputs.result == 'true'
3939

40-
env:
41-
DOCUMENTATION_REQUIREMENTS_PATH: ./docs/requirements_docs.txt
42-
4340
steps:
4441
- name: Checkout local repository
4542
uses: actions/checkout@v2
@@ -64,14 +61,17 @@ jobs:
6461
uses: actions/cache@v2
6562
with:
6663
path: ~/.cache/pip
67-
key: ${{ runner.os }}-pip-${{ hashFiles(env.DOCUMENTATION_REQUIREMENTS_PATH) }}
64+
key: ${{ runner.os }}-pip-${{ hashFiles('./pyproject.toml') }}
6865
restore-keys: |
6966
${{ runner.os }}-pip-
7067
71-
- name: Install Python dependencies
68+
- name: Install Poetry
7269
run: |
7370
python -m pip install --upgrade pip
74-
python -m pip install --requirement "${{ env.DOCUMENTATION_REQUIREMENTS_PATH }}"
71+
python -m pip install poetry
72+
73+
- name: Install Python dependencies
74+
run: poetry install --no-root
7575

7676
- name: Publish documentation
7777
# Determine docs version for the commit pushed and publish accordingly using Mike.
@@ -80,4 +80,4 @@ jobs:
8080
git config --global user.email "bot@arduino.cc"
8181
git config --global user.name "ArduinoBot"
8282
git fetch --no-tags --prune --depth=1 origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages
83-
python docs/build.py
83+
poetry run python docs/build.py

‎.github/workflows/validate-docs.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ jobs:
2323
validate:
2424
runs-on: ubuntu-latest
2525

26-
env:
27-
DOCUMENTATION_REQUIREMENTS_PATH: ./docs/requirements_docs.txt
28-
2926
steps:
3027
- name: Checkout local repository
3128
uses: actions/checkout@v2
@@ -50,14 +47,14 @@ jobs:
5047
uses: actions/cache@v2
5148
with:
5249
path: ~/.cache/pip
53-
key: ${{ runner.os }}-pip-${{ hashFiles(env.DOCUMENTATION_REQUIREMENTS_PATH) }}
50+
key: ${{ runner.os }}-pip-${{ hashFiles('./pyproject.toml') }}
5451
restore-keys: |
5552
${{ runner.os }}-pip-
5653
57-
- name: Install Python dependencies
54+
- name: Install Poetry
5855
run: |
5956
python -m pip install --upgrade pip
60-
python -m pip install --requirement "${{ env.DOCUMENTATION_REQUIREMENTS_PATH }}"
57+
python -m pip install poetry
6158
6259
- name: Build documentation website
6360
# Ensure the documentation can build. These docs won't be published.

‎Taskfile.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,20 @@ tasks:
131131
desc: Build documentation website contents
132132
cmds:
133133
- task: docs:gen
134-
- mkdocs build --strict
134+
- poetry install --no-root
135+
- poetry run mkdocs build --strict
135136

136137
docs:publish:
137138
desc: Use Mike to build and push versioned docs
138139
cmds:
139140
- task: docs:gen
140-
- mike deploy --update-aliases --push --remote {{.DOCS_REMOTE}} {{.DOCS_VERSION}} {{.DOCS_ALIAS}}
141+
- poetry run mike deploy --update-aliases --push --remote {{.DOCS_REMOTE}} {{.DOCS_VERSION}} {{.DOCS_ALIAS}}
141142

142143
docs:serve:
143144
desc: Run documentation website locally
144145
cmds:
145146
- task: docs:build
146-
- mkdocs serve
147+
- poetry run mkdocs serve
147148

148149
docs:check:
149150
desc: Lint and check formatting of documentation files

‎docs/CONTRIBUTING.md

+5-28
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ To build arduino-lint from sources you need the following tools to be available
7878
- [Go](https://golang.org/doc/install) version 1.14 or later
7979
- [Taskfile](https://taskfile.dev/#/installation) to help you run the most common tasks from the command line
8080

81-
If you want to run integration tests you will also need:
81+
If you want to run integration tests or work on documentation, you will also need:
8282

83-
- A working [Python](https://www.python.org/downloads/) environment, version 3.8 or later
83+
- A working [Python](https://www.python.org/downloads/) environment, version 3.8 or later.
84+
- [Poetry](https://python-poetry.org/docs/).
8485

8586
### Building the source code
8687

@@ -146,22 +147,6 @@ input and providing the expected output and proper exit codes.
146147
For these reasons, in addition to regular unit tests the project has a suite of integration tests that actually run
147148
arduino-lint in a different process and assess the options are correctly understood and the output is what we expect.
148149

149-
##### Software requirements for running integration tests:
150-
151-
A working Python environment. Chances are that you already have Python installed in your system, if this is not the case
152-
you can [download](https://www.python.org/downloads/) the official distribution or use the package manager provided by
153-
your Operating System.
154-
155-
Some dependencies need to be installed before running the tests. To avoid polluting your global Python environment with
156-
dependencies that might be only used by the arduino-lint integration tests, we use [Poetry](https://python-poetry.org/).
157-
First you need to install it (you might need to `sudo` the following command):
158-
159-
```
160-
pip3 install --user poetry
161-
```
162-
163-
For more Poetry installation options read the [official documentation](https://python-poetry.org/docs/).
164-
165150
##### Running tests
166151

167152
After the software requirements have been installed, you should be able to run the tests with:
@@ -242,16 +227,8 @@ The documentation consists of static content written over several Markdown files
242227
arduino-lint repository, as well as the dynamically generated [command line reference](commands/arduino-lint.md).
243228

244229
When working on the documentation, it is useful to be able to see the effect the changes will have on the generated
245-
documentation website. You can build the documentation website and serve it from your personal computer.
246-
247-
Before running the toolchain, run the following command from the root of the Git repository (if you have a Python
248-
virtual environment, activate it before proceeding):
249-
250-
```
251-
pip install -r docs/requirements_docs.txt
252-
```
253-
254-
Now run the command:
230+
documentation website. You can build the documentation website and serve it from your personal computer by running the
231+
command:
255232

256233
```
257234
task docs:serve

‎docs/requirements_docs.txt

-6
This file was deleted.

0 commit comments

Comments
 (0)