Skip to content

Commit

Permalink
Donate kairios to Pinax
Browse files Browse the repository at this point in the history
* Renamed to pinax-calendars
* Brought up to pinax-starter-app standards
* Added a couple tests
  • Loading branch information
paltman committed Feb 21, 2016
1 parent 510767f commit 261e264
Show file tree
Hide file tree
Showing 24 changed files with 419 additions and 168 deletions.
7 changes: 7 additions & 0 deletions .coveragerc
@@ -0,0 +1,7 @@
[run]
source = pinax
omit = pinax/calendars/tests/*,pinax/calendars/admin.py
branch = 1

[report]
omit = pinax/calendars/tests/*,pinax/calendars/admin.py
6 changes: 6 additions & 0 deletions .eggs/README.txt
@@ -0,0 +1,6 @@
This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins.

This directory caches those eggs to prevent repeated downloads.

However, it is safe to delete this directory.

11 changes: 11 additions & 0 deletions .gitignore
@@ -0,0 +1,11 @@
build
dist
.coverage
.tox
.idea
MANIFEST
*.pyc
*.egg-info
*.egg
docs/_build/
htmlcov/
29 changes: 22 additions & 7 deletions .travis.yml
@@ -1,11 +1,26 @@
sudo: false
language: python

python:
- 2.7

- "2.7"
- "3.3"
- "3.4"
- "3.5"
env:
- DJANGO=1.7
- DJANGO=1.8
- DJANGO=1.9
- DJANGO=master
matrix:
exclude:
- python: "3.3"
env: DJANGO=1.9
- python: "3.3"
env: DJANGO=master
- python: "3.5"
env: DJANGO=1.7
install:
- pip install flake8
- pip install -e .

- pip install tox coveralls
script:
- flake8 .
- tox -e py${TRAVIS_PYTHON_VERSION//[.]/}-$DJANGO
after_success:
- coveralls
4 changes: 4 additions & 0 deletions AUTHORS
@@ -0,0 +1,4 @@
Brian Rosner <brosner@gmail.com>
James Tauber <jtauber@jtauber.com>
Patrick Altman <paltman@gmail.com>
Bojan Mihelac <bmihelac@mihelac.org>
161 changes: 161 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,161 @@
# How to Contribute

There are many ways you can help contribute to this project. Contributing
code, writing documentation, reporting bugs, as well as reading and providing
feedback on issues and pull requests, all are valid and necessary ways to
help.

## Committing Code

The great thing about using a distributed versioning control system like git
is that everyone becomes a committer. When other people write good patches
it makes it very easy to include their fixes/features and give them proper
credit for the work.

We recommend that you do all your work in a separate branch. When you
are ready to work on a bug or a new feature create yourself a new branch. The
reason why this is important is you can commit as often you like. When you are
ready you can merge in the change. Let's take a look at a common workflow:

git checkout -b task-566
... fix and git commit often ...
git push origin task-566

The reason we have created two new branches is to stay off of `master`.
Keeping master clean of only upstream changes makes yours and ours lives
easier. You can then send us a pull request for the fix/feature. Then we can
easily review it and merge it when ready.


### Writing Commit Messages

Writing a good commit message makes it simple for us to identify what your
commit does from a high-level. There are some basic guidelines we'd like to
ask you to follow.

A critical part is that you keep the **first** line as short and sweet
as possible. This line is important because when git shows commits and it has
limited space or a different formatting option is used the first line becomes
all someone might see. If your change isn't something non-trivial or there
reasoning behind the change is not obvious, then please write up an extended
message explaining the fix, your rationale, and anything else relevant for
someone else that might be reviewing the change. Lastly, if there is a
corresponding issue in Github issues for it, use the final line to provide
a message that will link the commit message to the issue and auto-close it
if appropriate.

Add ability to travel back in time

You need to be driving 88 miles per hour to generate 1.21 gigawatts of
power to properly use this feature.

Fixes #88


## Coding style

When writing code to be included in pinax-calendars keep our style in mind:

* Follow [PEP8](http://www.python.org/dev/peps/pep-0008/) there are some
cases where we do not follow PEP8. It is an excellent starting point.
* Follow [Django's coding style](http://docs.djangoproject.com/en/dev/internals/contributing/#coding-style)
we're pretty much in agreement on Django style outlined there.

We would like to enforce a few more strict guides not outlined by PEP8 or
Django's coding style:

* PEP8 tries to keep line length at 80 characters. We follow it when we can,
but not when it makes a line harder to read. It is okay to go a little bit
over 80 characters if not breaking the line improves readability.
* Use double quotes not single quotes. Single quotes are allowed in cases
where a double quote is needed in the string. This makes the code read
cleaner in those cases.
* Blank lines should contain no whitespace.
* Docstrings always use three double quotes on a line of their own, so, for
example, a single line docstring should take up three lines not one.
* Imports are grouped specifically and ordered alphabetically. This is shown
in the example below.
* Always use `reverse` and never `@models.permalink`.
* Tuples should be reserved for positional data structures and not used
where a list is more appropriate.
* URL patterns should use the `url()` function rather than a tuple.

Here is an example of these rules applied:

# first set of imports are stdlib imports
# non-from imports go first then from style import in their own group
import csv

# second set of imports are Django imports with contrib in their own
# group.
from django.core.urlresolvers import reverse
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _

from django.contrib.auth.models import User

# third set of imports are external apps (if applicable)
from tagging.fields import TagField

# fourth set of imports are local apps
from .fields import MarkupField


class Task(models.Model):
"""
A model for storing a task.
"""

creator = models.ForeignKey(User)
created = models.DateTimeField(default=timezone.now)
modified = models.DateTimeField(default=timezone.now)

objects = models.Manager()

class Meta:
verbose_name = _("task")
verbose_name_plural = _("tasks")

def __unicode__(self):
return self.summary

def save(self, **kwargs):
self.modified = datetime.now()
super(Task, self).save(**kwargs)

def get_absolute_url(self):
return reverse("task_detail", kwargs={"task_id": self.pk})

# custom methods


class TaskComment(models.Model):
# ... you get the point ...
pass


## Pull Requests

Please keep your pull requests focused on one specific thing only. If you
have a number of contributions to make, then please send seperate pull
requests. It is much easier on maintainers to receive small, well defined,
pull requests, than it is to have a single large one that batches up a
lot of unrelated commits.

If you ended up making multiple commits for one logical change, please
rebase into a single commit.

git rebase -i HEAD~10 # where 10 is the number of commits back you need

This will pop up an editor with your commits and some instructions you want
to squash commits down by replacing 'pick' with 's' to have it combined with
the commit before it. You can squash multiple ones at the same time.

When you save and exit the text editor where you were squashing commits, git
will squash them down and then present you with another editor with commit
messages. Choose the one to apply to the squashed commit (or write a new
one entirely.) Save and exit will complete the rebase. Use a forced push to
your fork.

git push -f
46 changes: 19 additions & 27 deletions LICENSE
@@ -1,27 +1,19 @@
Copyright (c) 2010-2014, Eldarion, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of Eldarion, Inc. nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Copyright (c) 2012-2016 James Tauber and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
5 changes: 4 additions & 1 deletion MANIFEST.in
@@ -1,2 +1,5 @@
include AUTHORS
include LICENSE
include README.rst
recursive-include kairios/templates *.html
recursive-include pinax/calendars/static *
recursive-include pinax/calendars/templates *
15 changes: 15 additions & 0 deletions Makefile
@@ -0,0 +1,15 @@
all: init docs test

init:
python setup.py develop
pip install detox coverage mkdocs

test:
coverage erase
detox
coverage html

docs:
mkdocs build

.PHONY: docs
27 changes: 15 additions & 12 deletions README.rst
@@ -1,20 +1,23 @@
kairios
pinax-calendars
=======

.. image:: https://img.shields.io/travis/eldarion/kairios.svg
:target: https://travis-ci.org/eldarion/kairios
.. image:: http://slack.pinaxproject.com/badge.svg
:target: http://slack.pinaxproject.com/

.. image:: https://img.shields.io/coveralls/eldarion/kairios.svg
:target: https://coveralls.io/r/eldarion/kairios
.. image:: https://img.shields.io/travis/pinax/pinax-calendars.svg
:target: https://travis-ci.org/pinax/pinax-calendars

.. image:: https://img.shields.io/pypi/dm/kairios.svg
:target: https://pypi.python.org/pypi/kairios/
.. image:: https://img.shields.io/coveralls/pinax/pinax-calendars.svg
:target: https://coveralls.io/r/pinax/pinax-calendars

.. image:: https://img.shields.io/pypi/v/kairios.svg
:target: https://pypi.python.org/pypi/kairios/
.. image:: https://img.shields.io/pypi/dm/pinax-calendars.svg
:target: https://pypi.python.org/pypi/pinax-calendars/

.. image:: https://img.shields.io/badge/license-BSD-blue.svg
:target: https://pypi.python.org/pypi/kairios/
.. image:: https://img.shields.io/pypi/v/pinax-calendars.svg
:target: https://pypi.python.org/pypi/pinax-calendars/

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: https://pypi.python.org/pypi/pinax-calendars/

Provides utilities for publishing events as a calendar.

Expand All @@ -27,7 +30,7 @@ Usage

::

{% load kairios_tags %}
{% load pinax_calendars_tags %}

...

Expand Down
2 changes: 0 additions & 2 deletions kairios/__init__.py

This file was deleted.

2 changes: 2 additions & 0 deletions pinax/__init__.py
@@ -0,0 +1,2 @@
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) # noqa
5 changes: 5 additions & 0 deletions pinax/calendars/__init__.py
@@ -0,0 +1,5 @@
import pkg_resources


default_app_config = "pinax.calendars.apps.AppConfig"
__version__ = pkg_resources.get_distribution("pinax-calendars").version
9 changes: 9 additions & 0 deletions pinax/calendars/apps.py
@@ -0,0 +1,9 @@
from django.apps import AppConfig as BaseAppConfig
from django.utils.translation import ugettext_lazy as _


class AppConfig(BaseAppConfig):

name = "pinax.calendars"
label = "pinax_calendars"
verbose_name = _("Pinax Calendars")
File renamed without changes.
File renamed without changes.
Expand Up @@ -19,7 +19,7 @@ def delta(year, month, d):
return yy, mm


@register.inclusion_tag("kairios/calendar.html", takes_context=True)
@register.inclusion_tag("pinax/calendars/calendar.html", takes_context=True)
def calendar(context, events, date=None, tz=None, **kwargs):
cal.setfirstweekday(cal.SUNDAY)

Expand Down
Empty file.
22 changes: 22 additions & 0 deletions pinax/calendars/tests/tests.py
@@ -0,0 +1,22 @@
from django.test import TestCase

from pinax.calendars.templatetags.pinax_calendars_tags import delta


class Tests(TestCase):

def test_delta_previous(self):
"""
plus_year, plus_month = delta(date.year, date.month, 1)
minus_year, minus_month = delta(date.year, date.month, -1)
"""
self.assertEqual(delta(2016, 2, -1), (2016, 1))
self.assertEqual(delta(2016, 1, -1), (2015, 12))

def test_delta_next(self):
"""
plus_year, plus_month = delta(date.year, date.month, 1)
minus_year, minus_month = delta(date.year, date.month, -1)
"""
self.assertEqual(delta(2016, 2, 1), (2016, 3))
self.assertEqual(delta(2015, 12, 1), (2016, 1))
2 changes: 2 additions & 0 deletions pinax/calendars/tests/urls.py
@@ -0,0 +1,2 @@
urlpatterns = [
]

0 comments on commit 261e264

Please sign in to comment.