Skip to content

Commit

Permalink
folder flattening, enabled single-execution
Browse files Browse the repository at this point in the history
**Folder flattening:** To make the code easier to navigate and generally
more intelligible, I've flattened the codebase and moved most of the
submodules of `lib` out into the main `autobot` source folder.

**Single-exection:** Fixes #28, enables someone to execute one specific
meeting rather than have to iterate over all of the semester's meetings.
Command structure has also been re-ordered as there are multiple
`subparsers`, now – for each subcommand (e.g. `semester-upkeep`).
  • Loading branch information
John M committed Dec 22, 2019
1 parent 409902f commit 1195e2b
Show file tree
Hide file tree
Showing 30 changed files with 311 additions and 716 deletions.
38 changes: 0 additions & 38 deletions .github/README.md

This file was deleted.

76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# ucfai's `autobot`

As managing a course/club is rather involved, coupled with the
ever-changing-hands-nature of such a group, it becomes difficult to onboard
newcomers on the processes and structures that have been settled upon by prior
folks. To overcome this, [@ionlights][git-ionlights] initially developed a bot
to handle this. Since then, many others have contributed to expanding `autobot`'s
capabilities to handle nearly all of the managerial and distributed tasks of AI@UCF.

[git-ionlights]: https://github.com/ionlights

## Documentation

<font color=red>**This is currently under development.**</font>

We've taken time to document as thoroughly, and unobtrustively, as possible
&ndash; and you can find a web-based version of the documentation at
https://ucfai.org/docs/admin/bot.

# Development

## Code Structure

```bash
autobot
├── apis # any external resource we need access to are defined here.
├── log.py # logging, mixed-in with Python's `logger`
├── main.py # package entrypoint, parsers, and high-level operations
├── meta # OO-like containers for Groups, Coordinators, and Meetings
│ └── groups.py # sets up specific attributes for each Group
├── safety.py # figures out the right paths and configurations
├── templates # these are used for creating semesters, banners, etc.
└── utils # specific actions, since these don't quite make sense in OO
```

## General Structure

`autobot` focuses on managing 4 different verticals:

1. Generate minimal content needed for a given `group`'s semester.
1. Maintain and update the website to ensure content is publicly accessible.
1. Perform routine genertion for various social platforms, e.g. uploading meetings
to YouTube, generating email and instagram banners, etc.
1. Onboard new leadership to make sure everyone has appropriate access on a
variety of plaforms we use in managing AI@UCF.

## Installation

Just about everything is packaged in a `conda` environment. To install you need
to make sure you have [Anaconda][anaconda] or [Miniconda][miniconda] on your
system. Once installed, proceed with the following:

[anaconda]: https://www.anaconda.com/distribution/
[miniconda]: https://docs.conda.io/en/latest/miniconda.html

```bash
$ conda env create -f envs/{macos,linux}.yml # pick one of the OSes
$ conda activate ucfai-admin # or `source activate ucfai-admin`
$ pip install -e . # make sure you're in the same place as this README
$ autobot -h # this should output something that looks like "help"
```

Since you're probably developing the `autobot`, make sure you have the related
groups laid out like the following `tree` output shows:

```bash
ucfai
├── bot
├── core
├── data-science
├── intelligence
└── supplementary
```

**Note:** If you need help decrypting any files ending in `.gpg`, contact
[@ionlights][git-ionlights].
Empty file removed algorithms/tensorflow/.keep.cloud
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 9 additions & 5 deletions autobot/lib/apis/kaggle.py → autobot/apis/kaggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
from pathlib import Path

from autobot import ORG_NAME
from autobot.lib.utils import paths
from autobot.utils import paths
from autobot.meta.meeting import Meeting


def push_kernel(meeting: Meeting):
# TODO: prevent Kaggle from pushing every notebook, every time
# TODO: absorb the output from shell and parse it, potentially handling
if "KAGGLE_CONFIG_DIR" not in os.environ:
os.environ["KAGGLE_CONFIG_DIR"] = str(
Path(__file__).parent.parent.parent.parent
Path(__file__).parent.parent.parent
)

cwd = os.getcwd()
Expand All @@ -21,7 +20,12 @@ def push_kernel(meeting: Meeting):
os.chdir(cwd)


def slug_kernel(meeting: Meeting):
def diff_kernel(meeting: Meeting) -> bool:
# TODO download and diff this kernel from the local copy
pass


def slug_kernel(meeting: Meeting) -> str:
"""Generates Kaggle Kernel slugs of the form: `<group>-<semester>-<filename>`
e.g. if looking at the Fall 2019 Computational Cognitive Neuroscience
lecture, the slug would be: `core-fa19-ccn`."""
Expand All @@ -31,7 +35,7 @@ def slug_kernel(meeting: Meeting):
)


def slug_competition(meeting: Meeting):
def slug_competition(meeting: Meeting) -> str:
"""Since Kaggle InClass competitions are listed under general competitions,
we take the `slug_kernel` of the meeting, and prepend `ORG_NAME`, which
for AI@UCF, would be `ucfai`."""
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions autobot/lib/apis/ucf.py → autobot/apis/ucf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from autobot.meta import MeetingMeta, SemesterMeta
from autobot.meta.group import Group
from autobot.lib import log


# it's unlikely this URL will change, but should be occassionally checked
Expand Down Expand Up @@ -49,10 +48,10 @@ def make_schedule(group: Group, schedule: Dict):
meeting_time = pd.Timedelta(hours=int(time_s[:2]), minutes=int(time_s[2:]))
meeting_dates += meeting_time

log.info(f"Meeting dates\n{meeting_dates}")
logging.info(f"Meeting dates\n{meeting_dates}")

schedule = [MeetingMeta(pd.to_datetime(mtg), room) for mtg in meeting_dates]
log.debug(schedule)
logging.debug(schedule)

return schedule

Expand Down
4 changes: 4 additions & 0 deletions autobot/apis/youtube.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from autobot.meta import Meeting

def upload(meeting: Meeting):
pass
File renamed without changes.
1 change: 0 additions & 1 deletion autobot/lib/__init__.py

This file was deleted.

11 changes: 0 additions & 11 deletions autobot/lib/log.py

This file was deleted.

124 changes: 0 additions & 124 deletions autobot/lib/ops.py

This file was deleted.

2 changes: 0 additions & 2 deletions autobot/lib/utils/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions autobot/lib/utils/website.py

This file was deleted.

Loading

0 comments on commit 1195e2b

Please sign in to comment.