Skip to content

Commit a3916c4

Browse files
committed
Merge remote-tracking branch 'origin/main' into dev
2 parents 69b5bd5 + 5c6dd79 commit a3916c4

31 files changed

+867
-147
lines changed

.bumpversion.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[bumpversion]
2+
current_version = 3.1.0
3+
commit = True
4+
tag = False
5+
6+
[bumpversion:file:opentok/version.py]

.github/workflows/ot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Opentok Actions
2+
3+
on: [push]
4+
5+
jobs:
6+
test:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.5, 3.6, 3.7, 3.8.8, 3.9]
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r test_requirements.txt
23+
pip install -r requirements.txt
24+
- name: Test with nosetests
25+
run: |
26+
nosetests -v tests/test_*

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ docs/_build/
4343

4444
# Virtual env
4545
venv/
46+
env/
4647

4748
# Mac Desktop files
4849
.DS_Store
4950

5051
# IDE
5152
.vscode
53+
54+
#Pypi
55+
.pypirc

.travis.yml

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

DEVELOPING.md

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,30 @@ this project. If you use this package within your own software as is but don't p
1616
location on your system, which helps keep you out of dependency hell. You can exit the
1717
environment using `$ deactivate`.
1818

19-
* [tox](https://testrun.org/tox/): a testing automation tool that can load many Python versions.
20-
This tool allows the project to test against all the compatible versions of Python by leveraging
21-
virtualenv and describing the tasks in a metadata file.
19+
* [act](https://github.com/nektos/act): a tool for running Github Actions locally. This tool allows
20+
developers to easily replicate the same Continuous Integration pipelines we use for code validation.
2221

2322
## Tasks
2423

24+
## Setup
25+
26+
We currently recommend setting up a development environment using `virtualenv` and installing dependencies
27+
with `pip`. While the Python Packaging Authority recommends `Pipenv` to manage dependencies, `Pipenv` does
28+
not install the OpenTok library correctly from source at this time.
29+
30+
We recommend setting up a Python 3.5 or higher `virtualenv` environment. This allows you to isolate dependencies
31+
for work on the OpenTok library without interfering with any other projects or installations on your system.
32+
33+
$ virtualenv env
34+
$ source env/bin/activate
35+
$ pip install -r requirements.txt -r test_requirements.txt
36+
37+
Some IDEs, like Visual Studio Code, will automatically detect the `virtualenv` and use it.
38+
39+
When you are done, you can leave the `virtualenv` by deactivating it:
40+
41+
$ deactivate
42+
2543
### Building
2644

2745
Building isn't necessarily required for a python package, but it is possible. By running the command
@@ -32,10 +50,19 @@ other script in your environment, and continue to update and you make changes.
3250

3351
### Testing
3452

35-
This project's tests are kicked off by tox. The `tox.ini` file describes the automation. In
36-
a nutshell, it selects a Python version, installs test dependencies stored in
37-
`test_requirements.txt`, and then runs `nosetests`. [Nose](https://nose.readthedocs.org) is the
38-
actual test runner. All of this can be ran using the following command: `$ tox`
53+
This project's tests are built using the `unittest` [`Nose'](https://nose.readthedocs.org) modules.
54+
To run the unit tests, install the core as well as development dependencies inside your `virtualenv`:
55+
56+
$ pip install -r requirements.txt -r test_requirements.txt
57+
58+
You can manually run the test suite for your version of python with:
59+
60+
$ nosetests
61+
62+
If you would like to run the test suite against a variety of Python versions, we recommend installing
63+
`act` and running out Github Action "test" workflow:
64+
65+
$ act --quiet
3966

4067
### Generating Documentation
4168

@@ -45,19 +72,28 @@ actual test runner. All of this can be ran using the following command: `$ tox`
4572

4673
In order to create a release, the following should be completed in order.
4774

48-
1. Ensure all tests are passing (`tox`) and that there is enough test coverage.
75+
#### Prep the release
76+
77+
1. Ensure all tests are passing (`act`) and that there is enough test coverage.
4978
1. Make sure you are on the `master` branch of the repository, with all changes merged/committed already.
50-
1. Update the version number in the source code (`opentok/version.py`) and the README. See [Versioning](#versioning) for
79+
1. Create a new branch named `release-x.y.z`, with the release version number
80+
1. Update the version number with `bumpversion`. See [Versioning](#versioning) for
5181
information about selecting an appropriate version number.
5282
1. Commit the version number change with the message ("Update to version v.x.x.x"), substituting the new version number.
83+
1. Create a new pull request with this branch
84+
85+
#### Once PR is merged into `master`
86+
1. Make sure you are on the `master` branch of the repository
87+
1. Run `git pull --rebase origin master` to make sure your local code is up-to-date
5388
1. Create a git tag: `git tag -a vx.y.z -m "Release vx.y.z"`
89+
1. Run `git push origin vx.y.z` to push the tag to Github
5490
1. Ensure you have permission to update the `opentok` package on PyPI: <https://pypi.python.org/pypi/opentok>.
55-
1. Run `python setup.py sdist upload`, which will build and upload the package to PyPI.
56-
1. Change the version number for future development by adding "a1", then make another commit with the message
57-
"Beginning development on next version".
58-
1. Push the changes to the main repository (`git push origin master`).
59-
1. Upload the `dist/opentok-x.y.z.tar.gz` file to the
60-
[Github Releases](https://github.com/opentok/opentok-python-sdk/releases) page with a description and release notes.
91+
1. Run the deploy scripts:
92+
1. `make clean`
93+
1. `make dist`
94+
1. `make release`
95+
1. Create a new release on the [Github Releases](https://github.com/opentok/opentok-python-sdk/releases) page,
96+
and attach the files in `dist/` to the release
6197

6298
## Workflow
6399

@@ -73,10 +109,6 @@ from 1.
73109
### Branches
74110

75111
* `master` - the main development branch.
76-
* `feat.foo` - feature branches. these are used for longer running tasks that cannot be accomplished in one commit.
77-
once merged into master, these branches should be deleted.
78-
* `vx.x.x` - if development for a future version/milestone has begun while master is working towards a sooner
79-
release, this is the naming scheme for that branch. once merged into master, these branches should be deleted.
80112

81113
### Tags
82114

Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.PHONY: clean test dist coverage install requirements release release-test
2+
3+
clean:
4+
rm -rf dist build
5+
6+
coverage:
7+
pytest -v --cov
8+
coverage html
9+
10+
test:
11+
nosetests -v
12+
13+
dist:
14+
python setup.py sdist --formats zip,gztar bdist_wheel
15+
16+
release:
17+
twine upload dist/*
18+
19+
install: requirements
20+
21+
requirements: .requirements.txt
22+
23+
.requirements.txt: requirements.txt
24+
python -m pip install --upgrade pip setuptools
25+
python -m pip install -r requirements.txt
26+
python -m pip freeze > .requirements.txt

README.rst

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
OpenTok Python SDK
33
==================
44

5-
.. image:: https://travis-ci.org/opentok/Opentok-Python-SDK.svg
6-
:target: https://travis-ci.org/opentok/Opentok-Python-SDK
75
.. image:: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg
86
:target: CODE_OF_CONDUCT.md
97

@@ -25,7 +23,7 @@ http://www.pip-installer.org/en/latest/
2523
Add the ``opentok`` package as a dependency in your project. The most common way is to add it to your
2624
``requirements.txt`` file::
2725

28-
opentok>=2.10.0
26+
opentok>=3.0
2927

3028
Next, install the dependencies::
3129

@@ -39,13 +37,13 @@ Initializing
3937
~~~~~~~~~~~~
4038

4139
Import the package at the top of any file where you will use it. At the very least you will need the
42-
``OpenTok`` class. Then initialize an OpenTok instance with your own API Key and API Secret.
40+
``Client`` class. Then initialize a Client instance with your own API Key and API Secret.
4341

4442
.. code:: python
4543
46-
from opentok import OpenTok
44+
from opentok import Client
4745
48-
opentok = OpenTok(api_key, api_secret)
46+
opentok = Client(api_key, api_secret)
4947
5048
Creating Sessions
5149
~~~~~~~~~~~~~~~~~
@@ -238,7 +236,7 @@ For more information on archiving, see the
238236
Sending Signals
239237
~~~~~~~~~~~~~~~~~~~~~
240238

241-
Once a Session is created, you can send signals to everyone in the session or to a specific connection. You can send a signal by calling the ``signal(session_id, payload)`` method of the ``OpenTok`` class. The ``payload`` parameter is a dictionary used to set the ``type``, ``data`` fields. Ỳou can also call the method with the parameter ``connection_id`` to send a signal to a specific connection ``signal(session_id, data, connection_id)``.
239+
Once a Session is created, you can send signals to everyone in the session or to a specific connection. You can send a signal by calling the ``signal(session_id, payload)`` method of the ``Client`` class. The ``payload`` parameter is a dictionary used to set the ``type``, ``data`` fields. Ỳou can also call the method with the parameter ``connection_id`` to send a signal to a specific connection ``signal(session_id, data, connection_id)``.
242240

243241
.. code:: python
244242
@@ -259,7 +257,7 @@ Once a Session is created, you can send signals to everyone in the session or to
259257
Working with Streams
260258
~~~~~~~~~~~~~~~~~~~~~
261259

262-
You can get information about a stream by calling the `get_stream(session_id, stream_id)` method of the `OpenTok` class.
260+
You can get information about a stream by calling the `get_stream(session_id, stream_id)` method of the `Client` class.
263261

264262
The method returns a Stream object that contains information of an OpenTok stream:
265263

@@ -282,7 +280,7 @@ The method returns a Stream object that contains information of an OpenTok strea
282280
print stream.name #stream name
283281
print stream.layoutClassList #['full']
284282
285-
Also, you can get information about all the streams in a session by calling the `list_streams(session_id)` method of the `OpenTok` class.
283+
Also, you can get information about all the streams in a session by calling the `list_streams(session_id)` method of the `Client` class.
286284

287285
The method returns a StreamList object that contains a list of all the streams
288286

@@ -300,7 +298,7 @@ The method returns a StreamList object that contains a list of all the streams
300298
print stream.name #stream name
301299
print stream.layoutClassList #['full']
302300
303-
You can change the layout classes for streams in a session by calling the `set_stream_class_lists(session_id, stream_list)` method of the `OpenTok` class.
301+
You can change the layout classes for streams in a session by calling the `set_stream_class_lists(session_id, stream_list)` method of the `Client` class.
304302

305303
The layout classes define how the stream is displayed in the layout of a composed OpenTok archive.
306304

@@ -324,7 +322,7 @@ For more information see
324322
Force Disconnect
325323
~~~~~~~~~~~~~~~~~~~~~
326324

327-
Your application server can disconnect a client from an OpenTok session by calling the force_disconnect(session_id, connection_id) method of the OpenTok class, or the force_disconnect(connection_id) method of the Session class.
325+
Your application server can disconnect a client from an OpenTok session by calling the force_disconnect(session_id, connection_id) method of the Client class, or the force_disconnect(connection_id) method of the Session class.
328326

329327
.. code:: python
330328
@@ -472,14 +470,14 @@ For more information about OpenTok live streaming broadcasts, see the
472470

473471

474472
Configuring Timeout
475-
-------
476-
Timeout is passed in the OpenTok constructor:
473+
-------------------
474+
Timeout is passed in the Client constructor:
477475

478476
``self.timeout = timeout``
479477

480478
In order to configure timeout, first create an instance:
481479

482-
``opentok = OpenTok(...., timeout=value)``
480+
``opentok = Client(...., timeout=value)``
483481

484482
And then proceed to change the value with
485483

@@ -504,7 +502,7 @@ Requirements
504502

505503
You need an OpenTok API key and API secret, which you can obtain at https://dashboard.tokbox.com/
506504

507-
The OpenTok Python SDK requires Python 2.6, 2.7, 3.3, 3.4, 3.5 or 3.6
505+
The OpenTok Python SDK requires Python 3.5 or higher
508506

509507
Release Notes
510508
-------------
@@ -527,7 +525,11 @@ session uses the OpenTok TURN server to relay audio-video streams.
527525

528526
This version of the SDK includes support for working with OpenTok archives.
529527

530-
The OpenTok.create_session() method now includes a media_mode parameter, instead of a p2p parameter.
528+
The Client.create_session() method now includes a media_mode parameter, instead of a p2p parameter.
529+
530+
**Changes in v3.X.X:**
531+
532+
This version of the SDK includes significant improvements such as top level entity naming, where the Opentok class is now `Client`. We also implemented a standardised logging module, improved naming conventions and JWT generation to make developer experience more rewarding.
531533

532534
For details, see the reference documentation at
533535
http://www.tokbox.com/opentok/libraries/server/python/reference/index.html.

opentok/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .opentok import OpenTok, Roles, MediaModes, ArchiveModes
1+
from .opentok import OpenTok, Client, Roles, MediaModes, ArchiveModes
22
from .session import Session
33
from .archives import Archive, ArchiveList, OutputModes
44
from .exceptions import (

0 commit comments

Comments
 (0)