Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zulip/python-zulip-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1cf372497c5a47c1bbca2ef18c7ce9ddbc9441c4
Choose a base ref
..
head repository: zulip/python-zulip-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9eca925d7df838797600a40120dc61c278a729b4
Choose a head ref
Showing with 1,790 additions and 1,186 deletions.
  1. +2 −2 .editorconfig
  2. +64 −0 .github/workflows/zulip-tests.yml
  3. +15 −0 .gitlint
  4. +0 −24 .travis.yml
  5. +13 −12 README.md
  6. +5 −0 mypy.ini
  7. +3 −2 requirements.txt
  8. +65 −0 stubs/_zephyr.pyi
  9. +13 −0 stubs/zephyr.pyi
  10. +145 −0 tools/gitlint-rules.py
  11. +4 −1 tools/lint
  12. +27 −0 tools/lint-commits
  13. +11 −18 tools/provision
  14. +7 −0 tools/test-main.ps1
  15. +0 −6 tools/test-static-analysis
  16. +1 −1 zulip/README.md
  17. +2 −2 zulip/integrations/bridge_with_irc/irc_mirror_backend.py
  18. +1 −1 zulip/integrations/bridge_with_matrix/matrix_bridge.py
  19. +4 −2 zulip/integrations/codebase/zulip_codebase_config.py
  20. +4 −5 zulip/integrations/codebase/zulip_codebase_mirror
  21. +1 −1 zulip/integrations/git/zulip_git_config.py
  22. +1 −1 zulip/integrations/jabber/jabber_mirror_backend.py
  23. +1 −1 zulip/integrations/log2zulip/log2zulip
  24. +2 −2 zulip/integrations/perforce/zulip_perforce_config.py
  25. +2 −1 zulip/integrations/rss/rss-bot
  26. +1 −1 zulip/integrations/svn/zulip_svn_config.py
  27. +1 −1 zulip/integrations/trac/zulip_trac.py
  28. +3 −1 zulip/integrations/trac/zulip_trac_config.py
  29. +7 −7 zulip/integrations/zephyr/check-mirroring
  30. +1 −1 zulip/integrations/zephyr/process_ccache
  31. +51 −52 zulip/integrations/zephyr/zephyr_mirror_backend.py
  32. +2 −2 zulip/setup.py
  33. +1 −1 zulip/tests/test_default_arguments.py
  34. +938 −782 zulip/zulip/__init__.py
  35. +1 −1 zulip/zulip/examples/{list-subscriptions → get-subscriptions}
  36. +1 −1 zulip/zulip/send.py
  37. +3 −2 zulip_bots/setup.py
  38. +4 −3 zulip_bots/zulip_bots/bots/baremetrics/baremetrics.py
  39. +4 −3 zulip_bots/zulip_bots/bots/beeminder/beeminder.py
  40. +12 −11 zulip_bots/zulip_bots/bots/chessbot/chessbot.py
  41. +3 −2 zulip_bots/zulip_bots/bots/converter/converter.py
  42. +3 −2 zulip_bots/zulip_bots/bots/define/define.py
  43. +4 −3 zulip_bots/zulip_bots/bots/dialogflow/dialogflow.py
  44. +4 −3 zulip_bots/zulip_bots/bots/dropbox_share/dropbox_share.py
  45. +17 −17 zulip_bots/zulip_bots/bots/dropbox_share/test_dropbox_share.py
  46. +3 −2 zulip_bots/zulip_bots/bots/encrypt/encrypt.py
  47. +3 −2 zulip_bots/zulip_bots/bots/file_uploader/file_uploader.py
  48. +1 −1 zulip_bots/zulip_bots/bots/file_uploader/test_file_uploader.py
  49. +3 −2 zulip_bots/zulip_bots/bots/flock/flock.py
  50. +4 −3 zulip_bots/zulip_bots/bots/followup/followup.py
  51. +9 −8 zulip_bots/zulip_bots/bots/front/front.py
  52. +7 −10 zulip_bots/zulip_bots/bots/game_handler_bot/test_game_handler_bot.py
  53. +7 −6 zulip_bots/zulip_bots/bots/giphy/giphy.py
  54. +3 −2 zulip_bots/zulip_bots/bots/github_detail/github_detail.py
  55. +3 −2 zulip_bots/zulip_bots/bots/google_search/google_search.py
  56. +2 −1 zulip_bots/zulip_bots/bots/helloworld/helloworld.py
  57. +3 −2 zulip_bots/zulip_bots/bots/help/help.py
  58. +3 −2 zulip_bots/zulip_bots/bots/idonethis/idonethis.py
  59. +3 −2 zulip_bots/zulip_bots/bots/incident/incident.py
  60. +6 −4 zulip_bots/zulip_bots/bots/incrementor/incrementor.py
  61. +3 −2 zulip_bots/zulip_bots/bots/jira/jira.py
  62. +4 −3 zulip_bots/zulip_bots/bots/link_shortener/link_shortener.py
  63. +4 −3 zulip_bots/zulip_bots/bots/mention/mention.py
  64. +4 −4 zulip_bots/zulip_bots/bots/monkeytestit/monkeytestit.py
  65. +0 −4 zulip_bots/zulip_bots/bots/monkeytestit/test_monkeytestit.py
  66. +4 −3 zulip_bots/zulip_bots/bots/salesforce/salesforce.py
  67. +4 −3 zulip_bots/zulip_bots/bots/stack_overflow/stack_overflow.py
  68. +3 −2 zulip_bots/zulip_bots/bots/susi/susi.py
  69. +1 −1 zulip_bots/zulip_bots/bots/trello/test_trello.py
  70. +4 −4 zulip_bots/zulip_bots/bots/trello/trello.py
  71. +6 −5 zulip_bots/zulip_bots/bots/trivia_quiz/trivia_quiz.py
  72. +4 −4 zulip_bots/zulip_bots/bots/twitpost/twitpost.py
  73. +2 −1 zulip_bots/zulip_bots/bots/virtual_fs/virtual_fs.py
  74. +4 −3 zulip_bots/zulip_bots/bots/weather/weather.py
  75. +4 −3 zulip_bots/zulip_bots/bots/wikipedia/wikipedia.py
  76. +7 −5 zulip_bots/zulip_bots/bots/witai/witai.py
  77. +8 −7 zulip_bots/zulip_bots/bots/xkcd/xkcd.py
  78. +7 −6 zulip_bots/zulip_bots/bots/yoda/yoda.py
  79. +4 −3 zulip_bots/zulip_bots/bots/youtube/youtube.py
  80. +14 −22 zulip_bots/zulip_bots/finder.py
  81. +12 −23 zulip_bots/zulip_bots/game_handler.py
  82. +47 −6 zulip_bots/zulip_bots/lib.py
  83. +1 −1 zulip_bots/zulip_bots/request_test_lib.py
  84. +2 −2 zulip_bots/zulip_bots/run.py
  85. +1 −1 zulip_bots/zulip_bots/simple_lib.py
  86. +2 −1 zulip_bots/zulip_bots/test_lib.py
  87. +3 −3 zulip_bots/zulip_bots/tests/test_finder.py
  88. +6 −4 zulip_bots/zulip_bots/tests/test_run.py
  89. +19 −6 zulip_botserver/README.md
  90. +2 −2 zulip_botserver/setup.py
  91. +38 −7 zulip_botserver/tests/test_server.py
  92. +8 −2 zulip_botserver/zulip_botserver/input_parameters.py
  93. +44 −13 zulip_botserver/zulip_botserver/server.py
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -10,11 +10,11 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{sh,py,pyi,js,json,yml,xml,css,md,markdown,handlebars,html}]
[*.{sh,py,pyi,js,json,xml,css,md,markdown,handlebars,html}]
indent_style = space
indent_size = 4

