Skip to content

Commit 85ead96

Browse files
committed
Merge main
2 parents 6079178 + 75bea9f commit 85ead96

File tree

248 files changed

+12624
-9835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+12624
-9835
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ charset = utf-8
1010
trim_trailing_whitespace = true
1111
insert_final_newline = true
1212

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

17-
[*.{svg,rb,pp,pl}]
17+
[*.{svg,rb,pp,pl,yaml,yml}]
1818
indent_style = space
1919
indent_size = 2
2020

.flake8

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
github: zulip
2+
patreon: zulip
3+
open_collective: zulip

.github/workflows/zulip-ci.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# This file is largely copied from the Zulip server's continuous
2+
# integration. The intent is to run the Zulip server's API
3+
# documentation test suite using the current version of this project,
4+
# to verify that the API client is generally compatible with the old
5+
# server release.
6+
name: Zulip server CI
7+
8+
on: [push, pull_request]
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
tests:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
# Focal ships with Python 3.8.10.
21+
- docker_image: zulip/ci:focal
22+
name: Ubuntu 20.04 (Python 3.8, backend)
23+
os: focal
24+
legacy_client_interface: "3"
25+
server_version: refs/tags/3.2
26+
# Bullseye ships with Python 3.9.2.
27+
- docker_image: zulip/ci:bullseye
28+
name: Debian 11 (Python 3.9, backend)
29+
os: bullseye
30+
legacy_client_interface: "4"
31+
server_version: refs/tags/4.0
32+
# Ubuntu 22.04 ships with Python 3.10.6.
33+
- docker_image: zulip/ci:jammy
34+
name: Ubuntu 22.04 (Python 3.10, backend)
35+
os: jammy
36+
legacy_client_interface: "6"
37+
server_version: refs/tags/6.0
38+
39+
runs-on: ubuntu-latest
40+
name: ${{ matrix.name }} (Zulip ${{matrix.server_version}})
41+
container: ${{ matrix.docker_image }}
42+
env:
43+
# GitHub Actions sets HOME to /github/home which causes
44+
# problem later in provison and frontend test that runs
45+
# tools/setup/postgresql-init-dev-db because of the .pgpass
46+
# location. PostgreSQL (psql) expects .pgpass to be at
47+
# /home/github/.pgpass and setting home to `/home/github/`
48+
# ensures it written there because we write it to ~/.pgpass.
49+
HOME: /home/github/
50+
51+
steps:
52+
- name: "Check out python-zulip-api"
53+
uses: actions/checkout@v4
54+
with:
55+
path: api
56+
57+
- name: "Check out Zulip server ${{ matrix.server_version }}"
58+
uses: actions/checkout@v4
59+
with:
60+
repository: zulip/zulip
61+
ref: ${{ matrix.server_version }}
62+
path: server
63+
64+
- name: Install dependencies
65+
run: |
66+
cd server
67+
# This is the main setup job for the test suite
68+
./tools/ci/setup-backend --skip-dev-db-build
69+
70+
# Cleaning caches is mostly unnecessary in GitHub Actions, because
71+
# most builds don't get to write to the cache.
72+
# scripts/lib/clean_unused_caches.py --verbose --threshold 0
73+
74+
- name: Replace dependency with the latest python-zulip-api
75+
run: |
76+
cd server
77+
source tools/ci/activate-venv
78+
pip install ../api/zulip
79+
pip install ../api/zulip_bots
80+
81+
- name: Run documentation and api tests
82+
run: |
83+
cd server
84+
source tools/ci/activate-venv
85+
./tools/test-api
86+
env:
87+
LEGACY_CLIENT_INTERFACE_FROM_SERVER_DOCS_VERSION: ${{ matrix.legacy_client_interface }}
88+
89+
- name: Run backend tests
90+
run: |
91+
cd server
92+
source tools/ci/activate-venv
93+
./tools/test-backend zerver.tests.test_bots zerver.tests.test_embedded_bot_system
94+
env:
95+
LEGACY_CLIENT_INTERFACE_FROM_SERVER_DOCS_VERSION: ${{ matrix.legacy_client_interface }}

