Commit graph

157 commits

Author SHA1 Message Date
Anders Kaseorg
0715d1f46c zulip_botserver: Turn off Flask debug mode.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-21 15:07:37 -08:00
Anders Kaseorg
28cae1a71c Release version 0.9.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-14 16:16:17 -08:00
Anders Kaseorg
aeb89bcae5 ruff: Enable lots of rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-11 16:16:17 -08:00
Anders Kaseorg
347490c647 ruff: Fix RUF015 Prefer next(iter(…)) over single element slice.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
5e708e3661 ruff: Fix N803 Argument name should be lowercase.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
ca3e5a2746 ruff: Fix EXE001 Shebang is present but file is not executable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 16:54:40 -07:00
Anders Kaseorg
6b2861c3ec ruff: Fix G004 Logging statement uses f-string.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-28 16:18:11 -07:00
Anders Kaseorg
e537bbefdf ruff: Fix G001 Logging statement uses str.format.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-28 16:17:21 -07:00
Anders Kaseorg
ddccf0eda3 ruff: Fix UP032 Use f-string instead of format call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-27 22:01:58 -07:00
Anders Kaseorg
6cb1d5f775 mypy: Enable explicit-override error.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-26 14:03:17 -07:00
Anders Kaseorg
e747d3b712 mypy: Enable no_implicit_reexport.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-26 13:38:57 -07:00
Anders Kaseorg
f55d5ea555 Mark Python 3.11 supported.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 16:00:47 -07:00
Anders Kaseorg
8eb3d4e1e2 Upgrade requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 13:23:51 -07:00
Anders Kaseorg
98e23bdfd4 Remove Python 3.7 support.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 13:23:37 -07:00
Anders Kaseorg
a9607dfdf9 Convert type comments to Python ≥ 3.6 variable annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-18 01:04:47 -07:00
Prakhar Pratyush
ccda105d1d bot_server: Support trigger private_message renamed to direct_message.
The JSON payload that Zulip server POST for outgoing webhooks
has 'trigger' as one of the fields.

In https://github.com/zulip/zulip/commit/c4e4737, we renamed
the 'private_message' value to 'direct_message'.

This commit adds support to the botserver for handling
'direct_message' as a trigger value. It still supports
'private_message' for self-hosted server compatibility.
2023-09-21 09:13:40 -07:00
Anders Kaseorg
c94da617ed Remove Python 3.6; add Python 3.10.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-24 12:04:59 -08:00
Anders Kaseorg
d26416a1e7 Release version 0.8.2.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-15 17:44:12 -07:00
Anders Kaseorg
05d591a906 Remove legacy distutils support.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-28 10:35:58 -08:00
Eeshan Garg
fec8cc50c4 pypi: Release version 0.8.1. 2021-10-19 18:03:52 -04:00
PIG208
05b9850ba3 api: Fetch server_settings when initializing Client.
We store the information about the version of the server and the feature
level for transparent compatibility handling.
2021-10-13 09:26:56 -07:00
Anders Kaseorg
d32d442c44 Upgrade mypy to 0.910.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 20:19:05 -07:00
Anders Kaseorg
626359596e Replace typing.Text with str.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 20:07:35 -07:00
Anders Kaseorg
e8bb65b188 tests: Replace deprecated assertRaisesRegexp with assertRaisesRegex.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 17:20:53 -07:00
PIG208
285a946a1f bot_server: Add support for running botserver from bots registry. 2021-07-29 11:08:33 -07:00
PIG208
4fd29baf2b bot_server: Reuse import_module_from_source to load bot modules from paths.
This removes the need to have `load_module_from_file`.
2021-07-22 12:18:34 +08:00
PIG208
a87303beb1 zulip_botserver: Fix path finding for external bots.
The previous implementation to locate the `bot_dir` is unfortunately
wrong as it doesn't work with the external custom bots.
2021-07-22 11:14:52 +08:00
PIG208
9ce7c52a10 pyupgrade: Reformat with --py36-plus.
This includes mainly fixes of string literals using f-strings or
.format(...), as well as unpacking of list comprehensions.
2021-06-02 18:45:57 -07:00
PIG208
6f3f9bf7e4 black: Reformat without skipping string normalization. 2021-06-02 18:45:57 -07:00
PIG208
fba21bb00d black: Reformat skipping string normalization. 2021-06-02 18:45:57 -07:00
PIG208
5580c68ae5 isort: Reformat using isort. 2021-06-02 18:45:57 -07:00
Eeshan Garg
63fefd2a0f pypi: Release version 0.8.0. 2021-05-19 22:44:45 -02:30
LoopThrough-i-j
dda9e0a638 botserver: Fix mypy error.
Value of type "Optional[Any]" is not indexable error
was originated in PR #682. This is due to request in Flask 2.0.
2021-05-12 15:17:52 -07:00
PIG208
5b32b32914 botserver: Return a valid JSON that is acceptable to outgoing webhooks.
In zulip/zulip@b998138d3a, we introduce
a check for responses from outgoing webhooks that require them to be
a dictionary. This commit fixes the return value of the botserver view
function to accommodate with the change from the serverside.
2021-05-11 09:08:04 -07:00
Anders Kaseorg
19f5b4f6a6 mypy: Fix exec_module type: ignore comments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-10 09:58:18 -08:00
Anders Kaseorg
30f241a126 mypy: Remove unused type: ignore comments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:09:58 -08:00
Ganesh Pawar
44b6fd395a tests: Fix tests failing on Windows.
Tests were failing on Windows since paths are case-insensitive on it.
This uses pathlib library to compare paths on all platforms.

