-
Notifications
You must be signed in to change notification settings - Fork 10
updates & more test #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b73d20a
stl codec bug fixes
ianscrivener 2e83e30
Bump python to min 3.11, also black & click. All tests passing
ianscrivener 14066a6
added 28 more test, now 623 in total
ianscrivener 3f4370a
update README
ianscrivener 9e60189
update TECH_README.md
ianscrivener 8d15fe2
update README.md
ianscrivener bff02e3
bump to py 3.13
ianscrivener ecf091c
add py 3.13
ianscrivener cd99e63
bump to py 3.11
ianscrivener 985cb44
bump to py 3.11
ianscrivener 0843b56
ci/cd updates
ianscrivener dbff51e
ci: upgrade actions for Node 24 transition and align python jobs
ianscrivener 89bad34
ci: fix black lint target and formatting
ianscrivener 777d692
And some documentation about the GitHub workflows to the README.
ianscrivener c7236c7
.gitignore update
ianscrivener File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # CadQuery CLI (cq-cli) - Project Overview | ||
|
|
||
| `cq-cli` is a Command Line Interface for executing CadQuery scripts and converting their output to various formats (STEP, STL, DXF, SVG, GLB, GLTF, ThreeJS). It is designed to be used in automation pipelines and supports stdin/stdout streams. | ||
|
|
||
| ## Architecture | ||
|
|
||
| The project is built around the **CadQuery Gateway Interface (CQGI)**. | ||
| - **Entry Point:** `src/cq_cli/main.py` handles argument parsing, script loading, and coordination between CQGI and codecs. | ||
| - **Plugin System:** Codecs are dynamically loaded from `src/cq_cli/cqcodecs/` by `loader.py`. Any file matching `cq_codec_*.py` is treated as a codec. | ||
| - **FreeCAD Support:** Integrates `cadquery_freecad_import_plugin` to handle `.fcstd` files. | ||
|
|
||
| ## Tech Stack | ||
| - **Language:** Python 3.9+ | ||
| - **Core Library:** [CadQuery](https://github.com/CadQuery/cadquery) | ||
| - **Environment Management:** `uv` (preferred) | ||
| - **Build Tool:** PyInstaller (for standalone binaries) | ||
| - **Testing:** `pytest` | ||
|
|
||
| ## Key Commands | ||
|
|
||
| ### Development | ||
| - **Install Dependencies:** `uv sync` | ||
| - **Run CLI (Development):** `python -m cq_cli.main --help` | ||
| - **Run Tests:** `pytest` | ||
| - **Linting:** `black` (v19.10b0 specified in `pyproject.toml`) | ||
|
jmwright marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### Usage Examples | ||
| - **Convert to STEP:** `cq-cli --codec step --infile model.py --outfile model.step` | ||
| - **Auto-detect Codec:** `cq-cli --infile model.py --outfile model.stl` | ||
| - **Extract Parameters:** `cq-cli --getparams true --infile model.py` | ||
| - **Pass Parameters:** `cq-cli --params "width:10;height:20" --infile model.py` | ||
| - **Evaluate Expression:** `cq-cli --expression "my_part(10)" --infile models.py` | ||
|
|
||
| ### Building | ||
| - **PyInstaller (One-file):** `pyinstaller cq-cli_pyinstaller.spec onefile` | ||
| - **PyInstaller (Directory):** `pyinstaller cq-cli_pyinstaller.spec dir` | ||
|
|
||
| ## Development Conventions | ||
|
|
||
| ### Adding a New Codec | ||
| 1. Create `src/cq_cli/cqcodecs/cq_codec_[name].py`. | ||
| 2. Implement a `convert` function: | ||
| ```python | ||
| def convert(build_result, outfile, errfile, output_opts): | ||
| # build_result is a cqgi.BuildResult | ||
| # Return string/bytes for writing to outfile (or stdout) | ||
| # Return None if the codec writes directly to outfile | ||
| ``` | ||
| 3. Add the new codec to `hiddenimports` in `cq-cli_pyinstaller.spec` for standalone builds. | ||
| 4. Add a test in `tests/test_[name]_codec.py`. | ||
|
|
||
| ### Exit Codes | ||
| - **0:** Success | ||
| - **1:** Input file read error | ||
| - **2:** Usage/Argument error | ||
| - **3:** Missing/Invalid codec | ||
| - **100:** CadQuery build error (script execution failure) | ||
| - **200:** Codec conversion error | ||
|
|
||
| ## Testing | ||
| Tests are located in the `tests/` directory and use `pytest`. Many tests rely on `tests/test_helpers.py` for CLI invocation and `tests/testdata/` for sample scripts. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.