From cec9bf3755e9cbf0f078d86268392267727db2c5 Mon Sep 17 00:00:00 2001 From: HacKan Date: Mon, 5 Feb 2018 23:45:18 -0300 Subject: [PATCH] Add contributing section in DEVELOPERS Add new makefile command: devenvironment. --- DEVELOPERS.md | 12 ++++++++++-- Makefile | 16 ++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index d5357a1..bfc38ab 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -2,7 +2,13 @@ [![Ballmer "developers!"](https://passh.hackan.net/img/developers.png)](http://www.youtube.com/watch?v=V-FkalybggA "Developers") -This guide is intended for developers that want to implement **Passphrase** in their projects. +This guide is intended for developers that want to implement **Passphrase** in their projects or that want to contribute to this project. + +## Contributing + +If you want to develope or contribute to this project, you can quickly start by issuing `make devenvironment`: it creates a virtualenv directory and installs requirements and the *Passphrase* package. This is, of course, not mandatory. + +Every contribution must be acompanied by it's tests. As a general guideline, follow PEP8 (flake8 must run without warnings) and prefer Exceptions over assumptions. Try hard on not to add dependencies: I'm going to reject PRs with external dependencies that are not entirely justified (and for this project in particular, having 0 dependencies is very important). ## About the package @@ -27,7 +33,9 @@ my_async_sleep(pause_sec(1, 5)) Of course, you can't just pause the whole server, or let the user hanging there for some seconds... or maybe, you can. I let you decide how to solve it. Another, even better, way to solve this is to provide the system for a secure external random source, such as a randomness generator like Chaoskey. -## Requirements +If you are using a Linux OS, you can use `Aux::system_entropy()` to determine how much entropy does your system have prior making a request for random data (**Passphrase** does this when runs as a script). You should always have more than 128 bits or the call to `os.urandom()` might hang or fail. + +### Requirements * **Python 3.5+**. * [Flake8](http://flake8.pycqa.org/en/latest/) [optional] for linting. diff --git a/Makefile b/Makefile index b36dc77..6f2ea89 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ TMPDIR := $(shell mktemp -d --tmpdir "passphrase.XXXXXXXXXX") all: @echo "Passphrase by HacKan (https://hackan.net)" @echo "Commands for this makefile:" - @echo -e "\tinstall\n\taltinstall\n\tuninstall\n\taltuninstall\n\tpackage-install\n\tpackage-uninstall\n\tlint\n\ttest\n\tcoverage\n\ttimeit\n\tclean" + @echo -e "\tinstall\n\taltinstall\n\tuninstall\n\taltuninstall\n\tpackage-install\n\tpackage-uninstall\n\tdevenvironment\n\tlint\n\ttest\n\tcoverage\n\ttimeit\n\tclean" clean: @rm -vrf \ @@ -85,4 +85,16 @@ coverage: timeit: python3 -m timeit -n 100 -r 10 -s 'import os' 'os.system("python3 -m passphrase -w6 -m")' -.PHONY: install altinstall uninstall altuninstall lint test coverage timeit clean +devenvironment: + @echo "Creating virtualenv" + @[ -d venv ] || virtualenv -p python3 venv + @echo "Installing dev dependencies" + venv/bin/pip install -r requirements-dev.txt + @echo "Installing passphrase" + @venv/bin/python3 setup.py --fullname + @venv/bin/python3 setup.py --description + @venv/bin/python3 setup.py --url + venv/bin/python3 setup.py install + @echo -e '\nAll done. You might want to activate the virtualenv (I can not do it for you): `source venv/bin/activate`' + +.PHONY: install altinstall uninstall altuninstall lint test coverage timeit clean devenvironment