Skip to content

Commit 3a8b07e

Browse files
Made local python sdk load as module
1 parent c5e35ea commit 3a8b07e

File tree

13 files changed

+40
-265
lines changed

13 files changed

+40
-265
lines changed

src/SDK/Python/Python.pyproj

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,25 @@
2323
</PropertyGroup>
2424
<ItemGroup>
2525
<Compile Include="common.py" />
26-
<Compile Include="module_logging.py" />
27-
<Compile Include="module_options.py" />
28-
<Compile Include="module_runner.py" />
29-
<Compile Include="request_data.py" />
30-
<Compile Include="system_info.py" />
31-
<Compile Include="training\augmentation.py" />
32-
<Compile Include="utils\cpuinfo.py" />
33-
<Compile Include="utils\image_utils.py" />
34-
<Compile Include="utils\environment_check.py" />
26+
<Compile Include="src\codeproject_ai_sdk\common.py" />
27+
<Compile Include="src\codeproject_ai_sdk\module_logging.py" />
28+
<Compile Include="src\codeproject_ai_sdk\module_options.py" />
29+
<Compile Include="src\codeproject_ai_sdk\module_runner.py" />
30+
<Compile Include="src\codeproject_ai_sdk\request_data.py" />
31+
<Compile Include="src\codeproject_ai_sdk\system_info.py" />
32+
<Compile Include="src\codeproject_ai_sdk\utils\cpuinfo.py" />
33+
<Compile Include="src\codeproject_ai_sdk\utils\environment_check.py" />
34+
<Compile Include="src\codeproject_ai_sdk\utils\image_utils.py" />
35+
<Compile Include="src\codeproject_ai_sdk\utils\__init__.py" />
36+
<Compile Include="src\codeproject_ai_sdk\__init__.py" />
3537
</ItemGroup>
3638
<ItemGroup>
3739
<Content Include="requirements.txt" />
3840
</ItemGroup>
3941
<ItemGroup>
40-
<Folder Include="training\" />
41-
<Folder Include="utils\" />
42+
<Folder Include="src\" />
43+
<Folder Include="src\codeproject_ai_sdk\" />
44+
<Folder Include="src\codeproject_ai_sdk\utils\" />
4245
</ItemGroup>
4346
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
4447
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from .common import JSON, timedelta_format, get_folder_size, shorten, dump_tensors
2+
from .module_logging import LogMethod, LogVerbosity
3+
from .module_options import ModuleOptions, _get_env_var
4+
from .module_runner import ModuleRunner
5+
from .request_data import RequestData
6+
from .system_info import SystemInfo
7+
8+
from .utils import *
9+
10+

src/SDK/Python/common.py renamed to src/SDK/Python/src/codeproject_ai_sdk/common.py

File renamed without changes.

src/SDK/Python/module_logging.py renamed to src/SDK/Python/src/codeproject_ai_sdk/module_logging.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
import sys
66
from threading import Lock
77

8-
from common import JSON
98
import asyncio
109
from asyncio import Queue
1110
import aiohttp
1211
import aiofiles
1312

13+
from .common import JSON
14+
1415

1516
class LogVerbosity(Enum):
1617
""" The logging noise level"""

src/SDK/Python/module_options.py renamed to src/SDK/Python/src/codeproject_ai_sdk/module_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import sys
44

5-
from module_logging import LogVerbosity
5+
from .module_logging import LogVerbosity
66

77
def _get_env_var(name: str, default: any = "") -> any:
88
value = os.getenv(name, "")

src/SDK/Python/module_runner.py renamed to src/SDK/Python/src/codeproject_ai_sdk/module_runner.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
import aiohttp
3131

3232
# Import the CodeProject.AI SDK as the last step
33-
from common import JSON
34-
from system_info import SystemInfo
35-
from module_logging import LogMethod, ModuleLogger, LogVerbosity
36-
from request_data import RequestData
37-
from module_options import ModuleOptions
33+
from .common import JSON
34+
from .system_info import SystemInfo
35+
from .module_logging import LogMethod, ModuleLogger, LogVerbosity
36+
from .request_data import RequestData
37+
from .module_options import ModuleOptions
3838
# from utils.environment_check import check_requirements
3939

4040

src/SDK/Python/request_data.py renamed to src/SDK/Python/src/codeproject_ai_sdk/request_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
import json
88

99
from PIL import Image
10-
from common import JSON
10+
from .common import JSON
1111
# from logging import LogMethod
1212

1313
try:
1414
# pip install opencv-python-headless recommended
1515
import cv2 as cv
1616
import numpy as np
1717
except ImportError:
18-
logging.debug("Unable to load OpenCV or numpy modules. Only using PIL.")
18+
print("Unable to load OpenCV or numpy modules. Only using PIL.")
1919

2020
class RequestData:
2121
"""

src/SDK/Python/system_info.py renamed to src/SDK/Python/src/codeproject_ai_sdk/system_info.py

File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# from /utils
2+
from .cpuinfo import CPUInfoBase, LinuxCPUInfo, IRIXCPUInfo, DarwinCPUInfo, NetBSDCPUInfo, SunOSCPUInfo, Win32CPUInfo
3+
from .environment_check import check_requirements, check_is_file, get_arguments
4+
5+
# REVIEW: These probably not needed at this time
6+
# from .image_utils import rotate_image, deskew, compute_skew

src/SDK/Python/utils/cpuinfo.py renamed to src/SDK/Python/src/codeproject_ai_sdk/utils/cpuinfo.py

File renamed without changes.

0 commit comments

Comments
 (0)