This method allows bots to validate their config info
in a standardized way. Adding the method to a bot is
optional, but recommended for bots with config options
that can be invalid, like api keys. The giphy bot serves
as an example.
The primary reason behind this is to allow the zulip
backend to validate config data for embedded bots. The
backend does not have a permanent bot class instance, so
validate_config() must be a static method.
Previously, remove_subscriptions called the
PATCH /api/v1/users/me/subscriptions endpoint, which is more like
an ad-hoc endpoint for bulk adding/removing subscriptions for the
user that makes the request. However, making a DELETE request
allows an admin to pass in the `principals` argument to unsubscribe
other users from streams as well, which is more consistent with how
add_subscriptions works.
The zulip and zulip_botserver packages specify mock as a runtime
dependency, which is only needed for testing during development.
So, it made more sense to move it to requirements.txt so that
it can be installed by ./tools/provision during development.
In python3, if you removed a directory that files within it,
you would get an error saying "dictionary changed size
during iteration."
The fix is to list-ify the keys before iterating over them (and
popping keys from the dictionary).
Now that zulip_bots is fully Python3, it makes sense to only
generate a Python3 wheel dist for it. zulip and zulip_botserver
are still distributed as a py2/py3 universal wheel.
Now that we do not use MANIFEST.in for zulip_bots, it doesn't
make sense to distribute sdists, because sdists don't pick up
data files specified in the package_data argument to setup().
Also, it isn't a huge deal if we don't distribute sdists for our
packages. Most PyPI projects only release wheels and pip will also
use wheels if available. So, this made sense!
This commit removes generate_manifest.py and package data files
are now included using the package_data kwarg to setup().
This is because, in certain situations, MANIFEST.in is a bit
finicky. For instance installing a package using:
python setup.py install
doesn't include files specified in MANIFEST.in, while using
pip install ./zulip_bots
does. package_data doesn't pose this problem, ergo it's better
for us.
mypy with strict-optional led to examination of res.get('result')
calls potentially raising TypeError ('error' in None).
Server code indicates this is safe, and other nearby code assumes
presence of fields in 'res' also.