| 1 | # Contributing to sedparse |
| 2 | |
| 3 | Please follow the usual GitHub workflow to contribute to this project: |
| 4 | |
| 5 | - Use [GitHub issues](https://github.com/aureliojargas/sedparse/issues) for bug reports and feature requests. |
| 6 | |
| 7 | - Use GitHub pull requests to submit code. |
| 8 | |
| 9 | |
| 10 | ## Development environment |
| 11 | |
| 12 | To create (and update in the future): |
| 13 | |
| 14 | python3 -m venv env |
| 15 | source env/bin/activate |
| 16 | pip install -r requirements-dev.txt |
| 17 | |
| 18 | To use it while developing: |
| 19 | |
| 20 | source env/bin/activate |
| 21 | |
| 22 | To leave it when done developing: |
| 23 | |
| 24 | deactivate |
| 25 | |
| 26 | More info at https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/ |
| 27 | |
| 28 | |
| 29 | ## Code check and formatting |
| 30 | |
| 31 | The sedparse code is checked by pylint and formatted by [black](https://github.com/psf/black), so make sure you run both after every change. |
| 32 | |
| 33 | Black is used with the default settings (no command line options) and the pylint configuration file is in the root of this repository. |
| 34 | |
| 35 | Just run them over the Python files: |
| 36 | |
| 37 | pylint *.py tests/*.py |
| 38 | black *.py tests/*.py |
| 39 | |
| 40 | or better yet, just run `ci.sh` after every change. |
| 41 | |
| 42 | |
| 43 | ## Testing |
| 44 | |
| 45 | Code is tested by the standard `unittest` and `doctest` Python modules, and full command lines are tested by [clitest](https://github.com/aureliojargas/clitest). |
| 46 | |
| 47 | The commands to run all of those are inside the [ci.sh](https://github.com/aureliojargas/sedparse/blob/master/ci.sh) script. Just run it locally after every change: |
| 48 | |
| 49 | ./ci.sh |
| 50 | |
| 51 | This script is also automatically executed by Travis CI for every new push to the repository. |
| 52 | |
| 53 | |
| 54 | ## Packaging |
| 55 | |
| 56 | To locally install (and uninstall) the package directly from this repository into the virtual env and test the `sedparse` executable: |
| 57 | |
| 58 | pip install -e . |
| 59 | pip uninstall sedparse |
| 60 | |
| 61 | To install the required software for the packaging: |
| 62 | |
| 63 | pip install -r requirements-pkg.txt |
| 64 | |
| 65 | To build and upload the packages: |
| 66 | |
| 67 | python3 setup.py sdist bdist_wheel |
| 68 | twine upload dist/* |