Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli.put: add --strip to remove comments and docstrings before copying #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikebentley15
Copy link

Description

This is a feature I've implemented on my fork and I've found it to be useful.

Since micropython does not provide functionality to print docstrings using the help() function, nor is there a clean way to edit files that have been copied to the device, the docstrings and comments are usually useless and taking up valuable space.

I like having docstrings and comments inside of the code I write for my own benefit and for the benefit of others reading my code. However, when copying the files to the device, I would like those things stripped out.

I wrote some basic functionality using the python ast library using functionality that was added to the standard library in Python 3.9. The premise of this implementation comes from

https://gist.github.com/phpdude/1ae6f19de213d66286c8183e9e3b9ec1

I implemented it in such a way that if the conversion fails for any reason, including using a version of python that does not have the ast.unparse() function, it will issue a warning and revert to copying the file without modification.

I will continue using my fork, but I want to contribute my changes upstream if you so desire.

@GuillaumeLeclerc
Copy link

Any reason this hasn't been merged ? this sounds critical for larger projects where:

  • Extensive documentation is very important
  • Flash Space becomes a scarce resource

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants