semvec/pypi-packages huggingface dataset:
haystack-client 0.2.4
Haystack Python OpenTracing Implementation
Requires Python: >=3.5
Keywords: opentracing,haystack,tracing,microservices,distributed

[![Build Status](https://travis-ci.org/ExpediaDotCom/haystack-client-python.svg?branch=master)](https://travis-ci.org/ExpediaDotCom/haystack-client-python)
[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://github.com/ExpediaDotCom/haystack/blob/master/LICENSE)

# Haystack bindings for Python OpenTracing API
This is Haystack's client library for Python that implements [OpenTracing](https://github.com/opentracing/opentracing-python/)

Further information can be found on [opentracing.io](https://opentracing.io/) 

## Using this library
See examples in /examples directory. See opentracing [usage](https://github.com/opentracing/opentracing-python/#usage) for additional information.

It is important to consider the architecture of the application. In order for the tracer to manage spans properly, an appropriate `ScopeManager` implementation must be chosen.  In most environments, the default `ThreadLocalScopeManager` will work just fine. In asynchronous frameworks, the `ContextVarsScopeManager` is a better choice.  

First initialize the tracer at the application level by supplying a service name and span recorder
```python
import opentracing
from haystack import HaystackAgentRecorder
from haystack import HaystackTracer

tracer = HaystackTracer("a_service", HaystackAgentRecorder())
opentracing.set_global_tracer(tracer)
```

Starting a span can be done as a managed resource using `start_active_span()`
```python
with opentracing.tracer.start_active_span("span-name") as scope:
    do_stuff()
```

or finish the span on your own terms with
```python
span = opentracing.tracer.start_span("span-name")
do_stuff()
span.finish()
```

Note: **If there is a Scope, it will act as the parent to any newly started Span** unless the programmer passes 
`ignore_active_span=True` at `start_span()/start_active_span()` time or specified parent context explicitly using 
`childOf=parent_context`

#### Custom propagation headers
If necessary, default propagation headers can be replaced with custom ones by specifying custom propagator options. Register the new propagator with the tracer once configured. 
```python
prop_opts = PropagatorOpts("X-Trace-ID", "X-Span-ID", "X-Parent-Span", "X-baggage-")
opentracing.tracer.register_propagator(opentracing.Format.HTTP_HEADERS, TextPropagator(prop_opts))
```

#### Logging
All modules define their logger via `logging.getLogger(__name__)`

So in order to define specific logging format or level for this library use `getLogger('haystack')` or configure the
root logger.

## How to configure build environment
Create a python3 virtual environment, activate it and then `make bootstrap`

## Running the example code
`make example`

## How to Release this library
Create a new release in github specifying a semver compliant tag greater than the current release version.
cste-helloworld 0.0.1
Say hello cste!

# Hello World CSTE

This is an example project demonstrating how to publish a python module to PyPI.

## Installation

Run the following to install:

```python
pip install cste-helloworld
```

## Usage

```python
from cstehelloworld import say_hello

# Generate "Hello, World CSTE!"
say_hello()

# Generate "Hello, Antony CSTE!"
say_hello("Antony")
```

## Tests

This is for installing all necesary packeges for testing
```python
pip3 install -e .[dev]
pip install -e .\[dev\]
```
py-easyDL 0.0.9
easyDL - Where Deep learning is meant to be easy.
Requires Python: >=3.6

# EasyDL
EasyDL - Where Deep learning is meant to be easy.

## Installation
Run the following to install:
```python
pip install py-easyDL
```
## Usage
EasyDL uses the same methodology as Google's Tensorflow v2.x. 
Here are some imports from our package.
```python
import easyDL
from easyDL.preprocessing.image import load_single_image,\
    load_images_from_directory, load_images_from_classes_directory
from easyDL.preprocessing.csv import load_csv
from easyDL.preprocessing.datasets import mnist, cifar10, cifar100
from easyDL.preprocessing.utils import shuffle, normalize
from easyDL.models import Model, load_model
from easyDL.activations import Tanh, Softmax, Sigmoid, ReLU, LeakyReLU, Step, Identity
from easyDL.layers import Dense, MaxPooling2D, Conv2D, Flatten, Dropout, BatchNorm
from easyDL.optimizers import GradientDescent, Adam, RMSProp, AdaGrad, MomentumGD, NesterovGD
from easyDL.visualization import plot_losses, plot_accuracy
from easyDL.losses import BinaryCrossEntropy, CategoricalCrossEntropy, \
    SparseCategoricalCrossEntropy, MeanSquaredError
from easyDL.evaluation import plot_evaluation_matrix, plot_confusion_matrix
```
This is an example using our package.
```python
# Preprocessing
(X_train, Y_train), (X_test, Y_test) = mnist.load_data()
X_train = normalize(X_train[:4000])
Y_train = Y_train[:4000]

X_test = normalize(X_test[:1000])
Y_test = Y_test[:1000]

# Create a model
model = Model()

# Adding layers
model.add(Conv2D(6, kernel_size= (5, 5), input_shape= X_train.shape[1:]))
model.add(BatchNorm())
model.add(ReLU())
model.add(MaxPooling2D())

model.add(Conv2D(16, kernel_size= (5, 5)))
model.add(BatchNorm())
model.add(ReLU())
model.add(MaxPooling2D())

model.add(Flatten())

model.add(Dense(120))
model.add(BatchNorm())
model.add(ReLU())

model.add(Dense(84))
model.add(BatchNorm())
model.add(ReLU())

model.add(Dense(10))
model.add(Softmax())

# Compiling the model
model.compile(loss= 'sparse_categorical_crossentropy', optimizer= Adam(lr= 0.01))

# Training the model
model.fit(X_train, Y_train, validation_data= (X_test, Y_test),
            epochs= 10, batch_size= 64, verbose= True)

# Plotting losses and accuracies
plot_losses(model)
plot_accuracy(model)

# Predicting labels using the model
predictions = model.predict(X_test)

# Plotting confusion matrix
plot_confusion_matrix(Y_test, predictions)

# Printing evaluation matrix
plot_evaluation_matrix(Y_test, predictions)

# Save the model into a .pkl file
model.save('PATH/TO/FILE.pkl')

# Load a saved .pkl model
model = load_model('PATH/TO/FILE.pkl')
```
django-async-stream 0.3
Django extension that allow using asynchronous generators in StreamingHttpResponse
Requires Python: >=3.7
Keywords: django, async, stream, streamhttp, streaminghttp, StreamingHttpResponse, ASGI, AsyncStreamingHttpResponse

# Django-Async-Stream 

Django extension that allow using asynchronous generators in StreamingHttpResponse


## Usage

django-async-stream provides `AsyncStreamingHttpResponse` class, that you can use instead of `StreamingHttpResponse`

**But** for this to work, you need to override one method in the ASGIHandler.


`asgi.py`, one of the possible options
```python
# django default file content
import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'projectname.settings')

application = get_asgi_application()

#  PATCH BELOW
import django_async_stream
django_async_stream.patch_application(application)

```

`views.py`
```python
import asyncio

from django_async_stream import AsyncStreamingHttpResponse


async def my_view(request):
    return AsyncStreamingHttpResponse(_my_async_generator())


async def _my_async_generator():
    for i in range(10):
        yield i
        await asyncio.sleep(2)

```

## Installation

 `pip install django-async-stream`