pyloid 0.23.17__tar.gz → 0.23.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -198,4 +198,4 @@ Apache License
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
199
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
200
  See the License for the specific language governing permissions and
201
- limitations under the License.
201
+ limitations under the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyloid
3
- Version: 0.23.17
3
+ Version: 0.23.19
4
4
  Summary:
5
5
  Author: aesthetics-of-record
6
6
  Author-email: 111675679+aesthetics-of-record@users.noreply.github.com
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.13
14
14
  Requires-Dist: aiohttp-cors (>=0.8.1,<0.9.0)
15
15
  Requires-Dist: pickledb (>=1.3.2,<2.0.0)
16
16
  Requires-Dist: platformdirs (>=4.3.7,<5.0.0)
17
- Requires-Dist: pyside6 (>=6.8.2.1,<7.0.0.0)
17
+ Requires-Dist: pyside6 (==6.8.3)
18
18
  Description-Content-Type: text/markdown
19
19
 
20
20
  <h1 style="text-align: center; font-size: 200px; font-weight: 500;">
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyloid"
3
- version = "0.23.17"
3
+ version = "0.23.19"
4
4
  description = ""
5
5
  authors = ["aesthetics-of-record <111675679+aesthetics-of-record@users.noreply.github.com>"]
6
6
  readme = "README.md"
