Giter Site home page Giter Site logo

sethfischer / sphinxcontrib-cadquery Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 0.0 615 KB

Sphinx extension for rendering CadQuery models with VTK.js.

Home Page: https://sphinxcontrib-cadquery.readthedocs.io/

License: Other

Makefile 1.53% Python 69.95% JavaScript 14.45% Jinja 7.84% Shell 1.73% CSS 4.49%
cadquery sphinx-extension sphinxcontrib vtk-js vtkjs sphinx-doc sphinx-documentation

sphinxcontrib-cadquery's Introduction

sphinxcontrib-cadquery's People

Contributors

sethfischer avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

sphinxcontrib-cadquery's Issues

Provide stl download link

First of all THANKS! I was using cadquery-server to generate a static site with my models. While it works very well it is quite hard to customize. Sphinx makes that MUCH easier. One feature I miss though is the ability to export links to the models for download.

When I present my models I like to provide a download link to the part. Like below:

image

Right now I just have my pipeline run the export before the sphinx round and throw them in the _static directory. It would be cool to have a directive like this:

.. cadquery-export::
    :format: stl
    :caption: 3D print
    :name: front.stl

    result = cadquery.Workplane("front").box(2, 2, 0.5)

Where :format: is optional and the :name: would be used similarly to the cadquery export behavior.

That would present a link for download similar to the download directive below:

:download:`3D print <front.stl>`

Theoretically, the export function of the cqgi interface could be used. I have never written a directive before, so maybe that won't work for generating a file.

One other choice (while IMHO less flexible) could be to add a parameter like :export: file.stl that can add a download link next to the image like the image above.

.. cadquery-svg::
    :export: file.3mf

    result = cadquery.Workplane("front").box(2, 2, 0.5)
    show_object(result)

RTD build fails with module not found `sphinxcontrib.cadquery`

Read the Docs build fails with ModuleNotFoundError: No module named 'sphinxcontrib.cadquery':

python -m sphinx -T -E -b html -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/html
⋮
Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/sphinxcontrib-cadquery/envs/39/lib/python3.9/site-packages/sphinx/config.py", line 350, in eval_config_file
    exec(code, namespace)
  File "/home/docs/checkouts/readthedocs.org/user_builds/sphinxcontrib-cadquery/checkouts/39/docs/conf.py", line 7, in <module>
    import sphinxcontrib.cadquery
ModuleNotFoundError: No module named 'sphinxcontrib.cadquery'

When added to .readthedocs.yaml: build.jobs.post-install the following also fails:

python -c "import sphinxcontrib.cadquery; print(sphinxcontrib.cadquery.__version__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'sphinxcontrib.cadquery'

Last successful build: Build #19376393 dated Feb. 4, 2023. 1:54 a.m.
First failed build: Build #19562383 dated Feb. 22, 2023. 9:39 a.m.

The poetry install command reports successful installation of the project package:

poetry install
⋮
Installing the current project: sphinxcontrib-cadquery (0.4.0)

Dependencies installed with poetry install are available for import e.g cadquery, just not the current (root) project.

Incorrect Sphinx version used during RTD build

Build 19088114 is expected to use Sphinx 5.3.0, rather it uses Sphinx 6.1.1.

rtd-build-19088114.txt

Build 19088114 uses Poetry to install dependencies with a post_create_environment user-defined job, in a manner recommended by RTD.

As expected poetry install installs Sphinx 5.3.0. This is confirmed with poetry show sphinx in post_create_environment.

However, when the following is run by RTD:

/home/docs/checkouts/readthedocs.org/user_builds/sphinxcontrib-cadquery/envs/1/bin/python -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html

The output shows that Sphinx 6.1.1 is being used:

Running Sphinx v6.1.1
WARNING: html_static_path entry '_static' does not exist
building [mo]: targets for 0 po files that are out of date
writing output...
⋮

.readthedocs.yaml:

version: 2

build:
  os: ubuntu-20.04
  tools:
    nodejs: "19"
    python: "3.9"
  jobs:
    post_create_environment:
      # install Poetry
      - pip install poetry
      - poetry config virtualenvs.create false
      # install Python dependencies
      - poetry install
      - poetry show sphinx
    post_install:
      # install Node.js dependencies
      - npm clean-install
      # build
      - npm run build

sphinx:
  configuration: docs/conf.py

ipython is specified as a dependency

In pyproject.toml ipython is specified as a dependency.

This should not be required as ipython is a dependency of cadquery.

In sphinxcontrib-cadquery's pyproject.toml:

[tool.poetry.dependencies]
python = ">=3.9,<3.11"

Sphinx = "^5.3.0"
ipython = ">=7.31.1"
jinja2 = ">=3.0"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.