Fixes #651
2021-03-04 11:28:35 -08:00
LoopThrough-i-j
1fb3d529a9 zulip-bots: Set bot_handler type to BotHandler.
- Set `bot_handler` type to `BotHandler`.
- Fix mypy issues in improperly typed variables, params and returns.

Fixes part of #639
2021-03-03 13:31:50 -08:00
LoopThrough-i-j
3887ad102e python-zulip-api: Drop python3.5 support.
Fixes Part of #655
2021-02-26 07:32:47 -08:00
Alex Vandiver
385fb51f01 zulip-botserver: Document use of environment var in README.md 2021-01-07 00:31:26 -08:00
LoopThrough-i-j
bcf183d2b1 zulip-botserver: Allow passing config via JSON formatted environment variable.
Fixes #485.

Co-authored-by: Alex Vandiver <alexmv@zulip.com>
2021-01-07 00:31:26 -08:00
Eeshan Garg
befbb953dd pypi: Release version 0.7.1. 2020-10-09 15:50:43 -02:30
Anders Kaseorg
5f81eb3a70 Update zulipchat.com links to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
neiljp (Neil Pilgrim)
540d453237 setup.py: Add Source & Documentation project_urls.
The only existing url points to zulip.org -> zulipchat.com
2020-05-05 09:20:50 -04:00
Eeshan Garg
1dac75f979 pypi: Release version 0.7.0. 2020-04-20 23:23:58 -02:30
Anders Kaseorg
6f40bcf745 cleanup: Fix whitespace around parameter equals.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg
54b2578204 cleanup: Remove unused variables.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg
2f6623bbc4 cleanup: Remove unused imports.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg
5428c5f296 typing: Convert function type annotations to Python 3 style.
Generated by com2ann (slightly patched to avoid also converting
assignment type annotations, which require Python 3.6), followed by
some manual whitespace adjustment, and two fixes for use-before-define
issues:

-    def set_zulip_client(self, zulipToJabberClient: ZulipToJabberBot) -> None:
+    def set_zulip_client(self, zulipToJabberClient: 'ZulipToJabberBot') -> None:

-def init_from_options(options: Any, client: Optional[str] = None) -> Client:
+def init_from_options(options: Any, client: Optional[str] = None) -> 'Client':

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg
fe72f3b131 typing: Remove ‘if False’ guard for typing imports.
typing is in the Python 3.5 standard library.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00