uipath 2.0.75__py3-none-any.whl → 2.0.77__py3-none-any.whl

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.

Potentially problematic release.


This version of uipath might be problematic. Click here for more details.

@@ -1 +1,58 @@
1
1
  BINDINGS_VERSION = "2.2"
2
+
3
+ # Binary file extension categories
4
+ IMAGE_EXTENSIONS = {
5
+ ".png",
6
+ ".jpg",
7
+ ".jpeg",
8
+ ".gif",
9
+ ".bmp",
10
+ ".ico",
11
+ ".tiff",
12
+ ".webp",
13
+ ".svg",
14
+ }
15
+
16
+ DOCUMENT_EXTENSIONS = {".pdf", ".docx", ".pptx", ".xlsx", ".xls"}
17
+
18
+ ARCHIVE_EXTENSIONS = {".zip", ".tar", ".gz", ".rar", ".7z", ".bz2", ".xz"}
19
+
20
+ MEDIA_EXTENSIONS = {
21
+ ".mp3",
22
+ ".wav",
23
+ ".flac",
24
+ ".aac",
25
+ ".mp4",
26
+ ".avi",
27
+ ".mov",
28
+ ".mkv",
29
+ ".wmv",
30
+ }
31
+
32
+ FONT_EXTENSIONS = {".woff", ".woff2", ".ttf", ".otf", ".eot"}
33
+
34
+ EXECUTABLE_EXTENSIONS = {".exe", ".dll", ".so", ".dylib", ".bin"}
35
+
36
+ DATABASE_EXTENSIONS = {".db", ".sqlite", ".sqlite3"}
37
+
38
+ PYTHON_BINARY_EXTENSIONS = {".pickle", ".pkl"}
39
+
40
+ SPECIAL_EXTENSIONS = {""} # Extensionless binary files
41
+
42
+ # Pre-compute the union for optimal performance
43
+ BINARY_EXTENSIONS = (
44
+ IMAGE_EXTENSIONS
45
+ | DOCUMENT_EXTENSIONS
46
+ | ARCHIVE_EXTENSIONS
47
+ | MEDIA_EXTENSIONS
48
+ | FONT_EXTENSIONS
49
+ | EXECUTABLE_EXTENSIONS
50
+ | DATABASE_EXTENSIONS
51
+ | PYTHON_BINARY_EXTENSIONS
52
+ | SPECIAL_EXTENSIONS
53
+ )
54
+
55
+
56
+ def is_binary_file(file_extension: str) -> bool:
57
+ """Determine if a file should be treated as binary."""
58
+ return file_extension.lower() in BINARY_EXTENSIONS
uipath/_cli/cli_pack.py CHANGED
@@ -1,10 +1,12 @@
1
1
  # type: ignore
2
2
  import json
3
3
  import os
4
+ import re
4
5
  import subprocess
5
6
  import uuid
6
7
  import zipfile
7
8
  from string import Template
9
+ from typing import Dict, Tuple
8
10
 
9
11
  import click
10
12
 
@@ -15,6 +17,7 @@ except ImportError:
15
17
 
16
18
  from ..telemetry import track
17
19
  from ._utils._console import ConsoleLogger
20
+ from ._utils._constants import is_binary_file
18
21
 
19
22
  console = ConsoleLogger()
20
23
 
@@ -50,6 +53,7 @@ def check_config(directory):
50
53
  "entryPoints": config_data["entryPoints"],
51
54
  "version": toml_data["version"],
52
55
  "authors": toml_data["authors"],
56
+ "dependencies": toml_data.get("dependencies", {}),
53
57
  }
54
58
 
55
59
 
@@ -113,7 +117,7 @@ def handle_uv_operations(directory):
113
117
  run_uv_lock(directory)
114
118
 
115
119
 
116
- def generate_operate_file(entryPoints):
120
+ def generate_operate_file(entryPoints, dependencies=None):
117
121
  project_id = str(uuid.uuid4())
