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).
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.
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.
The `BotStorage` Protocol is created to add a common type to all
storage classes.
Note: Protocol is imported from `typing_extensions` as `typing`
doesn't provide Protocol for python <= 3.7.
A lot of these bot dependencies are pretty hefty and shouldn't be
installed as part of the zulip_bots package. So the installation of
these belongs in tools/provision, not in setup.py.
The pip documentation recommends calling pip using a subprocess, instead of
importing it and using it's internal API. The API of pip==10.0.0 is different
from that of older versions, and provisioning is broken with this version.
[pip docs]:
https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-programCloses#370