semvec/pypi-packages huggingface dataset:
queue-pipelines 0.1.4
Declarative orchestration of asynchronous queue-based tasks
Requires Python: >=3.10

# Queue Pipelines

> Declarative orchestration of asynchronous queue-based tasks

## Usage

### 1. State-machine specification

```python
from q.pipelines import Tasks, Task

# Input types for tasks
class Image:
  img: str

class Annotated(Image):
  annotation: str

# State machine declaration
# Task(INPUT_TYPES, *NEXT_TASK_IDs)
# Tasks({ taskID -> Task })
# 'output' is a special task ID
TASKS = Tasks(
  input_task='classify', Output=Result,
  tasks=(
    classify=Task(Image, 'annotate_digit', 'annotate_word'),
    annotate_digit=Task(Image, 'output'),
    annotate_work=Task(Image, 'output'),
  )
)
```

### 2. Generate code

```python
def codegen():
  TASKS.codegen(__file__, 'TASKS')
  # generated/
  #   types.py
  #   local.py
  #   __init__.py
  TASKS.codegen_pipelines(__file__)
  # pipelines/
  #   _classify.py
  #   _annotate_digit.py
  #   _annotate_word.py
  #   __init__.py
```

### 3. Pipelines implementation

Generated code:

```python
# pipelines/_classify.py
from ..generated import Classify

def classify(Qin: Classify.QueueIn, Qout: Classify.QueueOut):
  ...
```

E.g. implementation:

```python
# pipelines/_classify.py
from fastapi import FastAPI
import uvicorn
from ..generated import Classify

def classify(Qin: Classify.QueueIn, Qout: Classify.QueueOut):
  app = FastAPI()
  @app.get('/tasks')
  async def tasks():
    return await Qin.items()

  @app.post('/annotate')
  async def annotate(annotation: Literal['digit', 'word']):
    id, task = await Qin.read()
    if annotation == 'digit':
      next = Classify.next('digit', task)
    else:
      next = Classify.next('word', task)
    await Qout.push(id, next)
    await Qin.pop(id)

  uvicorn.run(app)
    
```

### 4. Run!

```python
from mypkg.pipelines import PIPELINES
from mypkg.generated import run, input_queue, output_queue, queues

def main(input_path: str, output_path: str, queues_path: str):
  Qin = input_queue(queues_path)
  Qout = output_queue(queues_path)
  Qs = queues(queues_path)
  run(Qin, Qout, Qs, **PIPELINES)
```

- Each of the pipelines runs on a separate process
- An extra "connect" process polls from all queues and dispatches to the appropriate next queues/output
SpiderBox 0.0.1
Package For Crawler
Requires Python: >=3.6

自己玩爬虫有一段时间了，
在制作爬虫的过程中
发现很多好用的三方库，
也发现很多繁琐，复杂的代码编写。
为了方便爬虫er们，
笔者在此对这些操作进行合并与精简，
希望借此能为各位扫清一些前行道路上的障碍，
故甘为献丑，分享这些微不足道的东西，
如各位能看得上，无妨点上一个star。
提此，共勉！
streamlit-custom-sidebar-test 0.0.2
Streamlit component that allows you to do create a more flexible customisable streamlit sidebar
Requires Python: >=3.7

# streamlit-custom-sidebar

Streamlit component that allows you to do buid a more flexible customizable sidebar that does not look buggy when rendered. Usually when we try to adjust the native streamlit sidebar it gets rendered after all the streamlit default settings are rendered. With this, your default settings are rendered when the page loads but it still uses streamlit's sidebar mative settings - css like its open and close animation and buttons.  

Dependencies:
Uses other custom components I created:
- [local storage](https://pypi.org/project/streamlit-local-storage/)
- [browser session storage](https://pypi.org/project/streamlit-browser-session-storage/)
- [streamlit-extras](https://pypi.org/project/streamlit-extras/)


## Installation instructions

```sh
pip install streamlit-custom-sidebar
```

```
# Pre-requisites

create `.streamlit/config.toml` directory where the main app.py file is located

in there, input 
[ui]
hideSidebarNav=true

or 

start streamlit app with 
`streamlit run app.py --ui.hideSidebarNav=true`
```

## Usage instructions

```python
import streamlit as st
from streamlit_custom_sidebar import CustomSidebarDefault
import streamlit_float # recommended

# Note - on the page's first load - when user comes in from the url rather than clicking on the tab, the active page will be derived from the url or from the `loadPageName` parameter. Please make sure all params in the data array object are inputed.

st.set_page_config(layout="wide")

streamlit_float.float_init(theme=False, include_unstable_primary=False)

# iconLib (key,variable in the data list of dicts - its required) -> "Remix", "Tabler", "Google"
data_ = [
            {"index":0, "label":"Example", "page":"example", "href":"http://localhost:8501/"},
            {"index":1, "label":"Page", "page":"page", "iconLib":"Google", "icon":"settings", "href":"http://localhost:8501/page"}
        ]

if "currentPage" not in st.session_state: # required as component will be looking for this in session state to change page via `switch_page`
    st.session_state["currentPage"] = data_[0] 
else:
    st.session_state["currentPage"] = data_[0] 


with st.container():
    defaultSidebar = CustomSidebarDefault(closeNavOnLoad=False, backgroundColor="brown", loadPageName="example", data=data_, LocalOrSessionStorage=1, serverRendering=False, webMedium="local") 
    defaultSidebar.load_custom_sidebar()
    defaultSidebar.change_page()
    
    streamlit_float.float_parent(css="position:fixed; top:-1000px;") # gets rid of the whitespace created from the iframes used to build the component - no big forehead.

# The above must be rendered atop every streamlit page

```