118
122
 
119
123
  first_entry = entryPoints[0]
@@ -130,6 +134,10 @@ def generate_operate_file(entryPoints):
130
134
  "runtimeOptions": {"requiresUserInteraction": False, "isAttended": False},
131
135
  }
132
136
 
137
+ # Add dependencies if provided
138
+ if dependencies:
139
+ operate_json_data["dependencies"] = dependencies
140
+
133
141
  return operate_json_data
134
142
 
135
143
 
@@ -149,40 +157,6 @@ def generate_bindings_content():
149
157
  return bindings_content
150
158
 
151
159
 
152
- def get_proposed_version(directory):
153
- output_dir = os.path.join(directory, ".uipath")
154
- if not os.path.exists(output_dir):
155
- return None
156
-
157
- # Get all .nupkg files
158
- nupkg_files = [f for f in os.listdir(output_dir) if f.endswith(".nupkg")]
159
- if not nupkg_files:
160
- return None
161
-
162
- # Sort by modification time to get most recent
163
- latest_file = max(
164
- nupkg_files, key=lambda f: os.path.getmtime(os.path.join(output_dir, f))
165
- )
166
-
167
- # Extract version from filename
168
- # Remove .nupkg extension first
169
- name_version = latest_file[:-6]
170
- # Find 3rd last occurrence of . by splitting and joining parts
171
- parts = name_version.split(".")
172
- if len(parts) >= 3:
173
- version = ".".join(parts[-3:])
174
- else:
175
- version = name_version
176
-
177
- # Increment patch version by 1
178
- try:
179
- major, minor, patch = version.split(".")
180
- new_version = f"{major}.{minor}.{int(patch) + 1}"
181
- return new_version
182
- except Exception:
183
- return "0.0.1"
184
-
185
-
186
160
  def generate_content_types_content():
