partcad-cli 0.6.37__tar.gz → 0.7.2__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.
Files changed (25) hide show
  1. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/PKG-INFO +11 -8
  2. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/README.md +9 -6
  3. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/pyproject.toml +1 -1
  4. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/requirements.txt +1 -1
  5. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/__init__.py +1 -1
  6. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli.py +38 -1
  7. partcad_cli-0.7.2/src/partcad_cli/cli_supply_caps.py +35 -0
  8. partcad_cli-0.7.2/src/partcad_cli/cli_supply_find.py +81 -0
  9. partcad_cli-0.7.2/src/partcad_cli/cli_supply_order.py +19 -0
  10. partcad_cli-0.7.2/src/partcad_cli/cli_supply_quote.py +120 -0
  11. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli.egg-info/PKG-INFO +11 -8
  12. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli.egg-info/SOURCES.txt +4 -0
  13. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli.egg-info/requires.txt +1 -1
  14. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/setup.cfg +0 -0
  15. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli_add.py +0 -0
  16. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli_info.py +0 -0
  17. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli_init.py +0 -0
  18. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli_inspect.py +0 -0
  19. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli_install.py +0 -0
  20. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli_list.py +0 -0
  21. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli_render.py +0 -0
  22. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli/cli_status.py +0 -0
  23. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli.egg-info/dependency_links.txt +0 -0
  24. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli.egg-info/entry_points.txt +0 -0
  25. {partcad_cli-0.6.37 → partcad_cli-0.7.2}/src/partcad_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: partcad-cli
3
- Version: 0.6.37
3
+ Version: 0.7.2
4
4
  Summary: Command-line interface to PartCAD
5
5
  Author-email: Roman Kuzmenko <openvmp@proton.me>
6
6
  Maintainer-email: Roman Kuzmenko <openvmp@proton.me>
@@ -12,7 +12,7 @@ Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Requires-Python: >=3.10
14
14
  Description-Content-Type: text/markdown
15
- Requires-Dist: partcad==0.6.37
15
+ Requires-Dist: partcad==0.7.2
16
16
  Requires-Dist: renderlab
17
17
  Requires-Dist: rlPyCairo
18
18
  Requires-Dist: svglib
@@ -40,11 +40,14 @@ And all of that is supercharged by the ultimate versioning and collaboration fea
40
40
 
41
41
  PartCAD features include:
42
42
 
