
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
The official Python library for Nortech AI.
The nortech-python
library is the official Python client for interacting with the Nortech AI platform. It provides a comprehensive interface to access and manage various components of the Nortech ecosystem, including metadata, data tools, and derivers.
The Nortech
class serves as the primary entry point for the library. It encapsulates the core functionalities and provides a unified interface to interact with the Nortech API. It has 3 main components:
The Nortech
class is designed to be flexible, allowing customization of API settings such as the base URL, API key, pagination behavior, and user agent. This makes it easy to integrate the library into various environments and workflows.
This package relies heavily in the following packages, and it is recommended that users have basic knowledge of them:
You can install using pip:
pip install nortech
Or if you are using poetry:
poetry add nortech
Or if you are using UV:
uv add nortech
Setup your environment variables with your NortechAPI Key:
export NORTECH_API_KEY="<NORTECH_API_KEY>"
Alternatively you can create a .env
file in the root directory of your project with the content:
NORTECH_API_KEY="<NORTECH_API_KEY>"
The Nortech
class can also recieve all configurations during initialization.
This feature is implemented like in the API. By default it is disabled. To enable it add the following line to your config:
NORTECH_API_IGNORE_PAGINATION=False
Listing functions, mostly present in the nortech.metadata
section, have an optional PaginationOptions
input object.
This object has 4 fields:
These functions return a PaginatedResponse
object containing 3 functions:
PaginationOptions
to fetch the next page.PaginatedResponse
also has a next_pagination_options
method that returns a PaginationOptions
, which can also be used to fetch the next page.
To get a DataFrame with the requested signals:
Signal Search
interface.DataTools
exported columns and copy the resulting search_json
.signals
field and speficy a TimeWindow
as in the examples bellow.In order to get a pandas DataFrame use the get_df
handler:
from datetime import datetime
from nortech import Nortech
from nortech.core.values.signal import SignalInput, SignalInputDict
from nortech.datatools.values.windowing import TimeWindow
# Initialize the Nortech client
nortech = Nortech()
# Define signals to download
signal1: SignalInputDict = {
"workspace": "workspace1",
"asset": "asset1",
"division": "division1",
"unit": "unit1",
"signal": "signal1",
}
signal2 = 789 # Signal ID
signal3 = SignalInput(workspace="workspace2", asset="asset2", division="division2", unit="unit2", signal="signal2")
# Define the time window for data download
my_time_window = TimeWindow(start=datetime(2023, 1, 1), end=datetime(2023, 1, 31))
# Call the get_df function
df = nortech.datatools.pandas.get_df(
signals=[signal1, signal2, signal3],
time_window=my_time_window,
)
print(df.columns)
# Output
# [
# 'timestamp',
# 'workspace_1/asset_1/division_1/unit_1/signal_1',
# 'workspace_1/asset_1/division_1/unit_1/signal_2',
# 'workspace_2/asset_2/division_2/unit_2/signal_3'
# ]
In order to get a polars DataFrame use the get_df
:
from datetime import datetime
from nortech import Nortech
from nortech.core.values.signal import SignalInput, SignalInputDict
from nortech.datatools.values.windowing import TimeWindow
# Initialize the Nortech client
nortech = Nortech()
# Define signals to download
signal1: SignalInputDict = {
"workspace": "workspace1",
"asset": "asset1",
"division": "division1",
"unit": "unit1",
"signal": "signal1",
}
signal2 = 789 # Signal ID
signal3 = SignalInput(workspace="workspace2", asset="asset2", division="division2", unit="unit2", signal="signal2")
# Define the time window for data download
my_time_window = TimeWindow(start=datetime(2023, 1, 1), end=datetime(2023, 1, 31))
# Call the get_df function
polars_df = nortech.datatools.polars.get_df(
signals=[signal1, signal2, signal3],
time_window=my_time_window,
)
print(polars_df.columns)
# Output:
# [
# 'timestamp',
# 'workspace_1/asset_1/division_1/unit_1/signal_1',
# 'workspace_1/asset_1/division_1/unit_1/signal_2',
# 'workspace_2/asset_2/division_2/unit_2/signal_3'
# ]
In order to get a polars LazyFrame use the get_lazy_df
:
from datetime import datetime
from nortech import Nortech
from nortech.core.values.signal import SignalInput, SignalInputDict
from nortech.datatools.values.windowing import TimeWindow
# Initialize the Nortech client
nortech = Nortech()
# Define signals to download
signal1: SignalInputDict = {
"workspace": "workspace1",
"asset": "asset1",
"division": "division1",
"unit": "unit1",
"signal": "signal1",
}
signal2 = 789 # Signal ID
signal3 = SignalInput(workspace="workspace2", asset="asset2", division="division2", unit="unit2", signal="signal2")
# Define the time window for data download
my_time_window = TimeWindow(start=datetime(2023, 1, 1), end=datetime(2023, 1, 31))
# Call the get_lazy_df function
lazy_polars_df = nortech.datatools.polars.get_lazy_df(
signals=[signal1, signal2, signal3],
time_window=my_time_window,
)
print(lazy_polars_df.columns)
# Output:
# [
# 'timestamp',
# 'workspace_1/asset_1/division_1/unit_1/signal_1',
# 'workspace_1/asset_1/division_1/unit_1/signal_2',
# 'workspace_2/asset_2/division_2/unit_2/signal_3'
# ]
FAQs
The official Python library for Nortech AI
We found that nortech demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.