Skip to content

Commit 99cedce

Browse files
Build images (#2028)
* Initial apptainer CQ file * Initial image workflow * Update path * Try copying everything * Debugging * Manipulate the env * Try to install cq * Debugging * Update env file handling * Test after building * Add git * Remove redundant pytest run * Try to build docker image too * Remove prefix * Debug build * Remove head * More debuggig * More debuggig * More debuggig * Try chowning opt * Trying to produce a MRE * Less minimal example * Turn off chown * Another variant * Revert debugging changes * Back to the original env file * Remove redundant test step * Use tmp * Add a deploy step * Diffeent temp name for testing * Explicit name * Push docker too * Add suggestion from lorenzncode * Typo fix * Run tests for docker too * Typo fix * Only publish on master * Adjust if statements * Use newer checkout version * Add jupyterlab * Seperate install files * Updated def * Update ci * Specify exact path * Restructure the def file * Line endings * Update dockerfile * Set MYDIR * Publish under branch name * Use branch name everywhere * Same for sif upload * Final version * Update README * Update docs * Fixing code blocks * More docs corrections * Change dir to opt for docker * Do not install in editable mode * Update docs * Apply suggestions from code review Co-authored-by: AU <adam-urbanczyk@users.noreply.github.com> * Apply changes from master * Apply suggestions from code review Co-authored-by: Jeremy Wright <wrightjmf@gmail.com> Co-authored-by: AU <adam-urbanczyk@users.noreply.github.com> --------- Co-authored-by: adam-urbanczyk <13981538+adam-urbanczyk@users.noreply.github.com> Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>
1 parent 2ad621e commit 99cedce

12 files changed

Lines changed: 240 additions & 80 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build Apptainer and Docker images with CQ using micromamba
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: master
7+
8+
env:
9+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
10+
11+
jobs:
12+
build-test-container:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
container:
19+
image: ghcr.io/apptainer/apptainer:1.4.1
20+
options: --privileged
21+
22+
name: Build Apptainer
23+
steps:
24+
25+
- name: Check out code for the container builds
26+
uses: actions/checkout@v6
27+
28+
- name: Build Container
29+
run: |
30+
apptainer build cq.sif images/cq.def
31+
32+
- name: Test Container
33+
run: |
34+
apptainer run cq.sif pytest tests/
35+
36+
- name: Store sif
37+
uses: actions/upload-artifact@v6
38+
with:
39+
path: cq.sif
40+
41+
- name: Deploy to GHCR
42+
if: contains( env.BRANCH_NAME, 'master')
43+
run: |
44+
echo ${{ secrets.GITHUB_TOKEN }} | apptainer registry login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
45+
apptainer push cq.sif oras://ghcr.io/cadquery/cadquery-apptainer:${BRANCH_NAME}
46+
47+
build-docker-container:
48+
runs-on: ubuntu-latest
49+
permissions:
50+
contents: read
51+
packages: write
52+
53+
name: Build Docker
54+
steps:
55+
56+
- name: Check out code for the container builds
57+
uses: actions/checkout@v6
58+
59+
- name: Authenticate
60+
run: |
61+
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
62+
63+
- name: Build Container
64+
run: |
65+
docker build -t ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME} -f images/dockerfile .
66+
67+
- name: Test
68+
run: |
69+
docker run --rm -v $(pwd):/host -w /host ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME} pytest tests/
70+
71+
- name: Deploy to GHCR
72+
if: contains(env.BRANCH_NAME, 'master')
73+
run: |
74+
docker push ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME}
75+

README.md

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,46 @@
1818

1919
CadQuery is an intuitive, easy-to-use Python module for building parametric 3D CAD models. Using CadQuery, you can write short, simple scripts that produce high quality CAD models. It is easy to make many different objects using a single script that can be customized.
2020

