Skip to main content

.NET Runtime: Integrating .NET with Python

This package is an indispensable resource for those planning to create console-based applications utilizing .NET assemblies from Python. It offers the .NET Runtime (Version 8.0.4), which works with the .NET Common Language Runtime (CLR) using the Python.NET package. With this integration, developers can concentrate on their development tasks without worrying about compatibility issues, allowing them to create smooth and efficient applications. This package is a valuable tool for creating high-quality console-based applications using .NET assemblies and Python.

Usage/Examples

# Python script to filter and print even numbers from a .NET List

# Ensure to import 'dnv.net.runtime' before any other import statements
import dnv.net.runtime
import clr

# Add references to required .NET assemblies
clr.AddReference("System")
clr.AddReference("System.Core")
clr.AddReference("System.Collections")

from System import Action, Array, Predicate
from System.Collections.Generic import List
from System.Linq import Enumerable

# Create a .NET Array of integers from 1 to 10
numbers = Array[int]([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])

# Convert the array to a .NET List
listOfNumbers = List[int](numbers)

# Define a Predicate that checks if a number is even
predicate = Predicate[int](lambda x: x % 2 == 0)

# Use the FindAll method of the List to filter out the even numbers based on the Predicate
evenNumbers: List[int] = listOfNumbers.FindAll(predicate)

# Define an Action that prints a number
action = Action[int](lambda x: print(x))

# Use the ForEach method of the List to print each even number
evenNumbers.ForEach(action)
# Web Scraping Bing Search Results with Python and .NET HttpClient

# Ensure to import 'dnv.net.runtime' before any other import statements
import dnv.net.runtime
import clr
import re

# Add references to required .NET assemblies
clr.AddReference("System.Net.Http")

from System.Net.Http import HttpClient

# Create an HttpClient instance
client = HttpClient()

# Specify the URL
url = "https://www.bing.com/search?q=DNV"

# Send the GET request
response = client.GetAsync(url).Result

# Ensure the request was successful
response.EnsureSuccessStatusCode()

# Read the response content as a string
responseBody = response.Content.ReadAsStringAsync().Result

# Define a regular expression to extract the titles and URLs of the search results
regex = r'<h2.*?><a href="(.*?)" h=".*?">(.*?)</a></h2>'

# Find all matches of the regular expression in the response body
matches = re.findall(regex, responseBody)

# Print the titles and URLs of the search results
for match in matches:
    url, title = match
    print(f'Title: {title}')
    print(f'URL: {url}')
    print()

License

MIT

Support

If you encounter any issues, have questions, or want to provide feedback, please get in touch with our support team at software.support@dnv.com.

Metadata

Release files for dnv-net-runtime 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for dnv-net-runtime 1.0.0
File Interpreter ABI Platform Actions
dnv_net_runtime-1.0.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for dnv_net_runtime-1.0.0-py3-none-win_amd64.whl
dnv_net_runtime-1.0.0-py3-none-manylinux1_x86_64.whl Python 3 none Linux glibc 2.5+ x86-64 Details for dnv_net_runtime-1.0.0-py3-none-manylinux1_x86_64.whl

Total release size: 64.4 MB

Release files / dnv_net_runtime-1.0.0-py3-none-win_amd64.whl

Download URL dnv_net_runtime-1.0.0-py3-none-win_amd64.whl
Size 33.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
f3a0b5b601b34902fa4e76b272c41d2df5da910ace266ae098a137fa1fdd5149
BLAKE2b-256 checksum
How to use checksums
a0248f885fbb271a0a4f2bb670d6f4465ed41e2190ab59ba91964fe5753fc96a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.13

Release files / dnv_net_runtime-1.0.0-py3-none-manylinux1_x86_64.whl

Download URL dnv_net_runtime-1.0.0-py3-none-manylinux1_x86_64.whl
Size 31.3 MB
Tags Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
86d2c4079143d1aba77d8f57be5f89d3f43daddde3fceace40a48dee227bcbd2
BLAKE2b-256 checksum
How to use checksums
69dfb388999ffa83bc3f795f6c7e31afdd9e450d92f954ecbf38449a883df8f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.13

Security for dnv-net-runtime 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page