• Home
  • About
    • Gregory S. Fellis photo

      Gregory S. Fellis

      Problem Solver | Code Slinger | Python Enthusiast | Lifelong Learner | Ravenclaw

    • Learn More
    • Resume
    • Email
    • Twitter
    • LinkedIn
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

Task Scheduler Update One

Wednesday, October 10, 2018 @ 12:00:00 AM EDT

Reading time ~1 minute

While working on the MongoDB implementation for enhancement 3, I decided it was time to organize the additional modules I was importing into Noob SNHUbot. I wanted to make sure as few files as necessary were held in the root folder of the project.

To accommodate this, I created another internal Python package for the bot to use, called BotHelper. I’ve moved and renamed the former bot_sched.py to this package as Scheduler.py. No other changes were made to the file itself. The folder structure now appears as below.

Project File Tree
noob_snhubot
├── BotHelper
│   ├── __init__.py
│   ├── MongoConnection.py
│   └── Scheduler.py
├── cmds
│   ├── __init__.py
│   ├── airspeed_velocity.py
│   ├── channels.py
│   ├── greet_user.py
│   ├── help.py
│   ├── my_name.py
│   ├── packtbook.py
│   └── roll.py
├── config.yml
├── LICENSE
├── noob_snhubot.py
├── README.md
└── requirements.txt

As can be seen, we keep the noob_snhubot_py, requirements.txt,README.md, LICENSE, and the new config.yml, introduced in enhancement 3, in the root folder. BotHelper and cmds are now packages as indicated by the __init__.py.

The BotHelper __init__.py imports each of the scripts to allow the bot script to import them as if they were part of the BotHelper, instead of individual modules.

./BotHelper/__init__.py
from .Scheduler import Scheduler
from .MongoConnection import MongoConnection
noob_snhubot.py
from slackclient import SlackClient
from BotHelper import Scheduler
from BotHelper import MongoConnection


Noob SNHUbotmilestone 3enhancement 2seleniumCS499 Share Tweet +1