semvec/pypi-packages huggingface dataset:
arb-launcher 1.1.0
A package to launch and manage detached programs

# arb_launcher

`arb_launcher` is a Python package that provides a simple yet powerful way to launch and manage detached programs and methods. It allows you to run external programs or Python methods in a completely detached process, making them independent of the parent process.

## Features

- Launch external programs and Python methods as detached processes
- Redirect the `stdout` and `stderr` of the detached process to specific files (`/dev/null` by default so that the output is never printed to the console)
- Terminate matching processes based on their names and arguments
- Fully daemonized processes, making them independent of the parent process and allowing them to run in the background

## Installation

To install `arb_launcher`, simply clone the repository and run the following command:

```bash
pip install arb_launcher
```

## Usage

`arb_launcher` provides a simple command-line interface for launching detached programs. You can also use it as a method or library in your Python projects.

### Command-Line Interface

To use the command-line interface, simply run:

```bash
arb_launcher <program> [args] [--stdout <stdout_file>] [--stderr <stderr_file>]
```

### Simplified Launch Method

The `arb_launcher` package also provides a simplified method, `launch_detached`, for quickly launching detached programs or methods:

```python
from arb_launcher.launcher import launch_detached

launch_detached(target, args, stdout=None, stderr=None)
```

`target` can be either a string representing the command or a callable Python method.

`args` should be a list of arguments, if any.

`stdout` and `stderr` are optional parameters to redirect the output to specific files.

#### Example

Here's an example of how to use the simplified `launch_detached` method to launch a detached Python method:

```python
from arb_launcher.launcher import launch_detached

def my_method(arg1, arg2):
    # Your code here

launch_detached(my_method, args=['arg1', 'arg2'], stdout='output.log', stderr='error.log')
```

### Python API

To use the `arb_launcher` package in your Python project, first import the `ProgramHandler` class:

```python
from arb_launcher.program_handler import ProgramHandler
```

Then, create a `ProgramHandler` object and call the `launch()` method:

```python
handler = ProgramHandler(target, args, stdout, stderr)
handler.launch()
```

`target` can be either a string representing the command or a callable Python method.

`args` should be a list of arguments, if any.

`stdout` and `stderr` are optional parameters to redirect the output to specific files.

#### Example

Here's an example of how to use the `arb_launcher` package to launch a detached Python method:

```python
from arb_launcher.program_handler import ProgramHandler

def my_method(arg1, arg2):
    # Your code here

handler = ProgramHandler(my_method, args=['arg1', 'arg2'], stdout='output.log', stderr='error.log')
handler.launch()
```
bns-utils 0.0.5
Some utilities for BNS internal use
Requires Python: >=3.7

# BNS UTILS

Documentation goes here.

## Data Module

### IP21
The IP21 class provides a Python interface for interacting with an IP.21 historian database. It uses the pyodbc and pandas libraries to connect to the database and execute SQL queries.

#### Initialization

To use the IP21 Python Interface, you first need to initialize an instance of the IP21 class. The IP21 constructor takes the following arguments:

- host: The IP address or hostname of the IP21 server
- port: The port number to use when connecting to the IP21 server
- ads: The name of the IP21 Advanced Data Server (ADS) to connect to (default: MINPRO)

```python
from bns_utils.data import IP21

# Create an IP21 object to connect to the historian database
ip21 = IP21(host="127.0.0.1", port=1234, ads="MINPRO")
```

#### Retrieving Tag Names and Definitions
The tag_dump method can be used to retrieve a list of all IP.21 tags and their descriptions from the historian database. By default, this method saves the list to a CSV file named tag_dump.csv, but this behavior can be disabled by passing write_csv=False. For example:
```python
# Retrieve a list of all tags and save it to a CSV file
ip21.tag_dump()

# Retrieve a list of all tags without saving it to a CSV file
tag_list = ip21.tag_dump(write_csv=False)
```

#### Retrieving Tag Data
You can retrieve historical data for a list of tags using the tag_data method. This method takes the following arguments:

- tag_list: A list of tag names to retrieve data for
- start: The start time for the data in the format "DD-Mon-YY HH:MM:SS"
- end: The end time for the data in the format "DD-Mon-YY HH:MM:SS"
- freq: The interval to retrieve data at in the format "HH:MM:SS"
- separate: A boolean indicating whether to save the data for each tag separately (default: True)
- file_type: The file format to use when saving the data (either ftr or csv, default: ftr)

Here is an example of how to retrieve data for a single tag:

```python
ip21.tag_data(tag_list=["MyTag"], start="01-Jan-23 00:00:00", end="02-Jan-23 00:00:00", freq="00:01:00")
```

This will retrieve data for the tag "MyTag" between January 1st, 2023 and January 2nd, 2023, at one minute intervals. The data will be saved to a file named MyTag.ftr in Feather format by default.

If you want to retrieve data for multiple tags, simply pass a list of tag names to the tag_list argument:

```python
ip21.tag_data(tag_list=["Tag1", "Tag2", "Tag3"], start="01-Jan-23 00:00:00", end="02-Jan-23 00:00:00", freq="00:01:00")
```

This will retrieve data for the tags "Tag1", "Tag2", and "Tag3" between January 1st, 2023 and January 2nd, 2023, at one minute intervals. The data for each tag will be saved to separate files by default.