[*.{svg,rb,pp,pl}]
[*.{svg,rb,pp,pl,yaml,yml}]
indent_style = space
indent_size = 2

64 changes: 64 additions & 0 deletions .github/workflows/zulip-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: build

on:
push:
branches:
- master
pull_request:

jobs:
static-analysis:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6

- name: Install dependencies
run: tools/provision --force

- name: Running Test-Suite
run: |
source zulip-api-py3-venv/bin/activate
tools/lint --skip=gitlint
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
exclude:
- os: windows-latest
python-version: 3.6 # cryptography install fails on Windows with python 3.6 since pip is quite old.

steps:
- uses: actions/checkout@v2

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: python tools/provision --force

- if: runner.os == 'Linux'
name: Running Test-Suite on Linux
run: |
source zulip-api-py3-venv/bin/activate
tools/test-main
- if: runner.os == 'Windows'
name: Running Test-Suite on Windows
run: |
zulip-api-py3-venv\Scripts\Activate.ps1
tools\test-main.ps1
- name: Codecov
uses: codecov/codecov-action@v1.2.1
15 changes: 15 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is copied from the original .gitlint at zulip/zulip.
# Please don't edit here; instead update the zulip/zulip copy and then resync this file.

[general]
ignore=title-trailing-punctuation, body-min-length, body-is-missing
extra-path=tools/gitlint-rules.py

[title-match-regex]
regex=^(.+:\ )?[A-Z].+\.$

[title-max-length]
line-length=76

[body-max-line-length]
line-length=76
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Zulip API

