Skip to content

Commit

Permalink
Refactor dev environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgilland committed Dec 30, 2016
1 parent 34d19bd commit 0c66563
Show file tree
Hide file tree
Showing 21 changed files with 302 additions and 349 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Packages
*.egg
*.egg-info
.cache
dist
build
eggs
Expand Down
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# Config file for automatic testing at travis-ci.org
sudo: false

language: python

python:
- "2.7"
- "3.4"
- "3.5"

# command to install dependencies
install:
- make travisci-install

# command to run tests
script:
- make travisci-test

# tasks to execute after successful test
after_success:
- pip install python-coveralls
- coveralls
File renamed without changes.
168 changes: 54 additions & 114 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,157 +1,97 @@
How to Contribute
*****************
Contributing
============

- Overview_
- Guidelines_
- Branching_
- `Continuous Integration`_
- `Project CLI`_
- `Areas of Needed Improvement`_
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

You can contribute in many ways:

Overview
========

1. Fork the repo.
2. Build development environment run tests to ensure a clean, working slate.
3. Improve/fix the code.
4. Add test cases if new functionality introduced or bug fixed (100% test coverage).
5. Ensure tests pass.
6. Add yourself to ``AUTHORS.rst``.
7. Push to your fork and submit a pull request to the ``develop`` branch.
Types of Contributions
----------------------

Report Bugs
+++++++++++

Guidelines
==========
Report bugs at https://github.com/dgilland/alchy.

Some simple guidelines to follow when contributing code:
If you are reporting a bug, please include:

- Adhere to `PEP8`_.
- Clean, well documented code.
- All tests must pass.
- 100% test coverage.
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.


Branching
=========
Fix Bugs
++++++++

There are two main development branches: ``master`` and ``develop``. ``master`` represents the currently released version while ``develop`` is the latest development work. When submitting a pull request, be sure to submit to ``develop``. The originating branch you submit from can be any name though.
Look through the GitHub issues for bugs. Anything tagged with "bug" is open to whoever wants to implement it.


Continuous Integration
======================
Implement Features
++++++++++++++++++

Integration testing is provided by `Travis-CI`_ at https://travis-ci.org/dgilland/alchy.
Look through the GitHub issues for features. Anything tagged with "enhancement" or "help wanted" is open to whoever wants to implement it.

Test coverage reporting is provided by `Coveralls`_ at https://coveralls.io/r/dgilland/alchy.

Write Documentation
+++++++++++++++++++

Project CLI
===========
Pydash could always use more documentation, whether as part of the official alchy docs, in docstrings, or even on the web in blog posts, articles, and such.

Some useful CLI commands when working on the project are below. **NOTE:** All commands are run from the root of the project and require ``make``.

make build
----------
Submit Feedback
+++++++++++++++

Run the ``clean`` and ``install`` commands.
The best way to send feedback is to file an issue at https://github.com/dgilland/alchy.

::
If you are proposing a feature:

make build
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)


make install
Get Started!
------------

Install Python dependencies into virtualenv located at ``env/``.

::

make install


make clean
----------

Remove build/test related temporary files like ``env/``, ``.tox``, ``.coverage``, and ``__pycache__``.

::

make clean


make test
---------

Run unittests under the virtualenv's default Python version. Does not test all support Python versions. To test all supported versions, see `make test-full`_.

::

make test

Ready to contribute? Here's how to set up ``alchy`` for local development.

make test-full
--------------
1. Fork the ``alchy`` repo on GitHub.
2. Clone your fork locally::

Run unittest and linting for all supported Python versions. **NOTE:** This will fail if you do not have all Python versions installed on your system. If you are on an Ubuntu based system, the `Dead Snakes PPA`_ is a good resource for easily installing multiple Python versions. If for whatever reason you're unable to have all Python versions on your development machine, note that Travis-CI will run full integration tests on all pull requests.
$ git clone git@github.com:your_name_here/alchy.git

::
3. Install your local copy into a virtualenv. Assuming you have virtualenv installed, this is how you set up your fork for local development::

make test-full
$ cd alchy
$ pip install -r requirements-dev.txt

4. Create a branch for local development::

make lint
---------
$ git checkout -b name-of-your-bugfix-or-feature

Run ``make pylint`` and ``make pep8`` commands.
Now you can make your changes locally.

