Skip to content

Fix DLL Loading Dependency and Add Google Colab Integration#12

Closed
dgaida wants to merge 4 commits intomasterfrom
fix-dll-loading-and-colab-docs-17757892621211443985
Closed

Fix DLL Loading Dependency and Add Google Colab Integration#12
dgaida wants to merge 4 commits intomasterfrom
fix-dll-loading-and-colab-docs-17757892621211443985

Conversation

@dgaida
Copy link
Copy Markdown
Owner

@dgaida dgaida commented Apr 17, 2026

This PR addresses two main issues: a FileNotFoundException in Google Colab when loading DLLs and the need for better "Open in Colab" integration in the documentation.

Changes:

  1. Centralized DLL Loading:
    • Introduced pyadm1/utils/dll_loader.py to handle all clr.AddReference calls.
    • Specifically included toolbox.dll, which resolves the missing optim_params assembly dependency that was causing crashes in Colab environments.
    • Automatically call load_dlls() in pyadm1/__init__.py to ensure resources are available upon package import.
  2. Codebase Cleanup:
    • Removed manual and redundant DLL reference logic from feedstock.py, digester.py, hydrolysis.py, adm1.py, and heating.py.
    • Restored several utility methods in feedstock.py (e.g., get_substrate_feed_mixtures, calc_OLR_fromTOC) that were accidentally omitted or removed in a previous iteration, while keeping the improved pythonnet 3.x compatibility fixes.
  3. Documentation Enhancements:
    • Added standard "Open in Colab" badges to README.md.
    • Updated English and German documentation homepages (docs/en/index.md, docs/de/index.md) and individual example pages with Colab links for the basic and complex plant notebooks.
  4. Test Updates:
    • Updated unit tests for Digester and HeatingSystem to remove checks for localized DLL loading logic which is now centralized.

Verification:

  • All 65 unit tests passed (with mocked .NET components).
  • Verified Markdown syntax and link targets for Colab buttons.

PR created automatically by Jules for task 17757892621211443985 started by @dgaida

- Created centralized DLL loader in `pyadm1/utils/dll_loader.py` to resolve `optim_params` dependency issues by referencing all DLLs including `toolbox.dll`.
- Updated `pyadm1/__init__.py` to automatically initialize DLLs on import.
- Removed redundant `clr.AddReference` calls across the codebase.
- Restored missing methods and properties in `feedstock.py` while maintaining pythonnet 3.x compatibility.
- Added "Open in Colab" buttons to `README.md`, documentation homepages, and example pages (EN/DE).
- Updated unit tests to align with centralized DLL loading.

Co-authored-by: dgaida <23057824+dgaida@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules bot and others added 3 commits April 17, 2026 06:09
Co-authored-by: dgaida <23057824+dgaida@users.noreply.github.com>
- Created centralized DLL loader in `pyadm1/utils/dll_loader.py` to resolve `optim_params` dependency issues by referencing all DLLs including `toolbox.dll`.
- Updated `pyadm1/__init__.py` to automatically initialize DLLs on import.
- Removed redundant `clr.AddReference` calls and unused imports across the codebase.
- Restored missing methods and properties in `feedstock.py` while maintaining pythonnet 3.x compatibility.
- Added "Open in Colab" buttons to `README.md`, documentation homepages, and example pages (EN/DE).
- Fixed PEP 8 linting issues in `tests/unit/test_feedstock.py` and example notebooks.
- Updated unit tests for `Feedstock` and `ADM1` to align with centralized DLL loading.

Co-authored-by: dgaida <23057824+dgaida@users.noreply.github.com>
- Centralized DLL loading in `pyadm1/utils/dll_loader.py` to resolve `optim_params` assembly issues.
- Updated `pyadm1/__init__.py` to initialize DLLs on import.
- Cleaned up unused imports and localized DLL references.
- Fixed logic errors in DLL method calls in `feedstock.py` and `adm1.py`.
- Restored missing utility methods in `feedstock.py`.
- Formatted all code with `black` to pass CI linting.
- Updated unit tests to align with architectural changes.
- Added "Open in Colab" buttons to documentation.

Co-authored-by: dgaida <23057824+dgaida@users.noreply.github.com>
@dgaida dgaida closed this Apr 17, 2026
@dgaida dgaida deleted the fix-dll-loading-and-colab-docs-17757892621211443985 branch April 17, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant