diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | Pipfile | 12 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | docs/contributing.md | 84 | ||||
-rw-r--r-- | requirements.txt | 3 |
6 files changed, 109 insertions, 5 deletions
@@ -1,3 +1,7 @@ *.pyc .cache/ *.sublime-* + +# Ignore pipenv's lockfile until support for multiple versions of python is +# dropped +/Pipfile.lock diff --git a/.travis.yml b/.travis.yml index bf69238..5b43ff3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,8 @@ python: cache: pip install: - - pip install flake8 pytest websocket-client + - pip install pipenv + - pipenv install --dev --system before_script: # stop the build if there are Python syntax errors or undefined names @@ -15,7 +16,7 @@ before_script: - flake8 . --exit-zero --select=C,E,F,W script: - - python -m pytest + - pytest notifications: irc: "chat.freenode.net#wee-slack-dev" @@ -0,0 +1,12 @@ +[[source]] +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +websocket-client = "*" + +[dev-packages] +mock = "*" +pytest = "*" +flake8 = "*" @@ -8,6 +8,7 @@ A WeeChat native client for Slack.com. Provides supplemental features only avail Table of Contents ----------------- * [Features](#features) + * [Contributing](#contributing) * [Dependencies](#dependencies) * [Setup](#setup) * [1. Install dependencies](#1-install-dependencies) @@ -58,6 +59,11 @@ Features * Expands/shows metadata for things like tweets/links * *Super fun* debug mode. See what the websocket is saying +Contributing +------------ + +See [docs/contributing.md](./docs/contributing.md). + Dependencies ------------ * WeeChat 1.3+ http://weechat.org/ diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 0000000..24deaf6 --- /dev/null +++ b/docs/contributing.md @@ -0,0 +1,84 @@ +# Contributing + +Thank you for considering contributing to `wee-slack`! + +## Requirements + +* [`git`](https://git-scm.com) +* [`pipenv`](https://github.com/pypa/pipenv) + +## Activating the development environment + +The development environment contains a few useful tools. Before testing or +working on `wee-slack`, the development environment should be activated. This +will ensure you have access to the necessary development tools. + +``` +$ cd /path/to/wee-slack +$ pipenv shell + +# Install the required development dependencies +$ pipenv install --dev +``` + +The rest of this document assumes that the development environment has been +activated, and that you have the latest development dependencies installed. + +## Testing + +Tests are executed with `pytest`. To run the tests, first navigate to the +project root, and then execute: + +``` +$ pytest +``` + +## Adding new dependencies + +Add your desired dependencies to the appropriate header, specifying a version if +necessary, defaulting to `*` if not. Be extra careful if you are pinning a +specific version of a dependency, as we currently support multiple versions of +Python which may or may not have the version you specify available to it. + +``` +# use [package] for production dependencies +[package] +foo-package = "*" + +# use [dev-packages] for development dependencies +[dev-packages] +bar-package = "*" +``` + +> **PRO TIP** +> +> You can also add dependencies without manually updating this file by running +> `pipenv install [--dev] <package...>`. This will automatically update the +> entry for the package in the `Pipfile` (and your local lockfile). +> +> For example, to add the `foo` and `bar` packages as development dependencies +> without specificying a version, you would run: +> +> ``` pipenv install --dev foo bar ``` + +## Updating dependencies + +It's important to keep our dependencies up-to-date over time. Because we support +multiple versions of Python, we avoid committing the `Pipfile.lock` file (which +is added in `.gitignore`), in addition to avoiding pinning versions of packages. + +To update the dependencies installed in your local virtual environment: + +``` +# Check for upstream updates +$ pipenv update --outdated + +# Want to update everything? +$ pipenv update + +# Want to update one package at a time? +$ pipenv update <pkg> +``` + +It's important to [run the tests](#testing) after updating dependencies to +ensure that the updated dependencies have not broken the build. diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d0d67bc..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pytest -mock -websocket-client |