This release is a pre-release and may not be stable for production use.
dnv-hydrod
dnv-hydrod is a Python library that provides seamless integration with DNV HydroD through pythonnet, enabling programmatic access to HydroD workspace files (.hydx) and modeling APIs.
This library automatically locates your HydroD installation, loads required .NET assemblies, and provides a Pythonic interface for workspace operations, analysis execution, and concept manipulation.
Requirements:
-
DNV HydroD 9.0 and higher (must be installed on the system)
-
A supported Python version as declared by the package metadata (
requires-python) -
A matching .NET Desktop Runtime, installed globally (system-wide):
- HydroD 9.1.x requires .NET Desktop Runtime 10.0
- HydroD 9.0.x requires .NET Desktop Runtime 8.0
The self-contained .NET runtime shipped inside HydroD's installation folder cannot be used by this package: hosting CoreCLR from there loads HydroD's bundled
Python.Runtime.dll(3.0.5) instead of the pip-installed copy, which then crashes inPython.Runtime.ModuleObject.tp_setattrothe first time HydroD's scripting service registers a .NET namespace. If the matching global .NET Desktop Runtime is missing,dnv-hydrodraises a clearRuntimeErroron import with a download link.
Installation
Installing from PyPI (when published):
pip install dnv-hydrod
Quick Start
from dnv.hydrod import *
# Open existing workspace with license keys
with WorkspaceSession(
r"C:\Projects\myworkspace.hydx",
license_keys=['WIND']
) as session:
# Access workspace concepts
analyses = FindConcept("/Workspace/Analyses")
# Create and execute custom analysis
ca = CustomAnalysis(analyses, "MyAnalysis")
ca.InlineScript = """
import time
print('Starting analysis...')
time.sleep(2)
print('Analysis completed!')
"""
ca.Execute()
Key Features
- Automatic HydroD Detection: Uses DNV Application Version Manager to locate HydroD installation
- Context Manager Support: Safe workspace handling with automatic cleanup
- Pythonic API: Clean, intuitive interface for HydroD operations
- Embedded Modules: Access to Python utilities embedded in HydroD .NET assemblies
Documentation
This library provides Python bindings to HydroD's .NET API. For comprehensive information about available classes, methods, workflows, and HydroD concepts, please refer to the HydroD Documentation and API reference included with your HydroD installation.
Usage Examples
Creating a New Workspace
from dnv.hydrod import *
# Create new workspace with license keys
with WorkspaceSession(
r"C:\Projects",
"NewWorkspace",
license_keys=['WIND']
) as session:
# Workspace is automatically saved as NewWorkspace.hydx
print("Workspace created successfully!")
Working with Concepts
from dnv.hydrod import *
with WorkspaceSession(
r"C:\Projects\myworkspace.hydx",
license_keys=['WIND']
) as session:
# Find concepts using path
load_cases_table = FindConcept("/Workspace/Analyses/DesignLoadCasesTable1")
# Create new DesignLoadCase entry
udlc1 = DesignLoadCase()
udlc1.Selected=True
udlc1.Name="DLC_new"
udlc1.SimaBladedFolder="Inputs\\Sima_ULS_Hs11_Deg90_Vw23"
udlc1.SimaBladedFileName="sima"
udlc1.EnvironmentalLoadFactor=0.8
udlc1.PermanentLoadFactor=0.8
udlc1.StartTime=300
udlc1.StopTime=340
# Add new DesignLoadCase entry to "UlsDesignLoadCases1" concept
load_cases_table.DesignLoadCases.Add(udlc1)
Generate Runs and run ULS workflow through Python
from dnv.hydrod import *
with WorkspaceSession(
r"C:\Projects\myworkspace.hydx",
license_keys=['WIND']
) as session:
runFolder = FindConcept("/Workspace/Analyses/Workflow1/Runs")
# If the run folder already exists, delete it to remove previous results
if (runFolder):
Delete(runFolder)
workflow = FindConcept("/Workspace/Analyses/Workflow1")
workflow.GenerateRuns()
workflow.Execute()
Architecture
- load_assemblies.py: Initializes .NET runtime, locates HydroD, loads assemblies
- workspace_utils.py: Provides WorkspaceSession and utility functions
- Embedded modules: Python code extracted from HydroD .NET assemblies at runtime
Limitations
- HydroD must be installed on the system
License
This project is licensed under the MIT License. See the LICENSE file in the package directory for full license text.
Support
For issues, questions, or feedback, please contact DNV software support at software.support@dnv.com.
Metadata
Release files for dnv-hydrod 1.0.3rc70
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dnv_hydrod-1.0.3rc70.tar.gz | 61.9 kB | Without provenance | Details for dnv_hydrod-1.0.3rc70.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dnv_hydrod-1.0.3rc70-py3-none-any.whl | Python 3 | none | any | Details for dnv_hydrod-1.0.3rc70-py3-none-any.whl |
Total release size: 127.5 kB
Release files / dnv_hydrod-1.0.3rc70.tar.gz
| Download URL | dnv_hydrod-1.0.3rc70.tar.gz |
|---|---|
| Size | 61.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58b7c8259c68a61150bd4429c96babf5c1edaac291e9b1597c5b25f38cd17f03
|
|
BLAKE2b-256 checksum How to use checksums |
40543de988ee6861dbb5fb2b4896fb0fe8008c5bb7cddfb08c7b2f4a6d82884a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / dnv_hydrod-1.0.3rc70-py3-none-any.whl
| Download URL | dnv_hydrod-1.0.3rc70-py3-none-any.whl |
|---|---|
| Size | 65.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e671c958c9fcf2a8091fb7b0bfbc8df4fa62275265264275f0b04fc199195ae1
|
|
BLAKE2b-256 checksum How to use checksums |
1d5ce4c98c34ecb465a5ca55715e465165802026ec021cca65c43891ab341708
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for dnv-hydrod 1.0.3rc70
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.