This repository has been archived by the owner on Feb 7, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* setting up for 0.5 .travis.yml * Added tests for 3.4 * Removed testing for 0.8 (we test 0.8.1, it seemed redundant) * Install separate requirements-contrib.txt file requirements-dev.txt requirements-contrib.txt * Moved contrib modules out into their own file - Travis was erroring out when we put the contrib stuff in with the dev requirements, and it's cleaner to do it this way, too. CONTRIBUTING.rst CHANGES.rst docs/contrib.rst docs/index.rst * documenting the new contrib changes * adding doc on how to contribute tests/test_core_function.py * noticed I'd accidentally duplicated a test and not tested something I meant to * notice that a test wasn't testing exception throwing correctly (if no exception was thrown when one was expected, then it would pass)
- Loading branch information
Rachel Sanders
committed
Aug 7, 2014
1 parent
170e612
commit eb9db73
Showing
10 changed files
with
151 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
Contributing | ||
============ | ||
|
||
Hi! Thanks so much for wanting to contribute. | ||
|
||
Setting up for development | ||
-------------------------- | ||
|
||
There's a few extra steps to set up for development. | ||
|
||
Installing from source | ||
`````````````````````` | ||
|
||
To install in development mode from source, download the source code, then run this:: | ||
|
||
python setup.py develop | ||
|
||
Installing libraries | ||
```````````````````` | ||
|
||
To do development work, you'll need a few more libraries:: | ||
|
||
pip install -r requirements-dev.txt | ||
pip install -r requirements-contrib.txt | ||
|
||
|
||
Running the tests | ||
````````````````` | ||
|
||
Make sure you have the development libraries installed, then run:: | ||
|
||
nosetests | ||
|
||
Building documentation | ||
`````````````````````` | ||
|
||
Make sure you have the development libraries installed, then do:: | ||
|
||
cd docs | ||
make html | ||
|
||
The generated documentation will be in ``docs/_build/html/``. | ||
|
||
Guidelines | ||
---------- | ||
|
||
Style guide | ||
``````````` | ||
|
||
The code follows `PEP8 | ||
<http://www.python.org/dev/peps/pep-0008/>`_ with the following exceptions: | ||
|
||
* Indentation is 2 spaces (no tabs) | ||
* Line length: use your best judgment. (We all have big monitors now, no need to limit to 80 columns.) | ||
|
||
Your code should pass `flake8 | ||
<http://flake8.readthedocs.org/>`_ unless readability is hurt. Configuration is in ``setup.cfg``. | ||
|
||
Supported versions | ||
``````````````````` | ||
|
||
Your code should be compatible with Python 2.6, 2.7, and 3.3+, and Flask 0.8+. Travis CI will test all that for you | ||
automatically. | ||
|
||
Tests | ||
````` | ||
|
||
Submitted code should have tests covering the code submitted, and your code should pass the travis build. | ||
|
||
If possible, use the fixtures in test/fixtures.py - there's a sample app with all the functionality that you can | ||
use to test on. | ||
|
||
Creating a contrib module | ||
------------------------- | ||
|
||
If you store your flags somewhere other than the config file, and want to share your code with others, fantastic! | ||
|
||
Here's a couple guidelines: | ||
|
||
1. Contrib code goes in ``flask_featureflags/contrib`` | ||
|
||
2. Tests for contrib modules go in ``tests/contrib`` | ||
|
||
3. Add a description and a quick example of how to use your module in ``docs/contrib.rst`` | ||
|
||
4. If your code has any package requirements, please put them in ``requirements-contrib.txt`` | ||
|
||
Thanks for contributing! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Third-party modules | ||
=================== | ||
|
||
Sometimes you don't want to use the config file to store your feature flags. You can use these premade modules | ||
to use other backends. | ||
|
||
SQLAlchemy | ||
---------- | ||
|
||
You'll need Flask-SQLAlchemy:: | ||
|
||
pip install Flask-SQLAlchemy | ||
|
||
|
||
Then, in your app, add the ``SQLAlchemyFeatureFlags`` handler:: | ||
|
||
from flask import Flask | ||
from flask.ext.sqlalchemy import SQLAlchemy | ||
import flask_featureflags as feature_flags | ||
from flask_featureflags.contrib.sqlalchemy import SQLAlchemyFeatureFlags | ||
|
||
app = Flask(__name__) | ||
|
||
db = SQLAlchemy(app) | ||
|
||
ff = feature_flags.FeatureFlag(app) | ||
ff.add_handler(SQLAlchemyFeatureFlags(db)) | ||
|
||
It will automatically create a table to store your flags in, or you can override by passing in your own model:: | ||
|
||
ff.add_handler(SQLAlchemyFeatureFlags(db, model=MyModel)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Flask-SQLAlchemy>=0.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ nose>=1.0.0 | |
sphinx>=1.0 | ||
coverage>=3.5 | ||
flake8>=2.1.0 | ||
Flask-SQLAlchemy>=0.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters