Skip to content

Commit

Permalink
Merge branch 'main' into docs-4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston authored Feb 15, 2025
2 parents d32c2b3 + e3a9eb6 commit 7f94783
Show file tree
Hide file tree
Showing 161 changed files with 144,770 additions and 39,038 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Extension

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: macos-14
strategy:
matrix:
version: [4.2.5, 4.3.2]
env:
ADDON_NAME: molecularnodes
steps:
- uses: actions/checkout@v3
- uses: SebRollen/[email protected]
id: read_manifest
with:
file: '${{ env.ADDON_NAME }}/blender_manifest.toml'
field: 'version'
- uses: BradyAJohnston/[email protected]
with:
version: ${{ matrix.version }}
- name: Build extension
run: |
blender -b -P build.py
mkdir artifact
mv ${{ env.ADDON_NAME }}-${{ steps.read_manifest.outputs.value }}-*.zip ./artifact/.
- name: Archive addon
uses: actions/upload-artifact@v4
with:
name: ${{ env.ADDON_NAME }}-build_${{ matrix.version }}-${{ github.sha }}
retention-days: 3
path: |
./artifact/*
36 changes: 12 additions & 24 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,25 @@ on:

jobs:
build-docs:
runs-on: ubuntu-latest
runs-on: macos-14
permissions: write-all
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11.7"
cache: pip

- uses: quarto-dev/quarto-actions/setup@v2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "1.4.549"
- name: Build docs using blender
version: "latest"

- name: Render Docs
run: |
wget -nv https://download.blender.org/release/Blender4.1/blender-4.1.0-linux-x64.tar.xz
tar -xf blender-4.1.0-linux-x64.tar.xz
blender-4.1.0-linux-x64/blender --version
blender-4.1.0-linux-x64/blender -b --python docs/install.py
blender-4.1.0-linux-x64/blender -b --python docs/build_node_docs.py

- name: Build Docs
run: make docs-build
uv sync --all-extras
cd docs
uv run generate.py
uv run quartodoc build
cd ..
uv run quarto render docs
# push to netlify -------------------------------------------------------

# set release name ----

- name: Configure pull release name
if: ${{github.event_name == 'pull_request'}}
run: |
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
tags:
- 'v*'

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/molecularnodes
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: build
run: |
uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
64 changes: 0 additions & 64 deletions .github/workflows/test-addon.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/test-daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test Daily Build

on:
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
version: ["daily"]
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: BradyAJohnston/[email protected]
with:
version: ${{ matrix.version }}
- name: Install in Blender
run: |
blender -b -P tests/python.py -- -m pip install ".[test]"
- name: Run Tests
run: |
blender -b -P tests/run.py -- -vv tests --cov --cov-report=xml
81 changes: 36 additions & 45 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
name: test-addon
name: test-in-blender

on:
push:
branches: ["main"]
pull_request:
branches: ["main", "4.1"]

push:
branches: ["main"]
pull_request:
branches: ["main", "4.2", "4.3"]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
blender-version: ["4.1.0"]
python-version: ['3.11.7']
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# - run: pip install bpy==${{ matrix.blender-version }}
- name: Install
run: |
pip install poetry
poetry install --with=dev
- name: Install pyopenvdb
if: matrix.os == 'ubuntu-latest'
run: |
cd $(poetry run python -c "import os; import bpy; print(os.path.dirname(bpy.__file__)+'/../../../../../')")
svn export https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_x86_64_glibc_228/python/lib/python3.10/site-packages/pyopenvdb.so@r63589
pip install patchelf
patchelf --set-rpath '$ORIGIN/bpy/lib' pyopenvdb.so
- name: Run Tests
run: poetry run python -m pytest --verbose --cov=molecularnodes --cov-report=xml:coverage.xml --ignore=molecularnodes/ui/panel.py -k "not star"
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
version: ["4.2.5", "4.3.2", "daily"]
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: BradyAJohnston/[email protected]
with:
version: ${{ matrix.version }}
- name: Install in Blender
run: |
blender -b -P tests/python.py -- -m pip install ".[test]"
- name: Run Tests
run: |
blender -b -P tests/run.py -- -vv tests --cov --cov-report=xml
- name: Expose coverage as a CI download
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.version == '4.2.5'
with:
name: coverage.xml
path: coverage.xml

- name: Expose coverage as a CI download # Related to test_addon_blender_advanced.py
uses: actions/upload-artifact@v1
with:
name: coverage.xml
path: coverage.xml
# setup ssh to check on file system state
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Upload coverage reports to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3

8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ logs/
*.log
.luarc.json
dist
poetry.lock
*.lock
*xtc_offsets.lock
*.DS_Store
.mda_session
*.vdb
docs/nodes/*.qmd
!docs/nodes/index.qmd
*.whl
*.MNSession

/.luarc.json
tests/data/starfile/montage.tiff
tests/data/cellpack/petworld/*.cif
/docs/api
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
13 changes: 10 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ Unfortunately `.blend` files are binary files to git, so the full repo size can

For writing code, I highly recommend using VSCode and the [Blender VS Code](https://github.com/JacquesLucke/blender_vscode) addon which streamlines the development process. It provides a range of commands for building and quickly refreshing the add-on during development, greatly speeding up the process.

> **Important** First Time Building
>
> Run the `build.py` to download and setup required packages for the first time.
```py
blender -b -P build.py
```

Once installed, you can use the `Blender: Build and Start` command with VS Code open in the addon directory, to start Blender with the addon built and installed. Any changes that are then made to the underlying addon code, can be quickly previewed inside of the running Blender by using the VS Code command `Blender: Reload Addons`.


Expand Down Expand Up @@ -223,7 +230,7 @@ Please open an issue or PR if you would like to discuss submitting changes. Supp
Blender is _VERY PARTICULAR_ about python versions. Blender 4.1 now uses Python `3.11.X`. Blender 4.0 and some earlier versions use Python `3.10.X`. I recommend using `anaconda` or something similar to manage python environments. They aren't required for building and running the add-on (this is handled by the Python that is shipped inside of Blender), but they are required for running tests.

```bash
conda create -n mn python==3.10
conda create -n mn python==3.11
conda activate mn
pip install poetry
poetry install --with dev
Expand All @@ -247,13 +254,13 @@ To build the documentation, [`Quarto`](https://quarto.org) is used. The docs can

```bash
conda activate mn
python docs/build_node_docs.py
python docs/generate.py
quarto preview
```

The long-form written documentation is all inside of `docs/`. Documentation is written in markdown (`.md`) or quarto-flavored markdown (`.qmd`) which allows to execute code when building the docs.

The documentation for individual nodes which are shown [here](https://bradyajohnston.github.io/MolecularNodes/nodes/) are built by running the `docs/build_node_docs.py`, which extracts information from the relevent `.blend` data files inside of `molecularnodes/assets/`. Combining the information for the input / output types & tooltips with the summaries described in `molecularnodes/ui/node_info.py` we can then generate nice HTML documentation for each of the nodes.
The documentation for individual nodes which are shown [here](https://bradyajohnston.github.io/MolecularNodes/nodes/) are built by running the `docs/generate.py`, which extracts information from the relevent `.blend` data files inside of `molecularnodes/assets/`. Combining the information for the input / output types & tooltips with the summaries described in `molecularnodes/ui/node_info.py` we can then generate nice HTML documentation for each of the nodes.

This isn't currently the best implementation for this. I would prefer to just pull from those nodes which are defined in the `.blend` file, but we aren't able to include descriptions for the node groups currently inside of the `.blend`. `node_info.py` is also used for building the add menus as well as the documentation. To update the descriptions of inputs, outputs and data types the nodes themselves need to be updated inside of the `.blend` files. Relevant example videos should be updated when nodes are changed.

Expand Down
Loading

0 comments on commit 7f94783

Please sign in to comment.