2017-07-18 01:49:51 -02:30
|
|
|
# Zulip API
|
2012-11-27 11:19:05 -05:00
|
|
|
|
2021-08-24 12:50:52 -07:00
|
|
|
[](
|
|
|
|
https://github.com/zulip/python-zulip-api/actions?query=branch%3Amain+workflow%3Abuild)
|
|
|
|
[](
|
2017-08-22 10:02:25 +02:00
|
|
|
https://codecov.io/gh/zulip/python-zulip-api)
|
|
|
|
|
2017-07-18 01:49:51 -02:30
|
|
|
This repository contains the source code for Zulip's PyPI packages:
|
2012-11-26 11:54:21 -05:00
|
|
|
|
2017-07-18 01:49:51 -02:30
|
|
|
* `zulip`: [PyPI package](https://pypi.python.org/pypi/zulip/)
|
|
|
|
for Zulip's API bindings.
|
2017-08-07 20:40:20 -02:30
|
|
|
* `zulip_bots`: [PyPI package](https://pypi.python.org/pypi/zulip-bots)
|
|
|
|
for Zulip's bots and bots API.
|
|
|
|
* `zulip_botserver`: [PyPI package](https://pypi.python.org/pypi/zulip-botserver)
|
2018-05-29 10:58:37 +02:00
|
|
|
for Zulip's Flask Botserver.
|
2017-08-07 20:53:15 -02:30
|
|
|
|
2017-11-29 06:36:58 -08:00
|
|
|
The source code is written in *Python 3*.
|
|
|
|
|
2017-08-07 20:53:15 -02:30
|
|
|
## Development
|
|
|
|
|
2018-11-15 15:58:04 -08:00
|
|
|
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).
|
|
|
|
|
2021-02-25 09:42:35 +05:30
|
|
|
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
|
|
|
|
```
|
2017-08-07 20:53:15 -02:30
|
|
|
|
2021-02-25 09:42:35 +05:30
|
|
|
2. Make sure you have [pip](https://pip.pypa.io/en/stable/installing/).
|
2017-08-07 20:53:15 -02:30
|
|
|
|
2021-02-25 09:42:35 +05:30
|
|
|
3. Run:
|
2017-08-07 20:53:15 -02:30
|
|
|
```
|
2018-03-26 11:03:04 +05:30
|
|
|
python3 ./tools/provision
|
2017-08-18 14:13:33 +02:00
|
|
|
```
|
|
|
|
This sets up a virtual Python environment in `zulip-api-py<your_python_version>-venv`,
|
|
|
|
where `<your_python_version>` is your default version of Python. If you would like to specify
|
|
|
|
a different Python version, run
|
|
|
|
```
|
2018-03-26 11:03:04 +05:30
|
|
|
python3 ./tools/provision -p <path_to_your_python_version>
|
2017-08-07 20:53:15 -02:30
|
|
|
```
|
|
|
|
|
2021-02-25 09:42:35 +05:30
|
|
|
4. If that succeeds, it will end with printing the following command:
|
2018-03-26 11:03:04 +05:30
|
|
|
```
|
|
|
|
source /.../python-zulip-api/.../activate
|
|
|
|
```
|
2018-10-31 16:44:29 -07:00
|
|
|
You can run this command to enter the virtual environment.
|
2018-03-26 11:03:04 +05:30
|
|
|
You'll want to run this in each new shell before running commands from `python-zulip-api`.
|
2017-11-10 13:03:40 -08:00
|
|
|
|
2021-02-25 09:42:35 +05:30
|
|
|
5. Once you've entered the virtualenv, you should see something like this on the terminal:
|
2018-03-26 11:03:04 +05:30
|
|
|
```
|
|
|
|
(zulip-api-py3-venv) user@pc ~/python-zulip-api $
|
|
|
|
```
|
|
|
|
You should now be able to run any commands/tests/etc. in this
|
|
|
|
virtual environment.
|
2017-08-07 20:53:15 -02:30
|
|
|
|
|
|
|
### Running tests
|
|
|
|
|
2021-08-24 15:13:17 -07:00
|
|
|
You can run all the tests with:
|
2017-08-07 20:53:15 -02:30
|
|
|
|
2021-08-24 15:13:17 -07:00
|
|
|
`pytest`
|
2017-08-07 20:53:15 -02:30
|
|
|
|
2021-08-24 15:13:17 -07:00
|
|
|
or test individual packages with `pytest zulip`, `pytest zulip_bots`,
|
|
|
|
or `pytest zulip_botserver` (see the [pytest
|
|
|
|
documentation](https://docs.pytest.org/en/latest/how-to/usage.html)
|
|
|
|
for more options).
|
2017-08-07 20:53:15 -02:30
|
|
|
|
|
|
|
To run the linter, type:
|
|
|
|
|
|
|
|
`./tools/lint`
|
2017-11-13 12:08:14 +01:00
|
|
|
|
|
|
|
To check the type annotations, run:
|
|
|
|
|
|
|
|
`./tools/run-mypy`
|