XComment
Table of Contents
-
Table of Contents
Installation
$ pip install XComment
Usage
Use the project’s CLI to interact with the script.
Processing files
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
`shell $ 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 ./
Processing directories
If on start been specified directory path, script will be processing directory recursively with all subdirs for sources by specified language.
Archives
For processing archived sources use option -a
Examples:
$ # remove comments
$ comments_remover ./tmp/test.zip -a Python
$ # highlight comments
$ comments_remover ./tmp/test.zip -a -p Python
Logging
-l option enable logging (in stdout by default)
-f < path > specify path to log file
Example:
$ 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
$ comments_remover -i
["PHP", "Python", "CSS", "HTML", "JavaScript", "ActionScript", "Ruby",
"Assembly", "AppleScript", "Bash", "CSharp", "VB", "XML", "SQL", "C"]
To see full CLI specification, run
$ comments_remover
Development
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):
$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bashFollow the instructions on how to initialize pyenv on shell startup, for instance:
$ echo 'export PATH="/root/.pyenv/bin:$PATH"' >> ~/.bash_profile $ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile $ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profileInstall Python 3.6.x via pyenv, say Python 3.6.2 (latest micro release versions are preferred):
$ pyenv install 3.6.2Create a virtualenv for the project:
$ pyenv virtualenv 3.6.2 comments_removerSwitch to whatever directory you wish the project to reside in, say ~:
$ cd ~- Clone the project from GitHub:
either via SSH (the preferred way):
$ git clone git@github.com:Singapore-Tech-Entrepreneurs/comments_remover.gitor via HTTPS:
$ git clone https://github.com/Singapore-Tech-Entrepreneurs/comments_remover.git
Switch to the project directory:
$ cd comments_removerActivate the virtualenv:
$ pyenv activate comments_removerInstall project dependencies:
$ pip install -U -r ./requirements.txtInstall dependencies for testing:
$ pip install -U -r ./requirements-test.txt(optional) Install [IPython](https://ipython.org/) interactive shell to speed up development:
$ pip install ipython==6.1.0
To run tests, simply
$ pytest ./
To also see coverage report,
pytest --cov ./
You should be good to go now.
Deployment
Pip registry
Install dependencies
$ python install -r requirements-deploy.txt
Set pypi credentials
$ export TWINE_USERNAME=<pypi username>
$ export TWINE_PASSWORD=<pypi password>
Create distribution
$ python setup.py sdist bdist_wheel
Upload
$ twine upload dist/XComment-x.y.z.tar.gz
Tips
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/).
Metadata
Release files for XComment 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| XComment-0.0.2.tar.gz | 9.6 kB | Without provenance | Details for XComment-0.0.2.tar.gz |
Release files / XComment-0.0.2.tar.gz
| Download URL | XComment-0.0.2.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f57bd7c3c89cef8a6a4b1393e6c18b24370b9db8a282659a10d460029e33c0d0
|
|
BLAKE2b-256 checksum How to use checksums |
e86a4adb8946005950baf270e7b86559ea5a847987925596b10490e8692a6fd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for XComment 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.