Skip to content

Commit 7667516

Browse files
committed
[0.4.0] release.
1 parent 0862328 commit 7667516

File tree

6 files changed

+68
-68
lines changed

6 files changed

+68
-68
lines changed

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include readme.md
1+
include README.md

readme.md README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- pip install rpyc_ikernel
1212
- python -m rpyc_ikernel.install
1313

14-
![index.png](./images/index.png)
14+
![index.png](./tests/images/index.png)
1515

1616
## Kernel introduction
1717

@@ -80,7 +80,7 @@ pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple rpyc_ikernel && python3
8080

8181
After the above package is installed, enter `jupyter notebook` to start the service. After startup, the system default browser will be opened automatically (recommended foreign Google browser or domestic 360 speed browser), please select the kernel of rpyc and create a new (new) designation The code file of the kernel.
8282

83-
![kernels.png](./images/kernels.png)
83+
![kernels.png](./tests/images/kernels.png)
8484

8585
If you don't see it, you can enter `python3 -m rpyc_ikernel.install` to complete the kernel installation, and you can see it now.
8686

rpyc_ikernel/kernel.py

+62-62
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import socket
2222

2323
from PIL import Image # , UnidentifiedImageError
24-
import requests
2524
import rpyc
2625

2726
try:
@@ -194,67 +193,68 @@ def iter_content(self):
194193
yield self.read_mjpeg_frame(self.stream, self.boundary)
195194

196195

197-
class MjpgReader():
198-
"""
199-
MJPEG format
200-
201-
Content-Type: multipart/x-mixed-replace; boundary=--BoundaryString
202-
--BoundaryString
203-
Content-type: image/jpg
204-
Content-Length: 12390
205-
206-
... image-data here ...
207-
208-
209-
--BoundaryString
210-
Content-type: image/jpg
211-
Content-Length: 12390
212-
213-
... image-data here ...
214-
"""
215-
216-
def __init__(self, url: str):
217-
self._url = url
218-
self.session = requests.Session()
219-
220-
def iter_content(self):
221-
"""
222-
Raises:
223-
RuntimeError
224-
"""
225-
226-
r = self.session.get(self._url, stream=True, timeout=3)
227-
# r = requests.get(self._url, stream=True, timeout=3)
228-
229-
# parse boundary
230-
content_type = r.headers['content-type']
231-
index = content_type.rfind("boundary=")
232-
assert index != 1
233-
boundary = content_type[index+len("boundary="):] + "\r\n"
234-
boundary = boundary.encode('utf-8')
235-
236-
rd = io.BufferedReader(r.raw)
237-
while True:
238-
self._skip_to_boundary(rd, boundary)
239-
length = self._parse_length(rd)
240-
yield rd.read(length)
241-
242-
def _parse_length(self, rd) -> int:
243-
length = 0
244-
while True:
245-
line = rd.readline()
246-
if line == b'\r\n':
247-
return length
248-
if line.startswith(b"Content-Length"):
249-
length = int(line.decode('utf-8').split(": ")[1])
250-
assert length > 0
251-
252-
def _skip_to_boundary(self, rd, boundary: bytes):
253-
for _ in range(10):
254-
if boundary in rd.readline():
255-
break
256-
else:
257-
raise RuntimeError("Boundary not detected:", boundary)
196+
# import requests
197+
# class MjpgReader():
198+
# """
199+
# MJPEG format
200+
201+
# Content-Type: multipart/x-mixed-replace; boundary=--BoundaryString
202+
# --BoundaryString
203+
# Content-type: image/jpg
204+
# Content-Length: 12390
205+
206+
# ... image-data here ...
207+
208+
209+
# --BoundaryString
210+
# Content-type: image/jpg
211+
# Content-Length: 12390
212+
213+
# ... image-data here ...
214+
# """
215+
216+
# def __init__(self, url: str):
217+
# self._url = url
218+
# self.session = requests.Session()
219+
220+
# def iter_content(self):
221+
# """
222+
# Raises:
223+
# RuntimeError
224+
# """
225+
226+
# r = self.session.get(self._url, stream=True, timeout=3)
227+
# # r = requests.get(self._url, stream=True, timeout=3)
228+
229+
# # parse boundary
230+
# content_type = r.headers['content-type']
231+
# index = content_type.rfind("boundary=")
232+
# assert index != 1
233+
# boundary = content_type[index+len("boundary="):] + "\r\n"
234+
# boundary = boundary.encode('utf-8')
235+
236+
# rd = io.BufferedReader(r.raw)
237+
# while True:
238+
# self._skip_to_boundary(rd, boundary)
239+
# length = self._parse_length(rd)
240+
# yield rd.read(length)
241+
242+
# def _parse_length(self, rd) -> int:
243+
# length = 0
244+
# while True:
245+
# line = rd.readline()
246+
# if line == b'\r\n':
247+
# return length
248+
# if line.startswith(b"Content-Length"):
249+
# length = int(line.decode('utf-8').split(": ")[1])
250+
# assert length > 0
251+
252+
# def _skip_to_boundary(self, rd, boundary: bytes):
253+
# for _ in range(10):
254+
# if boundary in rd.readline():
255+
# break
256+
# else:
257+
# raise RuntimeError("Boundary not detected:", boundary)
258258

259259
########################################################################################################################################
260260

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
setup(
1313
name="rpyc_ikernel",
14-
version="0.3.8",
14+
version="0.4.0",
1515
description="rpyc for jupyter kernel",
16-
long_description=open('readme.md', 'r', encoding='UTF-8').read(),
16+
long_description=open('README.md', 'r', encoding='UTF-8').read(),
1717
long_description_content_type='text/markdown',
1818
author="Juwan",
1919
author_email="[email protected]",
@@ -22,7 +22,7 @@
2222
packages=["rpyc_ikernel"],
2323
# scripts=scripts,
2424
# entry_points={"console_scripts": ["rpyc_ikernel = rpyc_ikernel.__main__:main"]},
25-
install_requires=["notebook", "pexpect", "rpyc", "pillow", "requests"],
25+
install_requires=["notebook", "pexpect", "rpyc", "pillow"],
2626
tests_requires=["pytest", "scripttest"],
2727
include_package_data=True,
2828
classifiers=[
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)