A reddit.com bot that will return reference links from official python documentation site for the standard library.

Overview

Pylint & flake8 CodeQL

Python Docs Bot

A reddit.com bot that will return documentation links for the library and language reference sections of the python docs website. The bot can also return links to python pep documentation. The bot monitors the r/learnpython subreddit's comments looking for its keyword. When found the bot will reply to the comment with the requested links to documentation.

Usage

Invoke the bot with !docs keyword

All you need to do is use the !docs keyword followed by a comma seperated list of search terms anywhere in your comment as long as it's on its own line.

Examples:

!docs os.path, pathlib.Path

Returns library reference documentation links to os.path and pathlib.Path.

!docs function, class

Returns python language reference links for function definitions and class definitions.

!docs while, input

Returns language reference for while statement and a library reference for the input function.

!docs pep-20, pep-8

Returns links to pep-20 "The Zen of Python" and pep-8 "Style Guide for Python Code"

Important

  • To prevent the bot from spamming posts, the bot will not reply if it clouldn't find a valid documentation link based on your search terms. It will silently ignore the request.

  • The keyword and search terms must be on its own line in your comment or it will be ignored by the bot.

  • Full method path is required and the paths are case sensitive for standard library references only (Correct: !docs pathlib.Path, Incorrect: !docs pathlib.path, or !docs Path). This is for a few reasons but the biggest one is that it allows the bot to include page anchors in the links. This way if someone is recommending Path from pathlib and sent them the link to pathlib library docs they would have to scroll through all the other methods searching for Path. Page anchors solve that.

    • Exceptions to needing the full method path:
      • You want to return python documentation for the entire module (Correct: !docs pathlib)
      • Built-in python functions like zip, map, filter, etc. because there is no chain for those functions (Correct: !docs filter).
  • Python language references are found by doing basically a keyword search against all the items on its index page (linked below). For example, !docs while would return a link to the language reference page titled "The while statement"

Refer to these links to see what the bot can return.

All links created and distributed by the bot link back to https://docs.python.org and https://www.python.org/dev/peps/ and no where else.

Full Example

Below is an example of how to use the bot. I have tried to make it super simple to use. If you are still unsure of how to use it you can checkout the bot's reddit profile and see how others have used the bot by reviewing the comments it has replied to.

Original Post:

How do I import a module that is not in the same directory as my script?

I cant figure out what I am doing wrong. Can anyone help point me in the right direction

Your Comment:

Python will check PYTHONPATH and the directory the script is in for imports. If it is not in those locations,  
you would need to do one of the following:  
    1) add it to PYTHONPATH  
    2) move it into the script directory  
    3) use relative imports  
  
You can use sys.path to add the directory to PATH so that python will check that directory for imports.  
  
!docs sys.path  

Bot's Reply to Your Comment:


sys.path - https://docs.python.org/3/library/sys.html#sys.path

Python Documentation Bot - How To Use

You might also like...
SongLink Discord Bot - Discord bot to share music links easily

SongLink_Discord_Bot Discord bot to share music links easily. Take a link from y

go-cqhttp API typing annoations, return data models and utils for nonebot

go-cqhttp API typing annoations, return data models and utils for nonebot

A Python bot that uses the Reddit API to send users inspiring messages.

AnonBot By Edric Antoine A Python bot that uses the Reddit API to send users inspiring messages. When a message includes 'What would Anon do?', the bo

Web-music-bot - A telegram bot which get a *site Url* and sends all songs contain in the Url to telegram

web music bot this is a telegram bot which get a site Url and sends all songs co

Just a python library to make reddit post caching easier

Reddist Just a python library to make reddit post caching easier. Caching Options In Memory Caching Redis Caching Pickle Caching Usage Installation: D

Telegram bot to scrape images from the reddit universe
Telegram bot to scrape images from the reddit universe

Telegram bot to scrape images from the reddit universe

Reddit bot that uses sentiment analysis
Reddit bot that uses sentiment analysis

Reddit Bot Project 2: Neural Network Boogaloo Reddit bot that uses sentiment analysis from NLTK.VADER WIP_WIP_WIP_WIP_WIP_WIP Link to test subreddit:

Reddit comment bot emulating Telugu actor N. Bala Krishna.

Balayya-Bot Reddit comment bot emulating Telugu actor N. Bala Krishna. Project structure config.py contains Bot's higher level configuration. generate

Simple Reddit bot that replies to comments containing a certain word.

reddit-replier-bot Small comment reply bot based on PRAW. This script will scan the comments of a subreddit as they come in and look for a trigger wor

Owner
Trevor Miller
Trevor Miller
This is a cryptocurrency trading bot that analyses Reddit sentiment and places trades on Binance based on reddit post and comment sentiment. If you like this project please consider donating via brave. Thanks.

This is a cryptocurrency trading bot that analyses Reddit sentiment and places trades on Binance based on reddit post and comment sentiment. The bot f

Andrei 157 Dec 15, 2022
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 3k Dec 29, 2022
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 3k Dec 29, 2022
a discord bot for searching your movies, and bot return movie url for you :)

IMDb Discord Bot how to run this bot. the first step you must create prefixes.json file the second step you must create a virtualenv if you use window

Mehdi Radfar 6 Dec 20, 2022
Telegram bot that search for the classrooms status of the chosen day and then return all the free classrooms using your preferred time slot

Aule Libere Polimi Since the PoliMi site no longer allows people to search for free classrooms this bot was necessary! It simply search for the classr

Daniele Ferrazzo 16 Nov 9, 2022
A Telegram Bot to return Youtube Video Tags Using YoutubeTags API

YouTube-TagFind-Bot A Telegram Bot to return Youtube Video Tags Using YoutubeTags API YoutubeTags API Wrapper YoutubeTags is a python third-party api

Nuhman Pk 9 Aug 25, 2022
This bot is created by AJTimePyro and It accepts direct downloading url & then return file as telegram file.

URL Uploader Bot This is the source code of URL Uploader Bot. And the developer of this bot is AJTimePyro, His Telegram Channel & Group. You can use t

Abhijeet 23 Nov 13, 2022
Twitter bot that turns comment chains into ace attorney scenes. Inspired by and using https://github.com/micah5/ace-attorney-reddit-bot

Ace Attorney twitter Bot Twitter bot that turns comment chains into ace attorney scenes. Inspired by and using https://github.com/micah5/ace-attorney-

Luis Mayo Valbuena 542 Dec 17, 2022
File-sharing-Bot: Telegram Bot to store Posts and Documents and it can Access by Special Links.

File-sharing-Bot Telegram Bot to store Posts and Documents and it can Access by Special Links. I Guess This Will Be Usefull For Many People..... ?? .

null 1 Dec 17, 2021
Linky bot, A open-source discord bot that allows you to add links to ur website, youtube url, etc for the people all around discord to see!

LinkyBot Linky bot, An open-source discord bot that allows you to add links to ur website, youtube url, etc for the people all around discord to see!

AlexyDaCoder 1 Sep 20, 2022