There are cases where the call to an endpoint may result in an
exception the traceback for which is converted into JSON and
returned to the caller. In the case of such an unsuccessful
response, we should just reraise the exception instead of parsing
the response as though it was successful.
The documented API for DELETE /api/v1/users/me/subscriptions is that
principals should be omitted to remove a subscription for the calling
user. A call with principals=[] should have a different meaning, but
a server bug currently conflates this with a call omitting principals.
Avoid relying on this bug.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
pip 10 was the first release to support PEP 518. Using pip<10
can lead to errors when installing dependencies.
Thanks to @andersk for suggesting this fix!
This script has been outdated for a long time now and has been
obsoleted by some recent changes in how packages should be built
and distributed. In general, the release process is now too
complicated to automate, so we are better off just making the
release manually.
This change is intended to reduce confusion between zulip-bot-shell
(test bots interactively without a server) and the zulip/zulip-terminal
project and its associated command (zulip-term).
The username doesn't include the Matrix homeserver domain name, while
the mxid does. Since we change the usage of the old "username" to
include the domain, it is incorrect to remain saying it as "username."
According to the `setuptools` docs, once `include_package_data=True`
is passed to `setup()`, it will only include package data specified
in `MANIFEST.in`, and will ignore the `package_data` argument passed
to `setup()`. Thus, the `py.typed` file was not included in our
latest PyPI release 0.8.1.
A quick way to fix this is to remove the `include_package_data=True`
argument and to let our explicit `package_data` argument values
govern what data is included in the release.
See https://github.com/pypa/setuptools/issues/1461 for background.
According to the `setuptools` docs, once `include_package_data=True`
is passed to `setup()`, it will only include package data specified
in `MANIFEST.in`, and will ignore the `package_data` argument passed
to `setup()`. Therefore, `py.typed` was not included in our latest
PyPI release 0.8.1.
Since we specify all of our package data in the `MANIFEST.in` file
already, it makes more sense to include mention `py.typed` there so
that it is included in the expected fashion.
See https://github.com/pypa/setuptools/issues/1461 for background.
Fixes#732.
As part of supporting the change in zulip/zulip#18409, we add a
conditional to send the old/buggy format only to servers with feature
levels indicating they don't support the modern version.
To make sure that the API bindings is backward compatible with
older versions of zulip server that uses functions with different
signatures, we use a hack to replace the Client class with a
legacy-compatible version of it.
Without universal_newlines=True or text=True, subprocess.check_output
returns bytes, not str, so it makes no sense to compare its return to
"true". But upstream Git’s behavior only depends on the filename, not
whether the repository is bare; emulate this more closely.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
Add packaged_helloworld as an example of a PyPI package setup for
an external zulip bot that can be installed via pip and lanuched
without the need to include it in the zulip_bots/bots directory.
Now we will be able to execute `zulip-run-bot` with the `-r` argument
to search for and run bots from the `zulip_bots.registry` entry_point.
Each entry point should have the name correspond to the bot name,
and have the value be the bot module. E.g, an Python package for a
bot called "packaged_bot" should have an `entry_points` setup like
the following:
setup(
...
entry_points={
"zulip_bot.registry":[
"packaged_bot=packaged_bot.packaged_bot"
]
}
...
)
whose file structure may look like this:
packaged_bot/
├───packaged_bot/
| ├───packaged_bot.py # The bot module
| ├───test_packaged_bot.py
| ├───packaged_bot.conf
| └───doc.md
└───setup.py # Register the entry points here
Add test case.