modm-io / modm

modm: a C++23 library generator for AVR and ARM Cortex-M devices
https://modm.io
Mozilla Public License 2.0
748 stars 132 forks source link

Fix python syntax in modm_tools #1189

Closed rleh closed 1 month ago

rleh commented 3 months ago

With recent python versions there are a lot of warnings (DeprecationWarning until python 3.11, SyntaxWarning from version 3.12 onwards) generated from the modm_tools python code:

$ scons
scons: Reading SConscript files ...
/...blink/modm/modm_tools/bmp.py:13: SyntaxWarning: invalid escape sequence '\*'
  """
/.../blink/modm/modm_tools/build_id.py:13: SyntaxWarning: invalid escape sequence '\*'
[...]

Is it necessary to adapt the way this doc strings are extracted form the python files, @salkinium? I don't know where exactly that happens...

salkinium commented 3 months ago

These docs are assembled here: https://github.com/modm-io/modm/blob/23f64ca4dda59484f73df8128ca701e7ea5503d5/tools/build_script_generator/module.lb#L20-L43

Best check with lbuild discover -n :build if the * star is still displayed correctly. I forgot that doesn't do any formatting, so it'll display \*. 🤦

salkinium commented 3 months ago

Hm, I don't know, the homepage built test shows that the * star is also rendered \*.

calebchalmers commented 2 months ago

Could you simply remove the slashes and put (* *only ...*) in the doc strings? I believe the first asterisk will be preserved in markdown because of the space after it.

rleh commented 1 month ago

Using raw string seems to work fine:

Comparison screenshots 🖼️ 🖼️ ![image](https://github.com/user-attachments/assets/f4553f1b-d07c-49b7-9d78-f95a365efd85) ![image](https://github.com/user-attachments/assets/16d5b9ac-c2ed-4806-a351-2723b3e99b84)