@@ -10,7 +10,7 @@ packages = [
10
10
 
11
11
  [tool.poetry.dependencies]
12
12
  python = ">=3.9,<3.14"
13
- pyside6 = "^6.8.2.1"
13
+ pyside6 = "6.8.3"
14
14
  platformdirs = "^4.3.7"
15
15
  pickledb = "^1.3.2"
16
16
  aiohttp-cors = "^0.8.1"
@@ -37,7 +37,7 @@ import threading
37
37
  import signal
38
38
 
39
39
  # software backend
40
- os.environ["QT_QUICK_BACKEND"] = "software"
40
+ # os.environ["QT_QUICK_BACKEND"] = "software"
41
41
 
42
42
  #########################################################################
43
43
  # for linux debug
@@ -1666,11 +1666,6 @@ class Pyloid(QObject):
1666
1666
  The name of the application.
1667
1667
  single_instance : bool, optional
1668
1668
  Determines whether to run as a single instance. (Default is True)
1669
-
1670
- Notes
1671
- -----
1672
- The generated or passed `id` is transmitted to the frontend via IPC,
1673
- and is used as an API key to connect to the integrated backend FastAPI server.
1674
1669
  """
1675
1670
  super().__init__()
1676
1671
 
@@ -46,7 +46,7 @@ def get_production_path(path: Optional[str] = None) -> Optional[str]:
46
46
  '/tmp/_MEIabcde'
47
47
  """
48
48
  if is_production():
49
- if hasattr(sys, '_MEIPASS'):
49
+ if hasattr(sys, "_MEIPASS"):
50
50
  # PyInstaller
51
51
  base_path = sys._MEIPASS
52
52
  else:
@@ -57,7 +57,6 @@ def get_production_path(path: Optional[str] = None) -> Optional[str]:
57
57
  # 환경변수가 없는 경우 실행 파일 디렉토리 사용
58
58
  base_path = os.path.dirname(os.path.abspath(sys.argv[0]))
59
59
 
60
-
61
60
  return os.path.join(base_path, path) if path else base_path
62
61
  else:
63
62
  return path
@@ -81,10 +80,10 @@ def is_production() -> bool:
81
80
  >>> print("Not in production environment.")
82
81
  """
83
82
  # Nuitka 환경 확인을 추가
84
- if '__compiled__' in globals():
83
+ if "__compiled__" in globals():
85
84
  return True
86
85
  # PyInstaller 환경 확인
87
- return getattr(sys, 'frozen', False)
86
+ return getattr(sys, "frozen", False)
88
87
 
89
88
 
90
89
  def get_platform() -> str:
@@ -108,20 +107,17 @@ def get_platform() -> str:
108
107
  windows
109
108
  """
110
109
  os_name = platform.system().lower()
111
- os_type = {
112
- 'darwin': 'macos',
113
- 'linux': 'linux',
114
- 'windows': 'windows'
115
- }.get(os_name)
110
+ os_type = {"darwin": "macos", "linux": "linux", "windows": "windows"}.get(os_name)
116
111
  if os_type is None:
117
112
  raise ValueError(f"Unsupported platform: {os_name}")
118
-
113
+
119
114
  return os_type
120
115
 
116
+
121
117
  def get_absolute_path(path: str) -> str:
122
118
  """
123
119
  Returns the absolute path of the given relative path.
124
-
120
+
125
121
  Parameters
126
122
  ----------
127
123
  path : str
@@ -131,7 +127,7 @@ def get_absolute_path(path: str) -> str:
131
127
  -------
132
128
  str
133
129
  The absolute path of the given relative path.
134
-
130
+
135
131
  Examples
136
132
  --------
137
133
  >>> from pyloid.utils import get_absolute_path
@@ -141,19 +137,20 @@ def get_absolute_path(path: str) -> str:
141
137
  """
142
138
  return os.path.normpath(os.path.abspath(path))
143
139
 
140
+
144
141
  def get_free_port() -> int:
145
142
  """
146
143
  Finds and returns an available random network port number from the operating system.
147
-
144
+
148
145
  This function creates a socket and binds it to port '0', allowing the operating system
149
146
  to allocate a random available port. It retrieves the port number and safely closes
150
147
  the socket afterward.
151
-
148
+
152
149
  Returns
153
150
  -------
154
151
  int
155
152
  An available network port number (typically in the range 1024-65535)
156
-
153
+
157
154
  Notes
158
155
  -----
159
156
  - Since this function closes the socket immediately after finding a port, there is a
@@ -161,18 +158,51 @@ def get_free_port() -> int:
161
158
  - It is recommended to use the port number quickly after receiving it.
162
159
  - This function interacts with the operating system's network stack, so its behavior
163
160
  may vary depending on firewall or network settings.
164
-
161
+
165
162
  Examples
166
163
  --------
167
164
  >>> from pyloid.utils import get_free_port
168
165
  >>> port = get_free_port()
169
166
  >>> print(f"Found available port: {port}")
170
167
  Found available port: 49152
171
-
168
+
172
169
  >>> # Web server example
173
170
  >>> import http.server
174
171
  >>> server = http.server.HTTPServer(('localhost', port), http.server.SimpleHTTPRequestHandler)
175
172
  """
176
173
  with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
177
- s.bind(('', 0))
174
+ s.bind(("", 0))
178
175
  return s.getsockname()[1]
176
+
177
+
178
+ def set_qt_backend(backend="software"):
179
+ """
180
+ Sets the Qt Quick backend to force a specific rendering mode.
181
+
182
+ This function allows changing the Qt Quick rendering backend by setting
183
+ the QT_QUICK_BACKEND environment variable. Setting it to 'software'
184
+ forces software rendering, which can be useful in environments with
185
+ graphics driver issues or where hardware acceleration is not available.
186
+
187
+ Parameters
188
+ ----------
189
+ backend : str, optional
190
+ The backend to use for Qt Quick rendering. Default is 'software'.
191
+
192
+ Returns
193
+ -------
194
+ None
195
+
196
+ Notes
197
+ -----
198
+ - This setting must be applied before the Qt application is initialized
199
+ - Software rendering may be slower but more compatible across systems
200
+
201
+ Examples
202
+ --------
203
+ >>> from pyloid.utils import set_qt_backend
204
+ >>> # Force software rendering
205
+ >>> set_qt_backend("software")
206
+ """
207
+ print(f"Setting QT_QUICK_BACKEND to {backend}.")
208
+ os.environ["QT_QUICK_BACKEND"] = backend
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes