pyscript-cli icon indicating copy to clipboard operation
pyscript-cli copied to clipboard

Support for Automatic <py-env> with dependency + few tweaks to contributing and readme docs

Open leriomaggio opened this issue 1 year ago • 12 comments

This PR finalises the new pyscript-cli features developed during the last hack-days.

In particular, the new features this PR brings are:

  • support for automatic analysis of code dependencies (i.e. imports) which will be then injected into a <py-env> tag in the html template.
    • both packages and (local) modules are supported - resulting in paths as per PyScript naming.
    • Unsupported imports and packages (e.g. packages not supported by Pyodide) are also detected, with a WARNING raised to signal that resulting code may not work.
  • now both Python files (.py) and Notebooks (.ipynb) could be passed in as input and converted.
    • so far notebooks are merely converted into Python files before being processed.

Note: from hack-days version, this code has been merged and aligned to support the new plugin-hook design/feature, plus - more importantly - a few tests for the new features have been included. On this note, a quick refactoring has been done to test_cli to include fixtures for code, with relatively simple injectable dependencies.

Other changes in this PR concerns:

  • improved CONTRIBUTING.md documentation providing instructions on how to setup dev environment (not just for docs)
    • on this note, poetry dependencies have been revised and updated, including pre-commit as dependency, with instructions in the main doc on how to install hooks.
  • added line in README.md to showcase input code from both python and notebooks files.

leriomaggio avatar Sep 07 '22 15:09 leriomaggio