Table of Contents
- Table of Contents
$ pip install XComment
Use the project's CLI to interact with the script.
Say, you are working with the file ./tests/sources/HTML/index.html.
Precondition: virtualenv is activated (of course).
To remove comments (output code without comments to output file) invoke
$ comments_remover ./tests/sources/HTML/input.html HTML ./
This will take ./tests/sources/HTML/input.html, designated as HTML file, and put the copy of the former (with HTML-specific comments removed, obviously) to ./ named rc.input.html. The latter is the name of the original file prefixed with rc. by default.
To highlight comments (outputs comments only to output file) invoke
$ comments_remover ./tests/sources/HTML/input.html HTML -p ./
If on start been specified directory path, script will be processing directory recursively with all subdirs for sources by specified language.
For processing archived sources use option -a
$ # remove comments $ comments_remover ./tmp/test.zip -a Python $ # highlight comments $ comments_remover ./tmp/test.zip -a -p Python
-l option enable logging (in stdout by default)
-f < path > specify path to log file
$ comments_remover ./tmp/test.py -l -f ./remove.log Python
Get supported language list
For get list supported languages use -i option. Result list will returned in json format
To see full CLI specification, run
Getting Up-and-Running Locally
Tested with the following configuration:
- Ubuntu 16.04 / 17
- Python 3.6.
Note: the below occurences of `./` refer to the project root unless explicitly stated otherwise.
Setting Things Up on Ubuntu
Enter the shell.
Install pyenv via [pyenv-installer](https://github.com/pyenv/pyenv-installer):
Follow the instructions on how to initialize pyenv on shell startup, for instance:
Install Python 3.6.x via pyenv, say Python 3.6.2 (latest micro release versions are preferred):
Create a virtualenv for the project:
Switch to whatever directory you wish the project to reside in, say ~:
Switch to the project directory:
Activate the virtualenv:
Install project dependencies:
Install dependencies for testing:
(optional) Install [IPython](https://ipython.org/) interactive shell to speed up development:
To run tests, simply
$ pytest ./
To also see coverage report,
pytest --cov ./
You should be good to go now.
$ python install -r requirements-deploy.txt
Set pypi credentials
$ export TWINE_USERNAME=<pypi username> $ export TWINE_PASSWORD=<pypi password>
$ python setup.py sdist bdist_wheel
$ twine upload dist/XComment-x.y.z.tar.gz
If you're not using [PyCharm](https://www.jetbrains.com/pycharm/) yet, make sure to at least consider this as an option. Also check out [JetBrains Toolbox](https://www.jetbrains.com/toolbox/), a single tool to rule them all (the JetBrains products). To stay up-to-date, follow [PyCharm Blog](https://blog.jetbrains.com/pycharm/).
Design by Filip Todorov @ www.filiptodorov.com