Skip to content

Commit

Permalink
Merge pull request #84 from PyconUK/issue-79
Browse files Browse the repository at this point in the history
Reference Docs
  • Loading branch information
meatballs committed May 15, 2017
2 parents 68e32a1 + d318c42 commit 42715b0
Show file tree
Hide file tree
Showing 13 changed files with 773 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ instance/

# Sphinx documentation
docs/_build/
reference_docs/_build

# PyBuilder
target/
Expand Down
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ install:
- pip install pyyaml
- pip install coverage
- pip install coveralls
- pip install sphinx
- pip install sphinx-rtd-theme
script:
- coverage run --source=conference_scheduler setup.py test
- coverage report -m
- python setup.py install
- cd docs
- make doctest
- make html
after_success:
- coveralls
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# ones.
extensions = [
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.todo'
]
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Contents:
tutorial/index.rst
howto/index.rst
background/index.rst
reference/index.rst



Expand Down
10 changes: 10 additions & 0 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Reference
=========

.. toctree::
:maxdepth: 2

scheduler.rst
resources.rst


4 changes: 4 additions & 0 deletions docs/reference/resources.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
conference_scheduler.resources
------------------------------

.. include:: resources.txt
94 changes: 94 additions & 0 deletions docs/reference/resources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

.. py:module:: conference_scheduler.resources


.. py:class:: Event(name, duration, demand, tags=None, unavailability=None)
:module: conference_scheduler.resources

An event (e.g. a talk or a workshop) that needs to be scheduled

:param name: A human readable string
:type name: str
:param duration: The expected duration of the event in minutes
:type duration: int
:param demand: The anticipated demand - e.g. the number of attendees expected
This will be compared with :attr:`Slot.capacity` during computation of
the schedule to ensure that events are only scheduled in slots that can
accommodate them.
Use 0 if the event could be scheduled in any slot.
:type demand: int
:param tags: of human readable strings
:type tags: list or tuple, optional
:param unavailability: of :class:`resources.Slot` or :class:`resources.Event`
:type unavailability: list or tuple, optional


.. py:class:: Slot
:module: conference_scheduler.resources

A period of time at a venue in which an event can be scheduled

:param venue: A human readable string
:type venue: str
:param starts_at: The starting time for the time period
:type starts_at: datetime
:param duration: The duration of the time period in minutes
:type duration: int
:param capacity: This will be compared with :attr:`Event.demand` during computation of
the schedule to ensure that events are only scheduled in slots that can
accommodate them.
:type capacity: int
:param session: A human readable string which serves as a tag for similar time periods
e.g. 'morning', 'afternoon'
:type session: str

.. rubric:: Example

For a conference where:

* It will take place on 2016-09-17
* There are two rooms - 'Main Hall' and 'Small Room'
* The Main Hall can seat 500 people and the Small Room, 50
* It is intended to hold two 30 minute talks in the morning (from 09:30
to 10:00 and from 11:00 to 11:30) and two more in the afternoon
(from 14:00 to 14:30 and 15:00 to 15:30)

We would create the following eight objects::

>>> from conference_scheduler.resources import Slot
>>> Slot(
... venue='Main Hall', starts_at=datetime(2016, 09, 17, 09, 30),
... duration=30, capacity=500, session='morning')
>>> Slot(
... venue='Main Hall', starts_at=datetime(2016, 09, 17, 10, 00),
... duration=30, capacity=500, session='morning')
>>> Slot(
... venue='Main Hall', starts_at=datetime(2016, 09, 17, 14, 00),
... duration=30, capacity=500, session='afternoon')
>>> Slot(
... venue='Main Hall', starts_at=datetime(2016, 09, 17, 15, 00),
... duration=30, capacity=500, session='afternoon')
>>> Slot(
... venue='Small Room', starts_at=datetime(2016, 09, 17, 09, 30),
... duration=30, capacity=50, session='morning')
>>> Slot(
... venue='Small Room', starts_at=datetime(2016, 09, 17, 10, 00),
... duration=30, capacity=50, session='morning')
>>> Slot(
... venue='Small Room', starts_at=datetime(2016, 09, 17, 14, 00),
... duration=30, capacity=50, session='afternoon')
>>> Slot(
... venue='Small Room', starts_at=datetime(2016, 09, 17, 15, 00),
... duration=30, capacity=50, session='afternoon')


.. py:class:: ScheduledItem
:module: conference_scheduler.resources

Represents that an event has been scheduled to occur in a slot

:param event:
:type event: :class:`resources.Event`
:param slot:
:type slot: :class:`resources.Slot`

4 changes: 4 additions & 0 deletions docs/reference/scheduler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
conference_scheduler.scheduler
------------------------------

.. include:: scheduler.txt

0 comments on commit 42715b0

Please sign in to comment.