[![Build status](https://travis-ci.com/zulip/python-zulip-api.svg?branch=master)](https://travis-ci.com/github/zulip/python-zulip-api)
[![Build status](https://github.com/zulip/python-zulip-api/workflows/build/badge.svg?branch=master)](
https://github.com/zulip/python-zulip-api/actions?query=branch%3Amaster+workflow%3Abuild)
[![Coverage status](https://img.shields.io/codecov/c/github/zulip/python-zulip-api/master.svg)](
https://codecov.io/gh/zulip/python-zulip-api)

@@ -21,17 +22,17 @@ This is part of the Zulip open source project; see the
[contributing guide](https://zulip.readthedocs.io/en/latest/overview/contributing.html)
and [commit guidelines](https://zulip.readthedocs.io/en/latest/contributing/version-control.html).

1. Fork and clone the Git repo:
`git clone https://github.com/<your_username>/python-zulip-api.git`

2. Make sure you have [pip](https://pip.pypa.io/en/stable/installing/)
and [virtualenv](https://virtualenv.pypa.io/en/stable/installation.html)
installed.
1. Fork and clone the Git repo, and set upstream to zulip/python-zulip-api:
```
git clone https://github.com/<your_username>/python-zulip-api.git
cd python-zulip-api
git remote add upstream https://github.com/zulip/python-zulip-api.git
git fetch upstream
```

3. `cd` into the repository cloned earlier:
`cd python-zulip-api`
2. Make sure you have [pip](https://pip.pypa.io/en/stable/installing/).

4. Run:
3. Run:
```
python3 ./tools/provision
```
@@ -42,14 +43,14 @@ and [commit guidelines](https://zulip.readthedocs.io/en/latest/contributing/vers
python3 ./tools/provision -p <path_to_your_python_version>
```

5. If that succeeds, it will end with printing the following command:
4. If that succeeds, it will end with printing the following command:
```
source /.../python-zulip-api/.../activate
```
You can run this command to enter the virtual environment.
You'll want to run this in each new shell before running commands from `python-zulip-api`.

6. Once you've entered the virtualenv, you should see something like this on the terminal:
5. Once you've entered the virtualenv, you should see something like this on the terminal:
```
(zulip-api-py3-venv) user@pc ~/python-zulip-api $
```
5 changes: 5 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[mypy]
mypy_path = $MYPY_CONFIG_FILE_DIR/stubs

check_untyped_defs = True
disallow_any_generics = True
strict_optional = True
@@ -9,3 +11,6 @@ scripts_are_modules = True
show_traceback = True

warn_no_return = True
warn_redundant_casts = True
warn_unused_ignores = True
warn_unreachable = True
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -7,5 +7,6 @@ pytest
-e ./zulip
-e ./zulip_bots
-e ./zulip_botserver
-e git+https://github.com/zulip/zulint@639c0d34c23ac559ef0f7b9510cf95f73f6d0eb9#egg=zulint==1.0.0
mypy==0.770
-e git+https://github.com/zulip/zulint@14e3974001bf8442a6a3486125865660f1f2eb68#egg=zulint==1.0.0
mypy==0.812
gitlint>=0.13.0
65 changes: 65 additions & 0 deletions stubs/_zephyr.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from typing import List, Optional, Sequence, Tuple, overload

from typing_extensions import Literal

class ZUid:
address: str
time: float

class ZNotice:
kind: int
cls: str
instance: str
uid: ZUid
time: int
port: int
auth: bool
recipient: Optional[str]
sender: Optional[str]
opcode: Optional[str]
format: str
other_fields: List[str]
fields: List[str]
_charset: Optional[str]
def __init__(
self,
kind: int = ...,
cls: str = ...,
instance: str = ...,
uid: ZUid = ...,
time: int = ...,
port: int = ...,
auth: bool = ...,
recipient: Optional[str] = ...,
sender: Optional[str] = ...,
opcode: Optional[str] = ...,
format: str = ...,
other_fields: List[str] = ...,
fields: List[str] = ...,
_charset: Optional[str] = ...,
message: str = ...,
): ...
def getmessage(self) -> str: ...
def setmessage(self, newmsg: str) -> None: ...
message = property(getmessage, setmessage)
@property
def charset(self) -> Optional[str]: ...
def send(self) -> None: ...

def initialize() -> None: ...
def openPort() -> int: ...
def getFD() -> int: ...
def setFD(fd: int) -> None: ...
def sub(cls: str, instance: str, recipient: str) -> None: ...
def subAll(lst: Sequence[Tuple[str, str, str]]) -> None: ...
def unsub(cls: str, instance: str, recipient: str) -> None: ...
def cancelSubs() -> None: ...
@overload
def receive(block: Literal[True]) -> ZNotice: ...
@overload
def receive(block: bool = ...) -> Optional[ZNotice]: ...
def sender() -> str: ...
def realm() -> str: ...
def dump_session() -> bytes: ...
def load_session(session: bytes) -> None: ...
def getSubscriptions() -> List[Tuple[str, str, str]]: ...
13 changes: 13 additions & 0 deletions stubs/zephyr.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from typing import Set, Tuple

import _zephyr
from _zephyr import ZNotice as ZNotice
from _zephyr import receive as receive

_z = _zephyr
__inited: bool

def init() -> None: ...

class Subscriptions(Set[Tuple[str, str, str]]):
pass
Loading