21-
CadQuery is often compared to [OpenSCAD](http://www.openscad.org/). Like OpenSCAD, CadQuery is an open-source, script based, parametric model generator. However, CadQuery stands out in many ways and has several key advantages:
22-
23-
1. The scripts use a standard programming language, Python, and thus can benefit from the associated infrastructure. This includes many standard libraries and IDEs.
24-
2. CadQuery's CAD kernel Open CASCADE Technology ([OCCT](https://en.wikipedia.org/wiki/Open_Cascade_Technology)) is much more powerful than the [CGAL](https://en.wikipedia.org/wiki/CGAL) used by OpenSCAD. Features supported natively by OCCT include NURBS, splines, surface sewing, STL repair, STEP import/export, and other complex operations, in addition to the standard CSG operations supported by CGAL
25-
3. Ability to import/export [STEP](https://en.wikipedia.org/wiki/ISO_10303) and the ability to begin with a STEP model, created in a CAD package, and then add parametric features. This is possible in OpenSCAD using STL, but STL is a lossy format.
26-
4. CadQuery scripts require less code to create most objects, because it is possible to locate features based on the position of other features, workplanes, vertices, etc.
27-
5. CadQuery scripts can build STL, STEP, AMF and 3MF faster than OpenSCAD.
28-
29-
CadQuery was built to be used as a Python library without any GUI. This makes it great for use cases such as integration into servers, or creating scientific and engineering scripts. Options for visualization are also available including CQ-Editor and JupyterLab.
21+
CadQuery was built to be used as a Python library without any GUI. This makes it great for use cases such as integration into servers, or creating scientific and engineering scripts. However, it includes internal visualization capabilities.
22+
Additionally, other options for visualization are also available including CQ-Editor and JupyterLab.
3023

3124
For those who are interested, the [OCP repository](https://github.com/CadQuery/OCP) contains the current OCCT wrapper used by CQ.
3225

3326
### Key features
27+
3428
* Build 3D models with scripts that are as close as possible to how you would describe the object to a human.
3529
* Create parametric models that can be very easily customized by end users.
3630
* Output high quality (loss-less) CAD formats like STEP and DXF in addition to STL, VRML, AMF and 3MF.
3731
* Provide a non-proprietary, plain text model format that can be edited and executed with only a web browser.
3832
* Offer advanced modeling capabilities such as fillets, curvilinear extrudes, parametric curves and lofts.
3933
* Build nested assemblies out of individual parts and other assemblies.
4034

41-
### Why this fork
42-
43-
The original version of CadQuery was built on the FreeCAD API. This was great because it allowed for fast development and easy cross-platform capability. However, we eventually started reaching the limits of the API for some advanced operations and selectors. This 2.0 version of CadQuery is based directly on a Python wrapper of the OCCT kernel. This gives us a great deal more control and flexibility, at the expense of some simplicity and having to handle the cross-platform aspects of deployment ourselves. We believe this is a worthwhile trade-off to allow CadQuery to continue to grow and expand in the future.
44-
4535
## Getting started
4636

4737
To learn more about designing with CadQuery, visit the [documentation](https://cadquery.readthedocs.io/en/latest/intro.html), [examples](https://cadquery.readthedocs.io/en/latest/examples.html), and [cheatsheet](https://cadquery.readthedocs.io/en/latest/_static/cadquery_cheatsheet.html).
4838

49-
To get started playing around with CadQuery and see its capabilities, take a look at the [CQ-editor GUI](https://github.com/CadQuery/CQ-editor). This easy-to-use IDE is a great way to get started desiging with CadQuery. The CQ-editor installer bundles both CQ-editor and CadQuery (recommended). See the [CQ-editor installation instructions](https://cadquery.readthedocs.io/en/latest/installation.html#adding-a-nicer-gui-via-cq-editor).
39+
To quickly get started you can use apptainer
5040

41+
```
42+
apptainer run oras://ghcr.io/cadquery/cadquery-apptainer:master ipython -i -c"from cadquery.func import *; from cadquery.vis import show; show(box(1,1,1))"
43+
```
44+
45+
or docker/podman.
46+
47+
```
48+
podman run -i -v /tmp:/tmp -e DISPLAY=$DISPLAY --userns=keep-id --user "$(id -u):$(id -g)" --device /dev/dri -t ghcr.io/cadquery/cadquery-docker:master ipython -i -c"from cadquery.func import *; from cadquery.vis import show; show(box(1,1,1))"
49+
```
5150

52-
The CadQuery library (with or without CQ-editor) and its dependencies may be installed using conda, or pip. Note that conda (or the CQ-editor installer) is the better supported option.
51+
The CadQuery library (with or without CQ-editor) and its dependencies may be installed using conda/mamba/micromamba/pixi, or pip.
52+
Note that conda-based installation (or the CQ-editor installer) is the better supported option.
5353

5454
See the documentation for detailed CadQuery [installation instructions](https://cadquery.readthedocs.io/en/latest/installation.html).
5555

5656
### CadQuery Installation Via Conda
5757

5858
To first install the Conda package manager see [Install the Conda Package Manager](https://cadquery.readthedocs.io/en/latest/installation.html#install-the-conda-package-manager), and [Miniforge](https://github.com/conda-forge/miniforge) for a minimal installer.
5959

60-
``mamba install`` is recommended over ``conda install`` for faster and less memory intensive cadquery installation.
60+
``mamba install`` is recommended over ``conda install`` for faster and less memory intensive CadQuery installation.
6161

6262
```
6363
# Set up a new environment
@@ -91,6 +91,29 @@ It is also possible to install the very latest changes directly from CadQuery's
9191
pip install git+https://github.com/CadQuery/cadquery.git
9292
```
9393

94+
### Built-in visualization
95+
96+
CadQuery has built in visualization capabilities using trame and vtk.
97+
98+
```
99+
from cadquery.func import box, fillet
100+
from cadquery.vis import show
101+
102+
b = box(1,1,1)
103+
show(fillet(b, b.edges("|Z"), 0.1))
104+
105+
```
106+
107+
For non-blocking and persistent view one can use.
108+
109+
```
110+
from cadquery.func import box, fillet
111+
from cadquery.fig import show
112+
113+
b = box(1,1,1)
114+
show(fillet(b, b.edges("|Z"), 0.1))
115+
116+
```
94117

95118
### CQ-editor GUI
96119

@@ -124,33 +147,10 @@ We also have a [Google Group](https://groups.google.com/forum/#!forum/cadquery)
124147

125148
There is also a [Discord](https://discord.com/invite/Bj9AQPsCfx) server, but the other methods of getting help are much better for newcomers.
126149

127-
## Projects using CadQuery
128-
129-
Here are just a few examples of how CadQuery is being used.
130-
131-
### FxBricks Lego Train System
132-
133-
[FxBricks](https://fxbricks.com/) uses CadQuery in the product development pipeline for their Lego train system. FxBricks has also given back to the community by creating [documentation for their CAD pipeline](https://github.com/fx-bricks/fx-cad-notes). They have also assembled [cq-kit](https://github.com/michaelgale/cq-kit), a library containing utility classes and functions to extend the capabilities of CadQuery. Thanks to @michaelgale and @fx-bricks for this example.
134-
135-
![FxBricks Pipeline Diagram](https://raw.githubusercontent.com/fx-bricks/fx-cad-notes/master/images/model_overview.png)
136-
137-
### Hexidor Board Game Development
138-
139-
Hexidor is an expanded take on the Quoridor board game, and the development process has been chronicled [here](https://bruceisonfire.net/2020/04/23/my-adventure-with-flosscad-the-birth-of-hexidor/). CadQuery was used to generate the game board. Thanks to Bruce for this example.
140-
141-
<img src="https://bruceisonfire.net/wp-content/uploads/2020/04/16-945x709.jpg" alt="Hexidor Board Game" width="400"/>
142-
143-
### Spindle assembly
144-
145-
Thanks to @marcus7070 for this example from [here](https://github.com/marcus7070/spindle-assy-example).
146-
147-
<img src="./doc/_static/assy.png" width="400">
148-
149-
### 3D Printed Resin Mold
150+
## Citing
150151

151-
Thanks to @eddieliberato for sharing [this example](https://jungletools.blogspot.com/2017/06/an-anti-kink-device-for-novel-high-tech.html) of an anti-kink resin mold for a cable.
152+
Please use our Zenodo DOI if you use CadQuery for scientific research: https://doi.org/10.5281/zenodo.3955118.
152153

153-
<img src="https://3.bp.blogspot.com/-2FiHOGUhtxo/WTRsViGdOXI/AAAAAAAAA-E/sb5ehwPVr-EncYC8RM2-v21M3AAmbjUjQCLcB/s1600/Screenshot%2Bfrom%2B2017-06-04%2B22-05-07.png" alt="3D printed resin mold" height="250"/>
154154

155155
## License
156156

@@ -227,6 +227,3 @@ When filing a bug report [issue](https://github.com/CadQuery/cadquery/issues), p
227227

228228
If you find yourself wishing for a feature that does not exist, you are probably not alone. There are bound to be others out there with similar needs. Open an [issue](https://github.com/CadQuery/cadquery/issues) which describes the feature you would like to see, why you need it, and how it should work.
229229

230-
## Citing
231-
232-
Please use our Zenodo DOI if you use CadQuery for scientific research: https://doi.org/10.5281/zenodo.3955118.

doc/_static/quickstart/002.png

443 KB
Loading

doc/_static/quickstart/003.png

430 KB
Loading

doc/_static/quickstart/004.png

401 KB
Loading

doc/_static/quickstart/005.png

409 KB
Loading

0 commit comments

Comments
 (0)