187
161
  templates_path = os.path.join(
188
162
  os.path.dirname(__file__), "_templates", "[Content_Types].xml.template"
@@ -278,9 +252,10 @@ def pack_fn(
278
252
  version,
279
253
  authors,
280
254
  directory,
255
+ dependencies=None,
281
256
  include_uv_lock=True,
282
257
  ):
283
- operate_file = generate_operate_file(entryPoints)
258
+ operate_file = generate_operate_file(entryPoints, dependencies)
284
259
  entrypoints_file = generate_entrypoints_file(entryPoints)
285
260
 
286
261
  # Get bindings from uipath.json if available
@@ -291,8 +266,6 @@ def pack_fn(
291
266
  # Define the allowlist of file extensions to include
292
267
  file_extensions_included = [".py", ".mermaid", ".json", ".yaml", ".yml"]
293
268
  files_included = []
294
- # Binary files that should be read in binary mode
295
- binary_extensions = [".exe", "", ".xlsx", ".xls"]
296
269
 
297
270
  with open(config_path, "r") as f:
298
271
  config_data = json.load(f)
@@ -354,7 +327,7 @@ def pack_fn(
354
327
  if file_extension in file_extensions_included or file in files_included:
355
328
  file_path = os.path.join(root, file)
356
329
  rel_path = os.path.relpath(file_path, directory)
357
- if file_extension in binary_extensions:
330
+ if is_binary_file(file_extension):
358
331
  # Read binary files in binary mode
359
332
  with open(file_path, "rb") as f:
360
333
  z.writestr(f"content/{rel_path}", f.read())
@@ -389,28 +362,166 @@ def pack_fn(
389
362
  z.writestr(f"content/{file}", f.read())
390
363
 
391
364
 
392
- def read_toml_project(file_path: str) -> dict[str, any]:
393
- with open(file_path, "rb") as f:
394
- content = tomllib.load(f)
395
- if "project" not in content:
396
- console.error("pyproject.toml is missing the required field: project.")
397
- if "name" not in content["project"]:
398
- console.error("pyproject.toml is missing the required field: project.name.")
399
- if "description" not in content["project"]:
365
+ def parse_dependency_string(dependency: str) -> Tuple[str, str]:
366
+ """Parse a dependency string into package name and version specifier.
367
+
368
+ Handles PEP 508 dependency specifications including:
369
+ - Simple names: "requests"
370
+ - Version specifiers: "requests>=2.28.0"
371
+ - Complex specifiers: "requests>=2.28.0,<3.0.0"
372
+ - Extras: "requests[security]>=2.28.0"
373
+ - Environment markers: "requests>=2.28.0; python_version>='3.8'"
374
+
375
+ Args:
376
+ dependency: Raw dependency string from pyproject.toml
377
+
378
+ Returns:
379
+ Tuple of (package_name, version_specifier)
380
+
381
+ Examples:
382
+ "requests" -> ("requests", "*")
383
+ "requests>=2.28.0" -> ("requests", ">=2.28.0")
384
+ "requests>=2.28.0,<3.0.0" -> ("requests", ">=2.28.0,<3.0.0")
385
+ "requests[security]>=2.28.0" -> ("requests", ">=2.28.0")
386
+ """
387
+ # Remove whitespace
388
+ dependency = dependency.strip()
389
+
390
+ # Handle environment markers (everything after semicolon)
391
+ if ";" in dependency:
392
+ dependency = dependency.split(";")[0].strip()
393
+
394
+ # Pattern to match package name with optional extras and version specifiers
395
+ # Matches: package_name[extras] version_specs
396
+ pattern = r"^([a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?)(\[[^\]]+\])?(.*)"
397
+ match = re.match(pattern, dependency)
398
+
399
+ if not match:
400
+ # Fallback for edge cases
401
+ return dependency, "*"
402
+
403
+ package_name = match.group(1)
404
+ version_part = match.group(4).strip() if match.group(4) else ""
405
+
406
+ # If no version specifier, return wildcard
407
+ if not version_part:
408
+ return package_name, "*"
409
+
410
+ # Clean up version specifier
411
+ version_spec = version_part.strip()
412
+
413
+ # Validate that version specifier starts with a valid operator
414
+ valid_operators = [">=", "<=", "==", "!=", "~=", ">", "<"]
415
+ if not any(version_spec.startswith(op) for op in valid_operators):
416
+ # If it doesn't start with an operator, treat as exact version
417
+ if version_spec:
418
+ version_spec = f"=={version_spec}"
419
+ else:
420
+ version_spec = "*"
421
+
422
+ return package_name, version_spec
423
+
424
+
425
+ def extract_dependencies_from_toml(project_data: Dict) -> Dict[str, str]:
426
+ """Extract and parse dependencies from pyproject.toml project data.
427
+
428
+ Args:
429
+ project_data: The "project" section from pyproject.toml
430
+
431
+ Returns:
432
+ Dictionary mapping package names to version specifiers
433
+ """
434
+ dependencies = {}
435
+
436
+ if "dependencies" not in project_data:
437
+ return dependencies
438
+
439
+ deps_list = project_data["dependencies"]
440
+ if not isinstance(deps_list, list):
441
+ console.warning("dependencies should be a list in pyproject.toml")
442
+ return dependencies
443
+
444
+ for dep in deps_list:
445
+ if not isinstance(dep, str):
446
+ console.warning(f"Skipping non-string dependency: {dep}")
447
+ continue
448
+
449
+ try:
450
+ name, version_spec = parse_dependency_string(dep)
451
+ if name: # Only add if we got a valid name
452
+ dependencies[name] = version_spec
453
+ except Exception as e:
454
+ console.warning(f"Failed to parse dependency '{dep}': {e}")
455
+ continue
456
+
457
+ return dependencies
458
+
459
+
460
+ def read_toml_project(file_path: str) -> dict:
461
+ """Read and parse pyproject.toml file with improved error handling and validation.
462
+
463
+ Args:
464
+ file_path: Path to pyproject.toml file
465
+
466
+ Returns:
467
+ Dictionary containing project metadata and dependencies
468
+ """
469
+ try:
470
+ with open(file_path, "rb") as f:
471
+ content = tomllib.load(f)
472
+ except Exception as e:
473
+ console.error(f"Failed to read or parse pyproject.toml: {e}")
474
+
475
+ # Validate required sections
476
+ if "project" not in content:
477
+ console.error("pyproject.toml is missing the required field: project.")
478
+
479
+ project = content["project"]
480
+
481
+ # Validate required fields with better error messages
482
+ required_fields = {
483
+ "name": "Project name is required in pyproject.toml",
484
+ "description": "Project description is required in pyproject.toml",
485
+ "version": "Project version is required in pyproject.toml",
486
+ }
487
+
488
+ for field, error_msg in required_fields.items():
489
+ if field not in project:
400
490
  console.error(
401
- "pyproject.toml is missing the required field: project.description."
491
+ f"pyproject.toml is missing the required field: project.{field}. {error_msg}"
402
492
  )
403
- if "version" not in content["project"]:
493
+
494
+ # Check for empty values only if field exists
495
+ if field in project and (
496
+ not project[field]
497
+ or (isinstance(project[field], str) and not project[field].strip())
498
+ ):
404
499
  console.error(
405
- "pyproject.toml is missing the required field: project.version."
500
+ f"Project {field} cannot be empty. Please specify a {field} in pyproject.toml."
406
501
  )
407
502
 
408
- return {
409
- "name": content["project"]["name"],
410
- "description": content["project"]["description"],
411
- "version": content["project"]["version"],
412
- "authors": content["project"].get("authors", [{"name": ""}])[0]["name"],
413
- }
503
+ # Extract author information safely
504
+ authors = project.get("authors", [])
505
+ author_name = ""
506
+
507
+ if authors and isinstance(authors, list) and len(authors) > 0:
508
+ first_author = authors[0]
509
+ if isinstance(first_author, dict):
510
+ author_name = first_author.get("name", "")
511
+ elif isinstance(first_author, str):
512
+ # Handle case where authors is a list of strings
513
+ author_name = first_author
514
+
515
+ # Extract dependencies with improved parsing
516
+ dependencies = extract_dependencies_from_toml(project)
517
+
518
+ return {
519
+ "name": project["name"].strip(),
520
+ "description": project["description"].strip(),
521
+ "version": project["version"].strip(),
522
+ "authors": author_name.strip(),
523
+ "dependencies": dependencies,
524
+ }
414
525
 
415
526
 
416
527
  def get_project_version(directory):
@@ -492,6 +603,7 @@ def pack(root, nolock):
492
603
  version or config["version"],
493
604
  config["authors"],
494
605
  root,
606
+ config.get("dependencies"),
495
607
  include_uv_lock=not nolock,
496
608
  )
497
609
  display_project_info(config)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.0.75
3
+ Version: 2.0.77
4
4
  Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
5
5
  Project-URL: Homepage, https://uipath.com
6
6
  Project-URL: Repository, https://github.com/UiPath/uipath-python
@@ -11,7 +11,7 @@ uipath/_cli/cli_deploy.py,sha256=KPCmQ0c_NYD5JofSDao5r6QYxHshVCRxlWDVnQvlp5w,645
11
11
  uipath/_cli/cli_init.py,sha256=SmB7VplpXRSa5sgqgzojNsZDw0zfsEi2TfkMx3eQpTo,5132
12
12
  uipath/_cli/cli_invoke.py,sha256=FurosrZNGlmANIrplKWhw3EQ1b46ph5Z2rPwVaYJgmc,4001
13
13
  uipath/_cli/cli_new.py,sha256=9378NYUBc9j-qKVXV7oja-jahfJhXBg8zKVyaon7ctY,2102
14
- uipath/_cli/cli_pack.py,sha256=qqmh7v0j4_vA4Xko5PgKFEbJIOXlmJBGd9IRnDi-wtA,17285
14
+ uipath/_cli/cli_pack.py,sha256=EcoF__1cihLTYwIVtuair-hQPc3fRG9nypLbU31MRqc,20984
15
15
  uipath/_cli/cli_publish.py,sha256=QT17JTClAyLve6ZjB-WvQaJ-j4DdmNneV_eDRyXjeeQ,6578
16
16
  uipath/_cli/cli_run.py,sha256=zYg-9U6mkofdGsE0IGjYi1dOMlG8CdBxiVGxfFiLq5Y,5882
17
17
  uipath/_cli/middlewares.py,sha256=f7bVODO9tgdtWNepG5L58-B-VgBSU6Ek2tIU6wLz0xA,4905
@@ -38,7 +38,7 @@ uipath/_cli/_templates/main.py.template,sha256=QB62qX5HKDbW4lFskxj7h9uuxBITnTWqu
38
38
  uipath/_cli/_templates/package.nuspec.template,sha256=YZyLc-u_EsmIoKf42JsLQ55OGeFmb8VkIU2VF7DFbtw,359
39
39
  uipath/_cli/_utils/_common.py,sha256=wQ0a_lGj0bsuNvwxUfnLwg6T3IdatdfkrPcZMoufJNU,2058
40
40
  uipath/_cli/_utils/_console.py,sha256=rj4V3yeR1wnJzFTHnaE6wcY9OoJV-PiIQnLg_p62ClQ,6664
41
- uipath/_cli/_utils/_constants.py,sha256=mCeSWLURgw_dOMXjzyYBAvxKN3Vcd1vf7XKHgbdrOds,25
41
+ uipath/_cli/_utils/_constants.py,sha256=9mRv_ZQoEPfvtTMipraQmYMJeCxcaLL7w8cYy4gJoQE,1225
42
42
  uipath/_cli/_utils/_debug.py,sha256=XlMkjtXT6hqyn7huioLDaVSYqo9fyWCvTkqEJh_ZEGw,1598
43
43
  uipath/_cli/_utils/_folders.py,sha256=UVJcKPfPAVR5HF4AP6EXdlNVcfEF1v5pwGCpoAgBY34,1155
44
44
  uipath/_cli/_utils/_input_args.py,sha256=pyQhEcQXHdFHYTVNzvfWp439aii5StojoptnmCv5lfs,4094
@@ -95,8 +95,8 @@ uipath/tracing/_traced.py,sha256=qeVDrds2OUnpdUIA0RhtF0kg2dlAZhyC1RRkI-qivTM,185
95
95
  uipath/tracing/_utils.py,sha256=ZeensQexnw69jVcsVrGyED7mPlAU-L1agDGm6_1A3oc,10388
96
96
  uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
97
97
  uipath/utils/_endpoints_manager.py,sha256=zcOsYwyoRzDuvdhdHwNabrqXRqC6e5J_GdEOriT7Dek,3768
98
- uipath-2.0.75.dist-info/METADATA,sha256=uAREv1kvwTRpAZSOumymODhJBi_oIWm8uR1Krr1UMM0,6462
99
- uipath-2.0.75.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
100
- uipath-2.0.75.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
101
- uipath-2.0.75.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
102
- uipath-2.0.75.dist-info/RECORD,,
98
+ uipath-2.0.77.dist-info/METADATA,sha256=ab1J3F72KfZqKiWGTk8KrkcILLvUGF1uQ0_4WW_OFuA,6462
99
+ uipath-2.0.77.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
100
+ uipath-2.0.77.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
101
+ uipath-2.0.77.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
102
+ uipath-2.0.77.dist-info/RECORD,,