From b60de59bd687129325e203f6f6ab5f32b0738c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 21 Mar 2017 16:33:46 +0100 Subject: [PATCH 01/10] Preparing release 1.0.0 --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a3c05f02..a8a8083a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,7 +3,7 @@ Changelog This document describes changes between each past release. -1.0.0 (unreleased) +1.0.0 (2017-03-21) ------------------ - First release of the project. From c0651203c36796f2fd2032740011ea984fe737ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Mon, 20 Mar 2017 21:46:33 +0100 Subject: [PATCH 02/10] Update the README with the release process --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 30fd094b..009709bc 100644 --- a/README.rst +++ b/README.rst @@ -115,6 +115,7 @@ Install `zest.releaser`: - Merge remaining pull requests - Update ``CHANGELOG.rst`` +- Update :file:`CONTRIBUTORS`. - Update known good versions of dependencies in ``requirements.txt`` with this command (from inside the venv): .. code-block:: bash From a354973f1f9c2dd602a4c28e90540fdbf4020064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 21 Mar 2017 15:06:36 +0100 Subject: [PATCH 03/10] Change the README again --- README.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/README.rst b/README.rst index 009709bc..827eab46 100644 --- a/README.rst +++ b/README.rst @@ -114,7 +114,6 @@ Install `zest.releaser`: $ pip install "zest.releaser" - Merge remaining pull requests -- Update ``CHANGELOG.rst`` - Update :file:`CONTRIBUTORS`. - Update known good versions of dependencies in ``requirements.txt`` with this command (from inside the venv): From d1facecc69e3a2638b508b4120094873cdb7bcf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 21 Mar 2017 15:08:42 +0100 Subject: [PATCH 04/10] Create a Makefile to ease development --- Makefile | 39 ++++++++++++++++++++ Procfile | 1 - README.rst | 40 +++++++++------------ budget/run.py | 4 ++- dev-requirements.txt | 1 + fabfile.py | 13 ------- budget/requirements.txt => requirements.txt | 0 7 files changed, 60 insertions(+), 38 deletions(-) create mode 100644 Makefile delete mode 100644 Procfile create mode 100644 dev-requirements.txt delete mode 100644 fabfile.py rename budget/requirements.txt => requirements.txt (100%) diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..cb2a1c7f --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +VIRTUALENV = virtualenv --python=python3 +SPHINX_BUILDDIR = docs/_build +VENV := $(shell echo $${VIRTUAL_ENV-.venv}) +PYTHON = $(VENV)/bin/python3 +DEV_STAMP = $(VENV)/.dev_env_installed.stamp +DOC_STAMP = $(VENV)/.doc_env_installed.stamp +INSTALL_STAMP = $(VENV)/.install.stamp +TEMPDIR := $(shell mktemp -d) + +all: install +install: $(INSTALL_STAMP) +$(INSTALL_STAMP): + $(VENV)/bin/pip install -U pip + $(VENV)/bin/pip install -r requirements.txt + touch $(INSTALL_STAMP) + +virtualenv: $(PYTHON) +$(PYTHON): + $(VIRTUALENV) $(VENV) + +install-dev: $(INSTALL_STAMP) $(DEV_STAMP) +$(DEV_STAMP): $(PYTHON) dev-requirements.txt + $(VENV)/bin/pip install -Ur dev-requirements.txt + touch $(DEV_STAMP) + +serve: $(INSTALL_STAMP) + cd budget; ../$(PYTHON) run.py + +test: $(DEV_STAMP) + cd budget; ../$(PYTHON) tests.py + +release: $(DEV_STAMP) + $(VENV)/bin/fullrelease + +build-requirements: + $(VIRTUALENV) $(TEMPDIR) + $(TEMPDIR)/bin/pip install -U pip + $(TEMPDIR)/bin/pip install -Ue "." + $(TEMPDIR)/bin/pip freeze | grep -v -- '-e' > requirements.txt diff --git a/Procfile b/Procfile deleted file mode 100644 index d147525f..00000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: python budget/run.py diff --git a/README.rst b/README.rst index 827eab46..02e8be50 100644 --- a/README.rst +++ b/README.rst @@ -16,13 +16,9 @@ LICENSE for more details). Make it run! ============ -To make it run, you just have to do something like:: +To make it run, you just have to do use the serve command:: - $ virtualenv venv - $ source venv/bin/activate - $ pip install -r budget/requirements.txt - $ cd budget - $ python run.py + $ make serve It is also better to actually turn the debugging mode on when you're developing. You can create a `settings.py` file in the `budget` directory, with @@ -37,11 +33,7 @@ You can also set the `TESTING` flag to `True` so no mails are sent Deploy it ========= -To deploy it, I'm using gunicorn and supervisord:: - - $ virtualenv venv - $ source venv/bin/activate - $ pip install -r requirements.txt +To deploy it, I'm using gunicorn and supervisord. 1. Add the lines in conf/supervisord.conf to your supervisord.conf file. **adapt them to your paths!** @@ -58,9 +50,8 @@ e.g: APPLICATION_ROOT='/budget' - -How about the REST API? -======================= +The REST API? +============= Yep, you're right, there is a REST API with this. Head to the `api documentation `_ to know more. @@ -68,22 +59,22 @@ documentation `_ to know m How to contribute ================= +You would like to contribute? First, thanks a bunch! This project is a small +project with just a few people behind it, so any help is appreciated! + There are different ways to help us, regarding if you are a designer, -a developer or just an user. +a developer or an user. As a developer -------------- -The best way to contribute code is to write it and to make a pull request on +If you want to contribute code, you can write it and then issue a pull request on github. Please, think about updating and running the tests before asking for a pull request as it will help us to maintain the code clean and running. To do so:: - $ workon budget - (budget) $ python tests.py - -before pushing anything to master :) + $ make tests As a designer / Front-end developer ----------------------------------- @@ -95,9 +86,12 @@ know how to implement them, feel free to fork and make a pull request. End-user -------- -You just wanted to have a look at the application and found a bug? Please tell -us and go fill a new issue: -https://github.com/spiral-project/ihatemoney/issues +You are using the application and found a bug? You have some ideas about how to +improve the project? Please tell us [by filling a new issue](https://github.com/spiral-project/ihatemoney/issues). +Or, if you prefer, you can send me an email to `alexis@notmyidea.org` and I will +update the issue tracker with your feedback. + +Thanks again! How to release? =============== diff --git a/budget/run.py b/budget/run.py index f006ae91..9745b60f 100644 --- a/budget/run.py +++ b/budget/run.py @@ -1,4 +1,5 @@ import os +import os.path import warnings from flask import Flask, g, request, session @@ -11,6 +12,7 @@ from api import api from utils import PrefixedWSGI from utils import minimal_round +__HERE__ = os.path.dirname(os.path.abspath(__file__)) app = Flask(__name__) @@ -65,7 +67,7 @@ if pre_alembic_db(): # auto-execute migrations on runtime with app.app_context(): - upgrade() + upgrade(os.path.join(__HERE__, 'migrations')) # mail mail.init_app(app) diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 00000000..a7fbb05b --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1 @@ +zest.releaser diff --git a/fabfile.py b/fabfile.py deleted file mode 100644 index 7e717391..00000000 --- a/fabfile.py +++ /dev/null @@ -1,13 +0,0 @@ -from fabric.api import env, cd, sudo, run - -env.hosts = ['sites.lolnet.lan'] - - -def deploy(): - with cd('/home//www/ihatemoney.org/code'): - sudo('git pull', user="www-data") - sudo('supervisorctl restart ihatemoney.org') - - -def whoami(): - run('/usr/bin/whoami') diff --git a/budget/requirements.txt b/requirements.txt similarity index 100% rename from budget/requirements.txt rename to requirements.txt From 3953b70c03e8c0774f827f398723612ec457f744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 21 Mar 2017 15:25:51 +0100 Subject: [PATCH 05/10] Update the .gitignore file --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 35e8b939..8fba382c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ budget/memory budget/settings.py *.pyc *.egg-info -dist .venv From 2d0c85e0e6252ca9b7a9146f791b224f3338a01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 21 Mar 2017 17:12:03 +0100 Subject: [PATCH 06/10] Update requirements.txt location --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ab4eba6..e0b809a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,6 @@ python: - "2.7" - "3.5" # command to install dependencies -install: "pip install -r budget/requirements.txt" +install: "pip install -r requirements.txt" # command to run tests script: cd budget && python tests.py From 08a493556642f7dd19ad48b1f7c40fe4ac607236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 28 Mar 2017 17:48:41 +0200 Subject: [PATCH 07/10] Update the README with makefile changes --- .gitignore | 1 + README.rst | 22 +++++++--------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 8fba382c..35e8b939 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ budget/memory budget/settings.py *.pyc *.egg-info +dist .venv diff --git a/README.rst b/README.rst index 02e8be50..5b7bb4d0 100644 --- a/README.rst +++ b/README.rst @@ -96,29 +96,21 @@ Thanks again! How to release? =============== -In order to prepare a new release, we are following the following steps. +In order to prepare a new release, we are following the following steps: -The `fullrelease` command comes from `zest.releaser -`_. - -Install `zest.releaser`: - -.. code-block:: bash - - $ pip install "zest.releaser" - -- Merge remaining pull requests -- Update :file:`CONTRIBUTORS`. +- Merge remaining pull requests; +- Update :file:`CHANGELOG.rst` with the last changes; +- Update :file:`CONTRIBUTORS`; - Update known good versions of dependencies in ``requirements.txt`` with this command (from inside the venv): .. code-block:: bash $ pip freeze | grep -v -- '-e' > requirements.txt -Once this is done, use the "fullrelease" command: +Once this is done, use the "release" instruction: .. code-block:: bash - $ fullrelease + $ make release -That's all folks! +And the new version should be published on PyPI. From 42c9af528fc9779451c1ad7528648ab6f6e12193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 21 Mar 2017 17:09:53 +0100 Subject: [PATCH 08/10] Add tox support. --- .gitignore | 4 ++++ Makefile | 2 +- dev-requirements.txt | 1 + docs/requirements.txt | 3 +++ tox.ini | 20 ++++++++++++++++++++ 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 docs/requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 35e8b939..cb78e40b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ budget/budget.db +budget.db budget/memory budget/settings.py *.pyc *.egg-info dist .venv +docs/_build/ +.tox +dist diff --git a/Makefile b/Makefile index cb2a1c7f..1ac7e197 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ serve: $(INSTALL_STAMP) cd budget; ../$(PYTHON) run.py test: $(DEV_STAMP) - cd budget; ../$(PYTHON) tests.py + $(VENV)/bin/tox release: $(DEV_STAMP) $(VENV)/bin/fullrelease diff --git a/dev-requirements.txt b/dev-requirements.txt index a7fbb05b..0bbb0aa0 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1 +1,2 @@ zest.releaser +tox diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..8982892c --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,3 @@ +docutils<0.13 +Sphinx +sphinx_rtd_theme diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..d15f51b5 --- /dev/null +++ b/tox.ini @@ -0,0 +1,20 @@ +[tox] +envlist = py35,py27,docs +skip_missing_interpreters = True + +[testenv] + +passenv = TRAVIS +commands = + python --version + python budget/tests.py +deps = + -rdev-requirements.txt + -rrequirements.txt + +install_command = pip install --pre {opts} {packages} + +[testenv:docs] +commands = sphinx-build -a -n -b html -d docs/_build/doctrees docs docs/_build/html +deps = + -rdocs/requirements.txt From 9e30f3bb99f6f833b0afe7d3513bc3dc4498cd74 Mon Sep 17 00:00:00 2001 From: Jocelyn Delalande Date: Tue, 28 Mar 2017 20:04:57 +0200 Subject: [PATCH 09/10] Make travis use tox So that we are consistent between dev test env and CI test env. The use of `TOXENV` is to keep travis running the several envs in parallel. --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index e0b809a5..8536228e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: python -python: - - "2.7" - - "3.5" -# command to install dependencies -install: "pip install -r requirements.txt" -# command to run tests -script: cd budget && python tests.py +script: tox +install: + - pip install tox +env: + - TOXENV=py27 + - TOXENV=py35 + - TOXENV=docs From aaf9f9f23754dd97af0dc9daa5215d42f8017d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 28 Mar 2017 20:25:23 +0200 Subject: [PATCH 10/10] @JocelynDelalande's review --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index d15f51b5..8fc8cbb1 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,6 @@ skip_missing_interpreters = True [testenv] -passenv = TRAVIS commands = python --version python budget/tests.py