Skip to content

Commit 672f46c

Browse files
authored
Add examples to docs (#28)
* Add example * update setup.py
1 parent 2660b0c commit 672f46c

File tree

8 files changed

+92
-28
lines changed

8 files changed

+92
-28
lines changed

docs/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Introduction to pyvts
1+
# pyvts
22
[![License: MIT](https://img.shields.io/github/license/Genteki/pyvts?style=flat-square)](https://opensource.org/licenses/MIT) [![issue](https://img.shields.io/github/issues/genteki/pyvts?style=flat-square)](https://github.com/Genteki/pyvts/issues) [![build](https://img.shields.io/circleci/build/github/Genteki/pyvts?style=flat-square)](https://circleci.com/gh/Genteki/pyvts)
33
[![codecov](https://img.shields.io/codecov/c/github/genteki/pyvts?color=informational&style=flat-square)](https://codecov.io/gh/Genteki/pyvts)
44
[![PyPI](https://img.shields.io/pypi/v/pyvts?style=flat-square)](https://pypi.org/project/pyvts/)
5+
[![docs](https://img.shields.io/badge/docs-passing-success?style=flat-square)](https://genteki.github.io/pyvts)
56

67
A python library for interacting with the [VTube Studio API](https://github.com/DenchiSoft/VTubeStudio).
78

@@ -49,7 +50,7 @@ if __name__ == "__main__":
4950

5051
### Demo
5152

52-
Demo [examples/start.py](https://github.com/Genteki/pyvts/blob/main/examples/start.py) is a good startpoint to make plugin for VTubeStudio.
53+
Demo [examples/start.py](./examples/start.py) is a good startpoint to make plugin for VTubeStudio.
5354

5455
Before you get started, make sure you've clone the library and installed all the dependcies
5556

docs/basicusage.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
### Basic Usage
2+
3+
First import packages
4+
5+
```
6+
import asyncio, pyvts
7+
```
8+
9+
Then specify your plugin info, you can use the default value and skip this step,
10+
11+
```
12+
plugin_info = {
13+
"plugin_name": "start pyvts",
14+
"developer": "Genteki",
15+
"authentication_token_path": "./token.txt"
16+
}
17+
```
18+
19+
Use ``async`` prefix to define a `main` function. Creat `vts` instance in `main`.
20+
21+
```
22+
async def main():
23+
myvts = pyvts.vts(plugin_info=plugin_info)
24+
await myvts.connect()
25+
```
26+
27+
After sucessfully connected, you will see in VTubeStudio settings
28+
29+
![](./image/example_start_plugin_connected.png)
30+
31+
Continue with `main` function, to get access of more features, we need to get authenticated from `Vtube Studio API`.
32+
33+
```
34+
await vts.request_authenticate_token() # get token
35+
await vts.request_authenticate() # use token
36+
```
37+
38+
In `vts.request_authenticate_token`, it will request a token from `Vtube Studio API`, and save it in local file. While requesting token, a dialog will show up in VTube Studio app. Then, `vts.request_authenticate` will use the token to get accessed.
39+
40+
![](./image/example_start_1.png)
41+
42+
Then you can do whatever you want, like add a new parameter/set values for parameter.
43+
44+
```
45+
new_parameter_name = "start_parameter"
46+
await vts.request(
47+
vts.vts_request.requestCustomParameter(new_parameter_name)
48+
) # add new parameter
49+
```
50+
51+
After all, use `vts.close()` to disconnect from VTS and add `main` function to `async` quene.
52+
```
53+
if __name__ == "__main__":
54+
async.run(main())
55+
```

docs/image/example_start_1.png

577 KB
Loading
360 KB
Loading

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![License: MIT](https://img.shields.io/github/license/Genteki/pyvts?style=flat-square)](https://opensource.org/licenses/MIT) [![issue](https://img.shields.io/github/issues/genteki/pyvts?style=flat-square)](https://github.com/Genteki/pyvts/issues) [![build](https://img.shields.io/circleci/build/github/Genteki/pyvts?style=flat-square)](https://circleci.com/gh/Genteki/pyvts)
44
[![codecov](https://img.shields.io/codecov/c/github/genteki/pyvts?color=informational&style=flat-square)](https://codecov.io/gh/Genteki/pyvts)
55
[![PyPI](https://img.shields.io/pypi/v/pyvts?style=flat-square)](https://pypi.org/project/pyvts/)
6+
[![docs](https://img.shields.io/badge/docs-passing-success?style=flat-square)](https://genteki.github.io/pyvts)
67

78
## Overview
89
`pyvts` is a python library for interacting with the [VTube Studio API](https://github.com/DenchiSoft/VTubeStudio).
@@ -23,6 +24,8 @@ README.md
2324
:caption: Introduction to pyvts
2425
:end-before: Demo
2526
:heading-offset: 3
27+
tutorial.rst
28+
:caption: Tutorial
2629
reference.rst
2730
:caption: API reference
2831
:depth: 1

docs/tutorial.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## Tutorial
2+
3+
```{include} basicusage.md
4+
```

pyvts/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
"""
66

7-
__version__ = "0.1.1"
7+
__version__ = "0.2.0"
88
__all__ = ["vts", "vts_request", "config", "error"]
99

1010
from .vts import vts

setup.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
"""A python library for interacting with the VTube Studio API"""
32

43
from setuptools import setup, find_packages
@@ -7,27 +6,29 @@
76
DESCRIPTION = "A python library for interacting with the VTube Studio API"
87
VERSION = pyvts.__version__
98

10-
setup(name='pyvts',
11-
version=VERSION,
12-
description=DESCRIPTION,
13-
long_description=open("README.md", encoding="utf-8").read(),
14-
long_description_content_type='text/markdown',
15-
keywords='vtubestudio',
16-
classifiers=['Development Status :: 3 - Alpha',
17-
'Intended Audience :: Developers',
18-
'License :: OSI Approved :: MIT License',
19-
'Operating System :: Microsoft :: Windows',
20-
'Operating System :: MacOS',
21-
'Programming Language :: Python',
22-
'Programming Language :: Python :: 3',
23-
'Programming Language :: Python :: 3.8',
24-
'Programming Language :: Python :: 3.9',
25-
'Programming Language :: Python :: 3.10'],
26-
author='Genteki Zhang',
27-
author_email='zhangkaiyuan.null@gmail.com',
28-
url='https://github.com/Genteki/pyvts',
29-
license='MIT',
30-
packages=find_packages(exclude=['*.tests',
31-
'*.tests.*']),
32-
install_requires=['websockets',
33-
'aiofile'])
9+
setup(
10+
name="pyvts",
11+
version=VERSION,
12+
description=DESCRIPTION,
13+
long_description=open("README.md", encoding="utf-8").read(),
14+
long_description_content_type="text/markdown",
15+
keywords="vtubestudio",
16+
classifiers=[
17+
"Development Status :: 3 - Alpha",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: MIT License",
20+
"Operating System :: Microsoft :: Windows",
21+
"Operating System :: MacOS",
22+
"Programming Language :: Python",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.8",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
],
28+
author="Genteki Zhang",
29+
author_email="zhangkaiyuan.null@gmail.com",
30+
url="https://github.com/Genteki/pyvts",
31+
license="MIT",
32+
packages=find_packages(where="pyvts", exclude=["tests.*", "tests"]),
33+
install_requires=["websockets", "aiofile"],
34+
)

0 commit comments

Comments
 (0)