.github/workflows/zulip-tests.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
static-analysis:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python 3.8
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.8"
20+
21+
- name: Install dependencies
22+
run: tools/provision --force
23+
24+
- name: Running Test-Suite
25+
run: |
26+
source zulip-api-py3-venv/bin/activate
27+
tools/lint --skip=gitlint
28+
29+
test:
30+
runs-on: ${{ matrix.os }}
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
os: [ubuntu-latest, windows-latest]
35+
python-version: ["3.8", "3.9", "3.10", "3.11"]
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Set up Python ${{ matrix.python-version }}
41+
uses: actions/setup-python@v4
42+
with:
43+
python-version: ${{ matrix.python-version }}
44+
45+
- name: Install dependencies
46+
run: python tools/provision --force
47+
48+
- if: runner.os == 'Linux'
49+
name: Running Test-Suite on Linux
50+
run: |
51+
source zulip-api-py3-venv/bin/activate
52+
pytest --cov --cov-config=tools/.coveragerc --cov-report=xml
53+
54+
- if: runner.os == 'Windows'
55+
name: Running Test-Suite on Windows
56+
run: |
57+
zulip-api-py3-venv\Scripts\Activate.ps1
58+
pytest --cov --cov-config=tools\.coveragerc --cov-report=xml
59+
60+
- uses: codecov/codecov-action@v4
61+
with:
62+
files: coverage.xml
63+
token: ${{ secrets.CODECOV_TOKEN }}

.gitlint

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is copied from the original .gitlint at zulip/zulip.
2+
# Please don't edit here; instead update the zulip/zulip copy and then resync this file.
3+
4+
[general]
5+
ignore=title-trailing-punctuation, body-min-length, body-is-missing
6+
extra-path=tools/gitlint-rules.py
7+
8+
[title-match-regex]
9+
regex=^(.+:\ )?[A-Z].+\.$
10+
11+
[title-max-length]
12+
line-length=76
13+
14+
[body-max-line-length]
15+
line-length=76

.mailmap

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1+
2+
Aman Agrawal <[email protected]>
13
24
5+
6+
7+
8+
9+
10+
11+
Rein Zustand (rht) <[email protected]>
312
13+
14+
415
516
617
718
819
920
21+
22+
23+
24+
25+
26+
27+
28+

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Zulip API
22

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

78
This repository contains the source code for Zulip's PyPI packages:
@@ -21,17 +22,17 @@ This is part of the Zulip open source project; see the
2122
[contributing guide](https://zulip.readthedocs.io/en/latest/overview/contributing.html)
2223
and [commit guidelines](https://zulip.readthedocs.io/en/latest/contributing/version-control.html).
2324

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

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

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

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

52-
6. Once you've entered the virtualenv, you should see something like this on the terminal:
53+
5. Once you've entered the virtualenv, you should see something like this on the terminal:
5354
```
5455
(zulip-api-py3-venv) user@pc ~/python-zulip-api $
5556
```
@@ -58,13 +59,14 @@ and [commit guidelines](https://zulip.readthedocs.io/en/latest/contributing/vers
5859

5960
### Running tests
6061

61-
To run the tests for
62-
63-
* *zulip*: run `./tools/test-zulip`
62+
You can run all the tests with:
6463

65-
* *zulip_bots*: run `./tools/test-lib && ./tools/test-bots`
64+
`pytest`
6665

67-
* *zulip_botserver*: run `./tools/test-botserver`
66+
or test individual packages with `pytest zulip`, `pytest zulip_bots`,
67+
or `pytest zulip_botserver` (see the [pytest
68+
documentation](https://docs.pytest.org/en/latest/how-to/usage.html)
69+
for more options).
6870

6971
To run the linter, type:
7072

mypy.ini

Lines changed: 0 additions & 11 deletions
This file was deleted.

packaged_helloworld/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This is a boilerplate package for a Zulip bot that can be installed from pip
2+
and launched using the `zulip-run-bots` command.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "1.0.0"

0 commit comments

Comments
 (0)