====wikiBASS Wikibase demo====
[[projects:wikibass#wikibass|wikiBASS]] is a [[tools:wikibase|Wikibase]] demo program that creates a [[:tools:wikibase|Wikibase]] of
STM32 microcontroller development boards and their microcontrollers.
WikiBASS requires [[tools:stm32#stm32cubemx|STM32CubeMX]] to be installed in order to gather board information from its XML files. wikiBASS will also scrape additional information with [[:tools:selenium|Selenium]] Chrome/chromium automation.
If you do not have access to a [[tools:wikibase|Wikibase]] server then install [[:tools:mediawiki|Mediawiki]] with the [[tools:wikibase|Wikibase]] extension.
===Setup===
==Debian==
sudo apt install python3-full mercurial
hg clone https://hg.kewl.org/pub/wikiBASS
cd wikiBASS
Setup virtual environment
python3 -m venv ~/.venvs/wikiBASS
Activate virtual environment (TCSH)
source ~/.venvs/wikiBASS/bin/activate.csh
Install dotenv
python -m pip install dotenv
NB Adding dotenv as a pyproject dependency in the virtual environment does not work.
==Windows==
Install [[https://www.python.org/ftp/python/3.13.2/python-3.13.2-amd64.exe|Python 3.13.2 for Windows AMD64]]
Download the tip [[https://hg.kewl.org/pub/wikiBASS/archive/tip.tar.gz|archive]] and extract.
cd wikiBASS
Install requirements.
python -m pip install lxml
python -m pip install beautifulsoup4
python -m pip install "WikibaseIntegrator>=0.12"
python -m pip install selenium
python -m pip install python-dotenv
==WSL1==
For WSL1, [[:tools:selenium|Selenium]] chrome automation will require Python for Windows.
Follow the instructions for Windows above and add an alias to run wikiBASS from within
WSL1 using the Windows installation of Python.
`username' below is your Windows login
__TCSH__
alias py "/mnt/c/Users/username/AppData/Local/Programs/Python/Python313/python.exe"
bash
__BASH__
alias py="/mnt/c/Users/username/AppData/Local/Programs/Python/Python313/python.exe"
Later you may invoke the script with
py stm32.py
===Chrome===
[[tools:selenium|Selenium]] depends on chrome.exe on Windows or chromium on Linux.
==Debian==
sudo apt install chromium
==Windows==
[[https://www.google.com/intl/en_uk/chrome/|Install]]
===STM32CubeMX ===
Install [[tools:stm32#stm32cubemx|STM32CubeMX]] from st.com.
Take note of the installation directory.
===Configure===
In order to update [[tools:mediawiki|Mediawiki]] and [[tools:wikibase|Wikibase]] using automation, a [[tools:mediawiki|Mediawiki]] bot needs to be configured.
Login and visit the bot creation page to create a bot username. When a username is created a bot password is automatically generated.
Bot creation is found under Tools -> Special pages -> Account management -> Bot passwords.
Once the bot is setup you must then configure the wikiBASS environment.
Rename `dotenv' to `.env' and edit appropriately.
WB_URL="https://mediawiki.example.com/"
WB_USERNAME="username"
WB_PASSWORD="botpass"
STM32CUBEMX="c:/Program Files/STMicroelectronics/STM32Cube/STM32CubeMX"
STM32CUBEMX points to the installation directory which is probably the above on Windows.
The .env file must be found in the current directory to be used by the script when it is called.
For Debian shells the environment variables can be placed within the
login profile instead of the .env file.
=== Install ====
==Debian==
Installation downloads the pyproject requirements and installs the wikiBASS module
as a script in the virtual environment directory.
make install
==Windows/WSL1==
Installation is not necessary and the script is run from the install directory.
=== Run ===
Building the demo [[:tools:wikibase|Wikibase]] is comprised of running the script three times to perform three distinct operations.
- Parse XML board files
- Scrape board schematics
- Scrape chip datasheets
Step one to parse the XML board files must be performed first.
You can analyse the script [[https://hg.kewl.org/pub/wikiBASS/file/tip/src/wikiBASS/stm32.py|here]].
==Debian==
In Debian the script is run from within the virtual environment.
stm32 xml
stm32 board
stm32 chip
==Windows/WSL1==
For Windows and WSL1 the script is run from the installation
directory.
py src/wikiBASS/stm32.py xml
py src/wikiBASS/stm32.py board
py src/wikiBASS/stm32.py chip
===Demo===
Visit the demo [[https://mediawiki.kewl.org/wiki/Item:Q1|site]] to navigate the board root.