intercreate / smpclient

Simple Management Protocol (SMP) Client for remotely managing MCU firmware
Apache License 2.0
5 stars 3 forks source link

Run wiki #17

Open eminach opened 1 month ago

eminach commented 1 month ago

Hello,

I am may be new to SMP things but I wasnt able to use this "client" at all first of all, "lint" or test" aren't recognized, alghouth I have runned env.ps1 without error, but I dont know why lint or test are not accessible.. I runned them manually

Secondly, I tried run mcuboot.py with arguments, no succes, no error.. Could you please provide sample run code?

Whould be nice If you can upgrade readme or Wiki page add more info

JPHutchins commented 1 month ago

Hi @eminach ! Let's start with the environment setup. One thing that occurs to me is that you say you ran env.ps1, but it should be sourced:

. ./envr.ps1

If lint and test aliases are still not working then it may be a problem with envr. What shell are you using?

Re: usage, I agree that some samples would be nice! To that end, I have this open PR that I should probably merge: https://github.com/intercreate/smpclient/pull/13

Take a look at some of the example scripts in that PR to get a feel for usage.

The little mcuboot CLI tool is provided by poetry, here: https://github.com/intercreate/smpclient/blob/9279cd7a6c5e27579552df88f8ff4dbe78b0e5ec/pyproject.toml#L15-L16

eminach commented 1 month ago

Thanks @JPHutchins I am using powershell and Windowst Terminal, same on both

JPHutchins commented 1 month ago

Excellent! This could be a PS5 vs PS7 situation. AFAIK, PS5, which is the default version, doesn’t support && syntax.

At any rate, envr should still be activating your .venv. If it’s not, you could activate .venv manually.

You can take a look at envr-default to see what the lint and test aliases are made up of and run the commands on their own.

If you’d rather not activate the venv, you can take advantage of poetry run.

JPHutchins commented 1 month ago

@eminach Has anything resolved your environment issues?

eminach commented 1 month ago

envr.ps1 runs without any warning or error, but same with PS7 lint is not recognized. I don't know what I need to "activate .venv manually" but I run lint under own commands (black --check . && isort --check-only . && flake8 . && mypy) see following output

All done! ✨ 🍰 ✨
26 files would be left unchanged.
Skipped 3 files
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Missing target module, package, files, or command.
JPHutchins commented 1 month ago

black --check . && isort --check-only . && flake8 . && mypy

This is missing the argument, ., for mypy, see envr-default.

envr provides a cross platform abstraction of shell environment setup. When you source envr, your shell will be prefixed with (smpclient) - is that working for you?

To use the venv directly, in Windows, do

. .venv/scripts/activate

Your prompt will be prefixed with (.venv)

You can also use poetry. "poetry shell" will open a sub shell with the venv activated. Or you can invoke for each command, eg poetry run pytest. I suggest the poetry documentation for details.

I think you may be running envr.ps1 instead of sourcing it, please confirm.