Skip to content

Commit

Permalink
Update requirements and tests (#224)
Browse files Browse the repository at this point in the history
- update requirements
- update required python version to 3.10
- bump limbo version to 9.0.0
- remove tox
- remove pypy support (unfortunately! it isn't working with the new urllib3 or something, I couldn't immediately figure it out)
- remove dead dockerfile
- update test fixtures
  • Loading branch information
llimllib authored Mar 9, 2024
1 parent e7323a7 commit 5a0e28e
Show file tree
Hide file tree
Showing 47 changed files with 16,827 additions and 14,861 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: run tests
run: make test
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: run tests
run: make test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ slask.egg-info/
__pycache__
.pytest_cache
.tool-versions
.venv
.mise.toml
20 changes: 0 additions & 20 deletions Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
NAMESPACE=llimllib
APP=limbo

.PHONY: testall
testall: requirements
tox

# to run a single file, with debugger support:
# pytest -s test/test_plugins/test_image.py
.PHONY: test
Expand Down Expand Up @@ -45,21 +38,6 @@ publish:
flake8:
flake8 limbo test

NAMESPACE=petergrace
APP=limbo

.PHONY: docker_build
docker_build:
docker build -f Dockerfile.dev -t ${NAMESPACE}/${APP} .

.PHONY: docker_run
docker_run:
docker run -d -e SLACK_TOKEN=${SLACK_TOKEN} ${NAMESPACE}/${APP}

.PHONY: docker_stop
docker_clean:
docker stop $(docker ps -a -q --filter ancestor=petergrace/limbo --format="{{.ID}}")

.PHONY: update-requirements
update-requirements:
rm -rf update-requirements || true
Expand Down
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ At the moment, I consider limbo to be feature complete, and the project is in ma

Contributions will be considered and may be accepted, you may want to [email me](bill@billmill.org) because I might not notice your PR.

## Python Versions

At the moment, this software only officially supports python 3.10, because the test fixtures fail on older versions of python due to some weird urllib3 inconsistency.

It may run on other versions of python, but for the moment they're unfortunately not tested.

## Installation

1. Clone the repo
Expand Down Expand Up @@ -49,7 +55,6 @@ By default, plugins won't react to messages from other bots (just messages from

These are the current default plugins:

- [calc](https://github.com/llimllib/limbo/wiki/Calc-Plugin)
- [emoji](https://github.com/llimllib/limbo/wiki/Emoji-Plugin)
- [flip](https://github.com/llimllib/limbo/wiki/Flip-Plugin)
- [gif](https://github.com/llimllib/limbo/wiki/Gif-Plugin)
Expand All @@ -58,21 +63,8 @@ These are the current default plugins:
- [image](https://github.com/llimllib/limbo/wiki/Image-Plugin)
- [map](https://github.com/llimllib/limbo/wiki/Map-Plugin)
- [poll](https://github.com/llimllib/limbo/wiki/Poll-Plugin)
- [stock](https://github.com/llimllib/limbo/wiki/Stock-Plugin)
- [stockphoto](https://github.com/llimllib/limbo/wiki/Stock-Photo-Plugin)
- [weather](https://github.com/llimllib/limbo/wiki/Weather-Plugin)
- [wiki](https://github.com/llimllib/limbo/wiki/Wiki-Plugin)
- [youtube](https://github.com/llimllib/limbo/wiki/Youtube-Plugin)

## Docker

- How do I try out Limbo via docker?
- @PeterGrace maintains a public build of limbo, available from the docker registry. Executing `make docker_run` will start the default bot.
- `make docker_stop` will stop the bot
- When I start the docker container, I see an error about unable to source limbo.env. Is this a problem?
- No. The limbo.env file only exists when using Kubernetes with the included opaque secret recipe for storing your environment variables.
- I'd like to develop plugins for Limbo, but would still like to use Docker to run the bot. Is there a quick way to add plugins to the bot?
- Yes! Use the included Dockerfile.dev as a template, and simply build via `make docker_build` You'll then need to start the bot with your new_image_name, for example `docker run -d -e SLACK_TOKEN=<your_token> new_image_name`

## Contributors

Expand Down
2 changes: 1 addition & 1 deletion limbo/limbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from .server import LimboServer
from .fakeserver import FakeServer

VERSION = "8.6.1"
VERSION = "9.0.0"

CURDIR = os.path.abspath(os.path.dirname(__file__))
DIR = functools.partial(os.path.join, CURDIR)
Expand Down
36 changes: 0 additions & 36 deletions limbo/plugins/calc.py

This file was deleted.

6 changes: 4 additions & 2 deletions limbo/plugins/gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ def gif(search, unsafe=False):
searchb = quote(search.encode("utf8"))

safe = "&safe=" if unsafe else "&safe=active"
searchurl = "https://www.google.com/search?tbs=itp:animated&tbm=isch&q={0}{1}".format(
searchb, safe
searchurl = (
"https://www.google.com/search?tbs=itp:animated&tbm=isch&q={0}{1}".format(
searchb, safe
)
)

# this is an old iphone user agent. Seems to make google return good results.
Expand Down
22 changes: 15 additions & 7 deletions limbo/plugins/wiki.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""!wiki <topic> returns a wiki link for <topic>"""

import re

try:
from urllib import quote
except ImportError:
Expand All @@ -21,7 +23,7 @@ def wiki(searchterm):
pages = result["query"]["search"]

# try to reject disambiguation pages
pages = [p for p in pages if 'may refer to' not in p["snippet"]]
pages = [p for p in pages if "may refer to" not in p["snippet"]]

if not pages:
return ""
Expand All @@ -30,13 +32,19 @@ def wiki(searchterm):
link = "http://en.wikipedia.org/wiki/{0}".format(page)

r = requests.get(
"http://en.wikipedia.org/w/api.php?format=json&action=parse&page={0}".
format(page)).json()
"http://en.wikipedia.org/w/api.php?format=json&action=parse&page={0}".format(
page
)
).json()
soup = BeautifulSoup(r["parse"]["text"]["*"], "html5lib")
p = soup.find('p').get_text()
p = p[:8000]

return u"{0}\n{1}".format(p, link)
ps = soup.find_all("p")
first_para = None
for p in ps:
if p.get_text().strip():
first_para = str(p)[:8000]
break

return f"{first_para}\n{link}"


def on_message(msg, server):
Expand Down
35 changes: 0 additions & 35 deletions limbo/plugins/youtube.py

This file was deleted.

1 change: 0 additions & 1 deletion requirements-to-freeze.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ flake8
pytest
pytest-cov
vcrpy
tox

# banner plugin
pyfiglet
Expand Down
61 changes: 25 additions & 36 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,40 +1,29 @@
attrs==21.4.0
beautifulsoup4==4.10.0
certifi==2021.10.8
charset-normalizer==2.0.12
coverage==6.3.2
distlib==0.3.4
filelock==3.6.0
flake8==4.0.1
beautifulsoup4==4.12.3
certifi==2024.2.2
charset-normalizer==3.3.2
coverage==7.4.3
exceptiongroup==1.2.0
flake8==7.0.0
html5lib==1.1
idna==3.3
importlib-metadata==4.2.0
iniconfig==1.1.1
mccabe==0.6.1
multidict==6.0.2
packaging==21.3
platformdirs==2.5.1
pluggy==1.0.0
py==1.11.0
pycodestyle==2.8.0
pyfiglet==0.8.post1
pyflakes==2.4.0
pyparsing==3.0.7
pytest==7.0.1
pytest-cov==3.0.0
PyYAML==6.0
requests==2.27.1
idna==3.6
iniconfig==2.0.0
mccabe==0.7.0
multidict==6.0.5
packaging==23.2
pluggy==1.4.0
pycodestyle==2.11.1
pyfiglet==1.0.2
pyflakes==3.2.0
pytest==8.1.1
pytest-cov==4.1.0
PyYAML==6.0.1
requests==2.31.0
six==1.16.0
soupsieve==2.3.1
toml==0.10.2
soupsieve==2.5
tomli==2.0.1
tox==3.24.5
typing-extensions==4.1.1
urllib3==1.26.8
vcrpy==4.1.1
virtualenv==20.13.1
urllib3==2.2.1
vcrpy==6.0.1
webencodings==0.5.1
websocket-client==1.2.3
wrapt==1.13.3
yarl==1.7.2
zipp==3.7.0
websocket-client==1.7.0
wrapt==1.16.0
yarl==1.9.4
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
Loading

0 comments on commit 5a0e28e

Please sign in to comment.