43
- - 3D part models using STEP, STL and 3MF files
44
- - 3D part models using CadQuery, build123d and OpenSCAD scripting languages (including AI-generated: Gemini and GPT)
45
- - 2D blueprints using DXF, build123d and SVG files
46
- - Fully featured object-oriented approach to maintain part interfaces and mating information (with multiple class inheritance etc)
43
+ - 3D part models using [CadQuery](https://cadquery.readthedocs.io/), [build123d](https://build123d.readthedocs.io/) and [OpenSCAD](https://openscad.org/) scripting languages
44
+ - 3D part models using legacy STEP, STL and 3MF files
45
+ - Generate 3D models using LLM/GenAI: Google AI (Gemini), OpenAI (ChatGPT) or any model published to [Ollama](https://ollama.com/) (Llama 3.1, DeepSeek-Coder-V2, CodeGemma, Code Llama etc)
46
+ - 2D blueprints using [build123d](https://build123d.readthedocs.io/), or legacy DXF and SVG files
47
+ - Fully featured object-oriented approach to maintaining part interfaces and mating information (with multiple class inheritance etc)
47
48
  - Live preview of 3D models while coding in VS Code
49
+ - Render models to SVG, PNG and export to STEP, STL, 3MF, ThreeJS and OBJ
50
+ - Render Markdown documentation files
48
51
 
49
52
  Find [more documentation here](https://partcad.readthedocs.io/en/latest/?badge=latest) and visit [our website](https://partcad.org/).
50
53
 
@@ -84,8 +87,8 @@ On Ubuntu, try `apt install libcairo2-dev` if `pip install` fails to install `ca
84
87
 
85
88
  ## Tools for Mechanical Engineering
86
89
 
87
- Here is an overview of the open-source tools to maintain
88
- mechanical projects. It demonstrates where this framework fits
90
+ Here is an overview of open source tools to maintain
91
+ mechanical projects. It demonstrates where PartCAD fits
89
92
  in the modern mechanical development workflows.
90
93
 
91
94
  ```mermaid
@@ -20,11 +20,14 @@ And all of that is supercharged by the ultimate versioning and collaboration fea
20
20
 
21
21
  PartCAD features include:
22
22
 
23
- - 3D part models using STEP, STL and 3MF files
24
- - 3D part models using CadQuery, build123d and OpenSCAD scripting languages (including AI-generated: Gemini and GPT)
25
- - 2D blueprints using DXF, build123d and SVG files
26
- - Fully featured object-oriented approach to maintain part interfaces and mating information (with multiple class inheritance etc)
23
+ - 3D part models using [CadQuery](https://cadquery.readthedocs.io/), [build123d](https://build123d.readthedocs.io/) and [OpenSCAD](https://openscad.org/) scripting languages
24
+ - 3D part models using legacy STEP, STL and 3MF files
25
+ - Generate 3D models using LLM/GenAI: Google AI (Gemini), OpenAI (ChatGPT) or any model published to [Ollama](https://ollama.com/) (Llama 3.1, DeepSeek-Coder-V2, CodeGemma, Code Llama etc)
26
+ - 2D blueprints using [build123d](https://build123d.readthedocs.io/), or legacy DXF and SVG files
27
+ - Fully featured object-oriented approach to maintaining part interfaces and mating information (with multiple class inheritance etc)
27
28
  - Live preview of 3D models while coding in VS Code
29
+ - Render models to SVG, PNG and export to STEP, STL, 3MF, ThreeJS and OBJ
30
+ - Render Markdown documentation files
28
31
 
29
32
  Find [more documentation here](https://partcad.readthedocs.io/en/latest/?badge=latest) and visit [our website](https://partcad.org/).
30
33
 
@@ -64,8 +67,8 @@ On Ubuntu, try `apt install libcairo2-dev` if `pip install` fails to install `ca
64
67
 
65
68
  ## Tools for Mechanical Engineering
66
69
 
67
- Here is an overview of the open-source tools to maintain
68
- mechanical projects. It demonstrates where this framework fits
70
+ Here is an overview of open source tools to maintain
71
+ mechanical projects. It demonstrates where PartCAD fits
69
72
  in the modern mechanical development workflows.
70
73
 
71
74
  ```mermaid
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "partcad-cli"
3
- version = "0.6.37"
3
+ version = "0.7.2"
4
4
  description = "Command-line interface to PartCAD"
5
5
  readme = "README.md"
6
6
  keywords = ["cadquery", "build123d", "cad", "design", "openscad", "step", "stl"]
@@ -1,4 +1,4 @@
1
- partcad==0.6.37
1
+ partcad==0.7.2
2
2
  renderlab
3
3
  rlPyCairo
4
4
  svglib
@@ -4,4 +4,4 @@ __all__ = [
4
4
  "main_cli",
5
5
  ]
6
6
 
7
- __version__: str = "0.6.37"
7
+ __version__: str = "0.7.2"
@@ -24,6 +24,10 @@ from .cli_list import *
24
24
  from .cli_render import *
25
25
  from .cli_inspect import *
26
26
  from .cli_status import *
27
+ from .cli_supply_find import *
28
+ from .cli_supply_caps import *
29
+ from .cli_supply_order import *
30
+ from .cli_supply_quote import *
27
31
 
28
32
 
29
33
  # Initialize plugins that are not enabled by default
@@ -62,6 +66,8 @@ def main():
62
66
  dest="config_path",
63
67
  )
64
68
  # TODO(clairbee): add a config option to change logging mechanism and level
69
+
70
+ # Top level commands
65
71
  subparsers = parser.add_subparsers(dest="command")
66
72
  subparsers.add_parser(
67
73
  "version",
@@ -76,6 +82,20 @@ def main():
76
82
  cli_help_inspect(subparsers)
77
83
  cli_help_status(subparsers)
78
84
 
85
+ # Supply subcommands
86
+ parser_supply = subparsers.add_parser(
87
+ "supply",
88
+ help="Supplier related commands",
89
+ )
90
+ supply_subparsers = parser_supply.add_subparsers(
91
+ dest="supply_command",
92
+ required=True,
93
+ )
94
+ cli_help_supply_find(supply_subparsers)
95
+ cli_help_supply_caps(supply_subparsers)
96
+ cli_help_supply_quote(supply_subparsers)
97
+ cli_help_supply_order(supply_subparsers)
98
+
79
99
  args = parser.parse_args()
80
100
 
81
101
  # Configure logging
@@ -85,7 +105,7 @@ def main():
85
105
  logging.basicConfig()
86
106
 
87
107
  if args.quiet > 0:
88
- pc.logging.setLevel(logging.ERROR)
108
+ pc.logging.setLevel(logging.CRITICAL + 1)
89
109
  else:
90
110
  if args.verbosity > 0:
91
111
  pc.logging.setLevel(logging.DEBUG)
@@ -172,6 +192,23 @@ def main():
172
192
  with pc_logging.Process("inspect", "this"):
173
193
  cli_inspect(args, ctx)
174
194
 
195
+ elif args.command == "supply":
196
+ if args.supply_command == "find":
197
+ with pc_logging.Process("SupplyFind", "this"):
198
+ cli_supply_find(args, ctx)
199
+ elif args.supply_command == "caps":
200
+ with pc_logging.Process("SupplyCaps", "this"):
201
+ cli_supply_caps(args, ctx)
202
+ elif args.supply_command == "quote":
203
+ with pc_logging.Process("SupplyQuote", "this"):
204
+ cli_supply_quote(args, ctx)
205
+ elif args.supply_command == "order":
206
+ with pc_logging.Process("SupplyOrder", "this"):
207
+ cli_supply_order(args, ctx)
208
+ else:
209
+ print("Unknown supply command.\n")
210
+ parser.print_help()
211
+
175
212
  else:
176
213
  print("Unknown command.\n")
177
214
  parser.print_help()
@@ -0,0 +1,35 @@
1
+ #
2
+ # OpenVMP, 2024
3
+ #
4
+ # Author: Roman Kuzmenko
5
+ # Created: 2024-09-07
6
+ #
7
+ # Licensed under Apache License, Version 2.0.
8
+ #
9
+
10
+ import asyncio
11
+ import json
12
+ import partcad as pc
13
+
14
+ from partcad.provider_request_caps import ProviderRequestCaps
15
+
16
+
17
+ def cli_help_supply_caps(subparsers):
18
+ parser = subparsers.add_parser(
19
+ "caps",
20
+ help="Get capabilities of the provider",
21
+ )
22
+ parser.add_argument(
23
+ "providers",
24
+ metavar="provider[;key=value]",
25
+ help="Providers to query for capabilities",
26
+ nargs="+",
27
+ )
28
+
29
+
30
+ def cli_supply_caps(args, ctx):
31
+ for provider_spec in args.providers:
32
+ provider = ctx.get_provider(provider_spec)
33
+ req = ProviderRequestCaps()
34
+ caps = asyncio.run(provider.query_caps(req))
35
+ pc.logging.info(f"{provider_spec}: {json.dumps(caps, indent=4)}")
@@ -0,0 +1,81 @@
1
+ #
2
+ # OpenVMP, 2024
3
+ #
4
+ # Author: Roman Kuzmenko
5
+ # Created: 2024-09-07
6
+ #
7
+ # Licensed under Apache License, Version 2.0.
8
+ #
9
+
10
+ import asyncio
11
+ from partcad.provider_data_cart import ProviderCart
12
+ import partcad as pc
13
+ import json
14
+
15
+
16
+ def cli_help_supply_find(subparsers):
17
+ parser = subparsers.add_parser(
18
+ "find",
19
+ help="Find suppliers",
20
+ )
21
+ parser.add_argument(
22
+ "-j",
23
+ "--json",
24
+ help="Produce JSON output",
25
+ dest="json",
26
+ action="store_true",
27
+ )
28
+ parser.add_argument(
29
+ "-q",
30
+ "--qos",
31
+ help="Requested quality of service",
32
+ dest="qos",
33
+ )
34
+ parser.add_argument(
35
+ "--provider",
36
+ help="Provider to use",
37
+ dest="provider",
38
+ )
39
+ parser.add_argument(
40
+ "specs",
41
+ metavar="object[[,material],count]",
42
+ help="Part (default) or assembly to quote, with options",
43
+ nargs="+",
44
+ )
45
+
46
+
47
+ def cli_supply_find(args, ctx):
48
+ cart = ProviderCart()
49
+ asyncio.run(cart.add_objects(ctx, args.specs))
50
+
51
+ suppliers = {}
52
+ if args.provider:
53
+ provider = ctx.get_provider(args.provider)
54
+ if not provider.is_qos_available(args.qos):
55
+ pc.logging.error(
56
+ f"Provider {provider.name} cannot provide qos: {args.qos}."
57
+ )
58
+ asyncio.run(provider.load(cart))
59
+ for part_spec in cart.parts.values():
60
+ suppliers[str(part_spec)] = []
61
+ if not asyncio.run(provider.is_part_available(part_spec)):
62
+ pc.logging.error(
63
+ f"Provider {provider.name} cannot provide {part_spec.name}."
64
+ )
65
+ return
66
+ suppliers[str(part_spec)].append(provider.name)
67
+ else:
68
+ suppliers = asyncio.run(ctx.find_suppliers(cart, args.qos))
69
+ pc.logging.debug("Suppliers: %s" % str(suppliers))
70
+
71
+ if args.json:
72
+ print(json.dumps(suppliers))
73
+ else:
74
+ pc.logging.info(
75
+ "The requested parts are available through the following suppliers:"
76
+ )
77
+ for spec_str, suppliers in suppliers.items():
78
+ suppliers_str = ""
79
+ for supplier in suppliers:
80
+ suppliers_str += "\n\t\t" + str(supplier)
81
+ pc.logging.info(f"{spec_str}:{suppliers_str}")
@@ -0,0 +1,19 @@
1
+ #
2
+ # OpenVMP, 2024
3
+ #
4
+ # Author: Roman Kuzmenko
5
+ # Created: 2024-09-07
6
+ #
7
+ # Licensed under Apache License, Version 2.0.
8
+ #
9
+
10
+
11
+ def cli_help_supply_order(subparsers):
12
+ parser = subparsers.add_parser(
13
+ "order",
14
+ help="Order from suppliers",
15
+ )
16
+
17
+
18
+ def cli_supply_order(args, ctx):
19
+ pass
@@ -0,0 +1,120 @@
1
+ #
2
+ # OpenVMP, 2024
3
+ #
4
+ # Author: Roman Kuzmenko
5
+ # Created: 2024-09-07
6
+ #
7
+ # Licensed under Apache License, Version 2.0.
8
+ #
9
+
10
+ import asyncio
11
+ import copy
12
+ from partcad.provider_data_cart import *
13
+ from partcad.provider_request_quote import *
14
+ from partcad.utils import resolve_resource_path
15
+ import partcad as pc
16
+ import json
17
+ import sys
18
+
19
+
20
+ def cli_help_supply_quote(subparsers):
21
+ parser = subparsers.add_parser(
22
+ "quote",
23
+ help="Get a quote from suppliers",
24
+ )
25
+ parser.add_argument(
26
+ "-j",
27
+ "--json",
28
+ help="Produce JSON output",
29
+ dest="json",
30
+ action="store_true",
31
+ )
32
+ parser.add_argument(
33
+ "-q",
34
+ "--qos",
35
+ help="Requested quality of service",
36
+ dest="qos",
37
+ )
38
+ parser.add_argument(
39
+ "--provider",
40
+ help="Provider to use",
41
+ dest="provider",
42
+ )
43
+ parser.add_argument(
44
+ "specs",
45
+ metavar="object[[,material],count]",
46
+ help="Part (default) or assembly to quote, with options",
47
+ nargs="+",
48
+ )
49
+
50
+
51
+ def cli_supply_quote(args, ctx):
52
+ cart = ProviderCart(qos=args.qos)
53
+ asyncio.run(cart.add_objects(ctx, args.specs))
54
+ pc.logging.debug("Cart: %s" % str(cart.parts))
55
+
56
+ if args.provider:
57
+ provider = ctx.get_provider(args.provider)
58
+ preferred_suppliers = asyncio.run(ctx.select_supplier(provider, cart))
59
+ pc.logging.debug("Selected suppliers: %s" % str(preferred_suppliers))
60
+ else:
61
+ suppliers = asyncio.run(ctx.find_suppliers(cart))
62
+ pc.logging.debug("Suppliers: %s" % str(suppliers))
63
+ preferred_suppliers = ctx.select_preferred_suppliers(suppliers)
64
+ pc.logging.debug("Preferred suppliers: %s" % str(preferred_suppliers))
65
+
66
+ supplier_carts = asyncio.run(
67
+ ctx.prepare_supplier_carts(preferred_suppliers)
68
+ )
69
+ quotes = asyncio.run(ctx.supplier_carts_to_quotes(supplier_carts))
70
+ pc.logging.debug("Quotes: %s" % str(quotes))
71
+
72
+ if args.json:
73
+
74
+ def scrub(x):
75
+ # Handle ProviderRequestQuote
76
+ if isinstance(x, ProviderRequestQuote):
77
+ x = x.compose()
78
+
79
+ ret = copy.deepcopy(x)
80
+ # Handle dictionaries. Scrub all values
81
+ if isinstance(x, dict):
82
+ for k, v in copy.copy(list(ret.items())):
83
+ if k == "binary":
84
+ del ret[k]
85
+ else:
86
+ ret[k] = scrub(v)
87
+ elif isinstance(x, list):
88
+ # Handle lists. Scrub all values
89
+ for i, v in enumerate(ret):
90
+ ret[i] = scrub(v)
91
+
92
+ # Finished scrubbing
93
+ return ret
94
+
95
+ ret = json.dumps(scrub(quotes), indent=4)
96
+ sys.stdout.write(ret + "\n")
97
+ sys.stdout.flush()
98
+ else:
99
+ pc.logging.info("The following quotes are received:")
100
+ for supplier in sorted(quotes.keys(), reverse=True):
101
+ quote = quotes[supplier]
102
+ if supplier:
103
+ if not quote.result:
104
+ pc.logging.info(f"\t\t{supplier}: No quote received")
105
+ continue
106
+ price = quote.result["price"]
107
+ cart_id = quote.result["cartId"]
108
+ pc.logging.info(
109
+ "\t\t%s: %s: $%0.2f"
110
+ % (
111
+ supplier,
112
+ cart_id,
113
+ price,
114
+ )
115
+ )
116
+ else:
117
+ pc.logging.info(f"\t\tNo provider found:")
118
+
119
+ for part in quote.cart.parts.values():
120
+ pc.logging.info(f"\t\t\t{part.name}#{part.count}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: partcad-cli
3
- Version: 0.6.37
3
+ Version: 0.7.2
4
4
  Summary: Command-line interface to PartCAD
5
5
  Author-email: Roman Kuzmenko <openvmp@proton.me>
6
6
  Maintainer-email: Roman Kuzmenko <openvmp@proton.me>
@@ -12,7 +12,7 @@ Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Requires-Python: >=3.10
14
14
  Description-Content-Type: text/markdown
15
- Requires-Dist: partcad==0.6.37
15
+ Requires-Dist: partcad==0.7.2
16
16
  Requires-Dist: renderlab
17
17
  Requires-Dist: rlPyCairo
18
18
  Requires-Dist: svglib
@@ -40,11 +40,14 @@ And all of that is supercharged by the ultimate versioning and collaboration fea
40
40
 
41
41
  PartCAD features include:
42
42
 
43
- - 3D part models using STEP, STL and 3MF files
44
- - 3D part models using CadQuery, build123d and OpenSCAD scripting languages (including AI-generated: Gemini and GPT)
45
- - 2D blueprints using DXF, build123d and SVG files
46
- - Fully featured object-oriented approach to maintain part interfaces and mating information (with multiple class inheritance etc)
43
+ - 3D part models using [CadQuery](https://cadquery.readthedocs.io/), [build123d](https://build123d.readthedocs.io/) and [OpenSCAD](https://openscad.org/) scripting languages
44
+ - 3D part models using legacy STEP, STL and 3MF files
45
+ - Generate 3D models using LLM/GenAI: Google AI (Gemini), OpenAI (ChatGPT) or any model published to [Ollama](https://ollama.com/) (Llama 3.1, DeepSeek-Coder-V2, CodeGemma, Code Llama etc)
46
+ - 2D blueprints using [build123d](https://build123d.readthedocs.io/), or legacy DXF and SVG files
47
+ - Fully featured object-oriented approach to maintaining part interfaces and mating information (with multiple class inheritance etc)
47
48
  - Live preview of 3D models while coding in VS Code
49
+ - Render models to SVG, PNG and export to STEP, STL, 3MF, ThreeJS and OBJ
50
+ - Render Markdown documentation files
48
51
 
49
52
  Find [more documentation here](https://partcad.readthedocs.io/en/latest/?badge=latest) and visit [our website](https://partcad.org/).
50
53
 
@@ -84,8 +87,8 @@ On Ubuntu, try `apt install libcairo2-dev` if `pip install` fails to install `ca
84
87
 
85
88
  ## Tools for Mechanical Engineering
86
89
 
87
- Here is an overview of the open-source tools to maintain
88
- mechanical projects. It demonstrates where this framework fits
90
+ Here is an overview of open source tools to maintain
91
+ mechanical projects. It demonstrates where PartCAD fits
89
92
  in the modern mechanical development workflows.
90
93
 
91
94
  ```mermaid
@@ -11,6 +11,10 @@ src/partcad_cli/cli_install.py
11
11
  src/partcad_cli/cli_list.py
12
12
  src/partcad_cli/cli_render.py
13
13
  src/partcad_cli/cli_status.py
14
+ src/partcad_cli/cli_supply_caps.py
15
+ src/partcad_cli/cli_supply_find.py
16
+ src/partcad_cli/cli_supply_order.py
17
+ src/partcad_cli/cli_supply_quote.py
14
18
  src/partcad_cli.egg-info/PKG-INFO
15
19
  src/partcad_cli.egg-info/SOURCES.txt
16
20
  src/partcad_cli.egg-info/dependency_links.txt
@@ -1,4 +1,4 @@
1
- partcad==0.6.37
1
+ partcad==0.7.2
2
2
  renderlab
3
3
  rlPyCairo
4
4
  svglib
File without changes