::
5. When you're done making changes, check that your changes pass linting and all unit tests by testing with tox across all supported Python versions::

make lint
$ invoke tox

6. Add yourself to ``AUTHORS.rst``.

make pylint
-----------

Run ``pylint`` compliance check on code base.

::

make pylint


make pep8
---------

Run `PEP8`_ compliance check on code base.

::

make pep8


make docs
---------

Build documentation to ``docs/_build/``.

::
7. Commit your changes and push your branch to GitHub::

make docs
$ git add .
$ git commit -m "Detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature

8. Submit a pull request through the GitHub website.

Areas of Needed Improvement
===========================

- Better documentation of functions/modules. Many are missing docstrings. Existing docstrings could be improved. Additional code comments may be needed as well.
- Improve code quality for readability (e.g. eliminate dense code statements like one-liners which do too much).
- Improve testing infrastructure.
- More battle testing. Tests currently cover basic usage, but there may be more complex uses-cases that could draw out some edge-case bugs.
- Potentially improve ``Query`` loading methods. The current implementation doesn't handle nested loading options which differ than the base loading method used. For example, emulating this ``query.options(joinedload(Foo).lazyload(Bar))`` is not supported while this ``query.options(joinedload(Foo).joinedload(Bar))`` is via ``query.joinedload(Foo, Bar)``. Would be nice to have a way to drill down into the nested loading strategies without having to use ``query.options``. However, if the solution introduces too much complexity for a feature that isn't used/needed often, then it may be best to not attempt to support it.
Pull Request Guidelines
-----------------------

Before you submit a pull request, check that it meets these guidelines:

.. _Travis-CI: https://travis-ci.org/
.. _Coveralls: https://coveralls.io/
.. _Dead Snakes PPA: https://launchpad.net/~fkrull/+archive/deadsnakes
.. _PEP8: http://legacy.python.org/dev/peps/pep-0008/
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the README.rst.
3. The pull request should work for Python 2.7, 3.4, and 3.5. Check https://travis-ci.org/dgilland/alchy/pull_requests and make sure that the tests pass for all supported Python versions.
14 changes: 13 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
include LICENSE.rst README.rst
include AUTHORS.rst
include CONTRIBUTING.rst
include CHANGELOG.rst
include LICENSE.rst
include README.rst
include requirements.txt
include requirements-dev.txt

recursive-include tests *
recursive-include docs *.rst conf.py Makefile make.bat

recursive-exclude * __pycache__
recursive-exclude * *.py[cod]
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

##
# TravisCI
##

.PHONY: travisci-install
travisci-install:
pip install -r requirements-dev.txt

.PHONY: travisci-test
travisci-test:
invoke test
15 changes: 7 additions & 8 deletions alchy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
Import core objects here.
"""

from .model import ModelBase, make_declarative_base
from .query import Query, QueryModel
from .manager import Manager, ManagerMixin
from .session import Session

from .__meta__ import (
__title__,
__summary__,
from .__pkg__ import (
__description__,
__url__,
__version__,
__author__,
__email__,
__license__
)

from .model import ModelBase, make_declarative_base
from .query import Query, QueryModel
from .manager import Manager, ManagerMixin
from .session import Session

__all__ = [
'ModelBase',
'make_declarative_base',
Expand Down
15 changes: 0 additions & 15 deletions alchy/__meta__.py

This file was deleted.

13 changes: 13 additions & 0 deletions alchy/__pkg__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
"""Define project metadata
"""

__package_name__ = 'alchy'
__description__ = ('A SQLAlchemy extension for its declarative ORM that '
'provides enhancements for model classes, queries, and '
'sessions.')
__url__ = 'https://github.com/dgilland/alchy'
__version__ = '2.2.1'
__author__ = 'Derrick Gilland'
__email__ = 'dgilland@gmail.com'
__license__ = 'MIT License'
2 changes: 2 additions & 0 deletions alchy/_compat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""Python 2/3 compatibility
Expand Down
6 changes: 6 additions & 0 deletions docs/_static/theme_override.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

.wy-table-responsive table td,
.wy-table-responsive table th {
/* Get ride of nowrap for table cells. */
white-space: normal;
}
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.. _changelog:

.. include:: ../CHANGES.rst
.. include:: ../CHANGELOG.rst
Loading

0 comments on commit 0c66563

Please sign in to comment.