You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was coding a single-command tool in Bash to automate the building of virtual environments, with packages and sub-scripts, to integrate @enteropositivo's seedsigner Emulator and run Testing Suite for development tasks in separate Python vens.
Motivation:
Based on past discussions in the SeedSigner Telegram group (https://t.me/seedsigner_new_devs/9280) and the following PRs: #668 and #556, I have gained valuable insights that have shaped my approach to coding, testing, and reviewing. These experiences have helped me understand better practices and improve my contributions to the project.
The Goals were:
Using standard commands to make it easy to use a single .sh script to install customs venvs for each case, initially working on Debian/Ubuntu Linux and RaspberryPi OS.
Isolating each development job including writing/probing code, running tests, switch branches, packages, and Python versions in dedicated venvs to avoid to dirtying any Seedsigner clonned repo by constantly activating/desactivating these venvs.
To be a pre-draft for a future PR if be useful for better devs productivity on Seedsigner
Instructions:
You can test this script I've generically named /tools/dev-tool.sh included in my own fork. Clone the repository on dev-tool branch (fedebuyito/seedsigner@dev-tool https://github.com/fedebuyito/seedsigner/tree/dev-tool) and run the script as follows (from any folder, but ensure you are in the Seedsigner repo directory you are working on):
First argument (venv mode): dev (default) for working with the emulator and code, or test for running test suite.
Second argument (venv name): custom name will be installed in /src or /tests depending on whether dev or test mode is chosen.
Third argument (venv Python ver.): to specify version you want to work with/test (e.g. python3.10python 3.12), in case you have more than one installed on your system.
Example 1 (dev mode): All three arguments can be omitted with - mark as follows:
~/seedsigner $ ./tools/dev-tool.sh - - -
or simply,
~/seedsigner $ ./tools/dev-tool.sh
This will install a "dev mode" venv called DEV_VENV (with active Python version on your system), with the emulator and packages included. Then you only must to execute:
Done! (Don't forget to issue deactivate to exit the virtual environment when you finish your work)
Example 2 (test mode): You could to use the script for run test suite and to set a venv name.
~/seedsigner $ ./tools/dev-tool.sh test 311_VENV
This will install a "test mode" venv called 311_VENV, with packages and pip install -e . command included. So you only must to execute:
~/seedsigner $ source ./tests/311_VENV/bin/activate (to activate venv)
~/seedsigner $ ./tests/run_full_coverage.sh (to run the test suite)
Done! (Don't forget to issue deactivate to exit the virtual environment when you finish your work)
Example 3 (dev mode for custom Python version): If you have any alternatives Python version installed, you could execute:
~/seedsigner $ ./tools/dev-tool.sh dev - python3.12
And this will install a "dev mode" venv (called DEV_VENV, because name omitted with -) on 3.12 Python version, with the emulator and packages included, too. After that you only must to execute same two commands of example 1 (source DEV_VENV/bin/activate and python main.py) to run seedsigner on this environment (and deactivate when you are done)
.
Each time you want to exit from venv you are working on, simply execute: deactivate. On "dev mode" venv, you could to verify status of your Seesigner local repo was not altered (at least you has made some custom dev change) and only there are untracking files (from emulator):
You can check the repo status just after you activated venv, too:
And you will see how source files have seen "backuped" (see untracked and hidden .file.py) and provisional links (see typechange: file.py) to original ones have seen creating (being a safe emulator integration).
Note 2. Some results from my own tests and use of this tool:
Seems to works well on Kali GNU/Linux Rolling (live) 2024 (x86_64) and Raspi-OS Debian GNU/Linux 12 (bookworm) (Pi4B).
Emulator only works with Seedsigner 0.7.0 release on python3.10.
From version 0.8.5 (the latest release as of today), the emulator works with a minor fix included in this PR: Update renderer.py enteropositivo/seedsigner-emulator#13. Until this is merged (or bug fixed) script will clone that version from my repo.
Script aims to be simple and portable (as far as I have been able to test, only needs to use basic dependencies: e.g. git, rsync, python, venv).
Note 3. Missing:
Additional argument for custom package selection.
Refactor and translate everything into English, improve debugging.
Raspi-OS full integration for optional hardware selection (ST7789 module and/or picam).
Note 4. Possible future enhancements (the tool could become more complex):
Save changes (if there are any) on venv deactivation (for future recovery upon activation) and reset to original files from the repository.
Use external tools (e.g. pipenv, nix or poetry) to package reproducibility.
Note 5. This is a prototype or concept probe designed to make the developers' jobs easier and safer for this project. It would be helpful if anyone could test it on other platforms or Linux/Mac versions. Any suggestions, bugs or comments will be welcome.
Regards!
The text was updated successfully, but these errors were encountered:
./tools/dev-tool.sh fedebuyito/seedsigner@dev-tool https://github.com/fedebuyito/seedsigner/tree/dev-tool
Overview:
I was coding a single-command tool in Bash to automate the building of virtual environments, with packages and sub-scripts, to integrate @enteropositivo's seedsigner Emulator and run Testing Suite for development tasks in separate Python vens.
Motivation:
Based on past discussions in the SeedSigner Telegram group (https://t.me/seedsigner_new_devs/9280) and the following PRs: #668 and #556, I have gained valuable insights that have shaped my approach to coding, testing, and reviewing. These experiences have helped me understand better practices and improve my contributions to the project.
The Goals were:
Instructions:
You can test this script I've generically named
/tools/dev-tool.sh
included in my own fork. Clone the repository on dev-tool branch (fedebuyito/seedsigner@dev-tool https://github.com/fedebuyito/seedsigner/tree/dev-tool) and run the script as follows (from any folder, but ensure you are in the Seedsigner repo directory you are working on):Usage:
./tools/dev-tool.sh
(dev
/test
) (venv_name
) (python3.x
)First argument (venv mode): dev (default) for working with the emulator and code, or test for running test suite.
Second argument (venv name): custom name will be installed in /src or /tests depending on whether dev or test mode is chosen.
Third argument (venv Python ver.): to specify version you want to work with/test (e.g.
python3.10
python 3.12
), in case you have more than one installed on your system.Example 1 (dev mode): All three arguments can be omitted with
-
mark as follows:~/seedsigner $
./tools/dev-tool.sh - - -
or simply,
~/seedsigner $
./tools/dev-tool.sh
This will install a "dev mode" venv called DEV_VENV (with active Python version on your system), with the emulator and packages included. Then you only must to execute:
~/seedsigner/src $
source DEV_VENV/bin/activate
(to activate venv)~/seedsigner/src $
python main.py
(to run seedsigner)Done! (Don't forget to issue
deactivate
to exit the virtual environment when you finish your work)Example 2 (test mode): You could to use the script for run test suite and to set a venv name.
~/seedsigner $
./tools/dev-tool.sh test 311_VENV
This will install a "test mode" venv called 311_VENV, with packages and
pip install -e .
command included. So you only must to execute:~/seedsigner $
source ./tests/311_VENV/bin/activate
(to activate venv)~/seedsigner $
./tests/run_full_coverage.sh
(to run the test suite)Done! (Don't forget to issue
deactivate
to exit the virtual environment when you finish your work)Example 3 (dev mode for custom Python version): If you have any alternatives Python version installed, you could execute:
~/seedsigner $
./tools/dev-tool.sh dev - python3.12
And this will install a "dev mode" venv (called DEV_VENV, because name omitted with
-
) on 3.12 Python version, with the emulator and packages included, too. After that you only must to execute same two commands of example 1 (source DEV_VENV/bin/activate
andpython main.py
) to run seedsigner on this environment (anddeactivate
when you are done).
NOTES:
Note 1. Activating / Desactivating Virtual Environment:
Each time you want to exit from venv you are working on, simply execute:
deactivate
. On "dev mode" venv, you could to verify status of your Seesigner local repo was not altered (at least you has made some custom dev change) and only there are untracking files (from emulator):You can check the repo status just after you activated venv, too:
And you will see how source files have seen "backuped" (see untracked and hidden
.file.py
) and provisional links (seetypechange: file.py
) to original ones have seen creating (being a safe emulator integration).Note 2. Some results from my own tests and use of this tool:
Note 3. Missing:
Note 4. Possible future enhancements (the tool could become more complex):
Note 5. This is a prototype or concept probe designed to make the developers' jobs easier and safer for this project. It would be helpful if anyone could test it on other platforms or Linux/Mac versions. Any suggestions, bugs or comments will be welcome.
Regards!
The text was updated successfully, but these errors were encountered: