semvec/pypi-packages huggingface dataset:
xontrib-openai 0.1.0
Use Open AI models in xonsh shell.
License: MIT
Requires Python: >=3.8
Keywords: xontrib,xonsh

<p align="center">
Use Open AI models in xonsh shell.
</p>

<p align="center">  
If you like the idea click ⭐ on the repo and <a href="https://twitter.com/intent/tweet?text=Nice%20xontrib%20for%20the%20xonsh%20shell!&url=https://github.com/anki-code/xontrib-openai" target="_blank">tweet</a>.
</p>


## Installation

To install use pip:

```xsh
xpip install -U xontrib-openai
# or: xpip install -U git+https://github.com/anki-code/xontrib-openai
```

## Usage

```python
$OPENAI_API_KEY = 'abcd1234'  # https://platform.openai.com/account/api-keys

# Defaults:
# $OPENAI_MODEL = 'text-davinci-003'  # https://platform.openai.com/docs/models/overview
# $OPENAI_MAX_TOKENS = 500

xontrib load openai

ai! hello
# Hello! How are you?
```
In case you need addon with new model:
```python
aliases['ai4'] = "$OPENAI_MODEL='gpt-4' $OPENAI_MAX_TOKENS=1000 @('ai')"

ai4! hello gpt-4
# Hello human
```

### Get shell commands
```python
ai! how to git commit. Give me only command
# git commit -m "Commit message"
```
```python
ai! how to remove all containers and images in docker. Only commands please
# docker stop $(docker ps -a -q)
# docker rm $(docker ps -a -q)
# docker rmi $(docker images -a -q)
```

### Get Python code
```python
ai! send post request with json data on python
# import requests
# import json
# 
# url = 'http://example.com/api/1/users'
# data = {
#   "first_name": "John",
#   "last_name": "Smith"
# }
# 
# headers = {'Content-type': 'application/json'}
# response = requests.post(url, data=json.dumps(data), headers=headers)
```

### Generate data
```python
ai! give me json where keys are fruits and values are most common fruit color
# {
#     "Apple": "Red",
#     "Banana": "Yellow",
#     "Orange": "Orange",
#     "Grape": "Purple",
#     "Strawberry": "Red",
#     "Lemon": "Yellow",
#     "Kiwi": "Green",
#     "Cherry": "Red",
#     "Watermelon": "Green"
# }
```
Using the data:
```python
import json
j = json.loads($(ai give me small json))
j
# {'name': 'John', 'age': 25}
```

## Known issues

To use [`gpt-4`](https://platform.openai.com/docs/models/gpt-4) model join [wait list](https://openai.com/waitlist/gpt-4-api).

## Credits

This package was created with [xontrib template](https://github.com/xonsh/xontrib-template).
pyunycode 0.1.1
Punycode Converter Library for Python
License: MIT
Keywords: Punycode Converter Python

# pyunycode

**Punycode Converter Library for Python**

You can convert Punycode domain to/from Unicode domain with only one function: `pyunycode.convert`.

## How to use

### Install

```sh
pip install pyunycode
```

### Code sample

```python
import pyunycode

# Convert Unicode domain to Punycode domain
str1 = "美しい.世界"
str2 = "こっち.みんな"
str3 = "日本語.jp"
print(f"{str1} -> {pyunycode.convert(str1)}")
print(f"{str2} -> {pyunycode.convert(str2)}")
print(f"{str3} -> {pyunycode.convert(str3)}")

# 僕だけの.世界 -> xn--08j3a5b142t.xn--rhqv96g
# こっち.みんな -> xn--l8j9flb8a.xn--q9jyb4c
# 日本語.jp -> xn--wgv71a119e.jp

# Punycode domain to Unicode domain
str4 = "xn--n8jub8754b.xn--rhqv96g"
str5 = "xn--28j2af.xn--q9jyb4c"
str6 = "xn--wgv71a119e.jp"
print(f"{str4} -> {pyunycode.convert(str4)}")
print(f"{str5} -> {pyunycode.convert(str5)}")
print(f"{str6} -> {pyunycode.convert(str6)}")

# xn--n8jub8754b.xn--rhqv96g -> 美しい.世界
# xn--28j2af.xn--q9jyb4c -> こっち.みんな
# xn--wgv71a119e.jp -> 日本語.jp
```