Skip to content

Commit

Permalink
Hatch (#15)
Browse files Browse the repository at this point in the history
Switch from Poetry to Hatch
  • Loading branch information
villekr authored Mar 16, 2024
1 parent d6527f3 commit dd9bd26
Show file tree
Hide file tree
Showing 54 changed files with 518 additions and 3,404 deletions.
35 changes: 0 additions & 35 deletions .devcontainer/Dockerfile

This file was deleted.

11 changes: 0 additions & 11 deletions .flake8

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "code quality"
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize

jobs:
build:
name: "Static checks and tests"
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up pip cache
if: runner.os == 'Linux'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install hatch
run: |
python -m pip install hatch
- name: Run format and lint check
run: hatch fmt --check
# - name: Run mypy
# run: hatch run mypy src tests
- name: Run Tests
run: hatch run +py=${{ matrix.python-version }} all:cov
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage*
- name: Build dist
run: hatch build
44 changes: 0 additions & 44 deletions .github/workflows/workflow.yml

This file was deleted.

36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# paita - Python AI Textual Assistant
<img src="https://s3.dualstack.us-east-2.amazonaws.com/pythondotorg-assets/media/files/python-logo-only.svg" height="20"> 🅰 ️ℹ️ <img src="https://textual.textualize.io/images/icons/logo%20light%20transparent.svg" height="20"> 🔧
# Paita - Python AI Textual Assistant
<img src="./imgs/paita.jpg" width="800">

Paita is textual asssistant on your terminal that supports multiple AI Services' Chat Models.
Paita is textual assistant for your terminal that supports multiple AI Services and models.

## Key Features
1. **Supports Multiple AI Services:** paita integrates a variety of AI services through the [LangChain](https://python.langchain.com) library, which means any service compatible with LangChain can be added to paita for use. Currently OpenAI and AWS Bedrock are supported.
2. **Use Your Own AI Model:** You have full control over your AI model deployment and configuration when using Bedrock within paita, ensuring exclusive access and extensive customization of model parameters.
3. **Sophisticated Terminal UI Based on [Textual](https://textual.textualize.io/):** paita uses the Textual framework to provide an advanced user interface right within your terminal, combining the complexity of a GUI with console simplicity.
4. **Easy Installation and Setup:** Installing paita is as simple as running 'pip install paita', followed by configuring your chosen AI service and model according to their specific
5. **Cross-Platform Compatibility:** Compatible with Windows, macOS, and Linux systems across most terminals; if Python runs in your environment and Textual supports it, then so does paita.
1. **Supports Multiple AI Services:** Paita integrates with a variety of AI services through the [LangChain](https://python.langchain.com) library. If AI service is compatible with LangChain then it can be used also with Paita. Currently OpenAI and AWS Bedrock models are supported.
3. **Textual User Interface on your terminal:** Paita is based on [Textual](https://textual.textualize.io/) and provides a sophisticated user interface right within your terminal, combining the complexity of a GUI with console simplicity.
5. **Cross-Platform Compatibility:** Paita is compatible with Windows, macOS, and Linux systems across most terminals; if Python runs in your environment and Textual supports it, then Paita will work.

### Supported AI Services
* OpenAI
* AWS Bedrock (currently only non-streaming mode)
* AWS Bedrock
* (More to come soon...)

## Getting Started

### Prerequisites
- Python 3.8.1+
- Access to AI Service and configured in terminal

### Installation
### Installation and running

Install using pip (or pipx)
```
pip install paita
```

### Running

Configure AI Service(s) to be accessible and run:
Run and enjoy!
```
python -m paita
paita
```

### Configuring AI Service(s) and AI Model access
### Configuring AI Service(s) and model access

#### OpenAI

Expand All @@ -42,8 +42,4 @@ export OPENAI_API_KEY=<OpenAI API Key>

#### AWS Bedrock

AWS Bedrock requires 'aws sso' being configured and profile activated. Also relevant AI models must be enabled and correct region selected.
```
aws sso login --profile <aws-profile>
```

Enable AI model access in AWS Bedrock. Configure aws credential access accordingly.
72 changes: 71 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
@@ -1 +1,71 @@
Hatch - for packaging and publishing https://hatch.pypa.io
# Development instructions

## Required tools
* Hatch - for packaging and publishing https://hatch.pypa.io

## Basic hatch commands

Create (default) environment:
```
hatch env create
```

Activate (default) environment:
```
hatch shell
```

## PyCharm

When opening 'paita' in PyCharm do the following:
* Right click 'src'-folder and select 'Mark Directory as'->'Sources Root'
* Configure virtualenv:
* `hatch env find default`
* Set Python interpreter based on above path

## Other hatch commands

Activate (specific version) environment:
```
hatch -e all.py3.8 shell
```

Run paita application:
```
python -m paita.tui.app
```

Debugging requires textual console on **separate terminal** window/tab:
```
hatch run textual console
```

Run paita application in dev-mode:
```
hatch run textual run src/paita/tui/app.py --dev
```

Run formatter and linter:
```
hatch fmt
```

Run type checker:
```
mypy src tests
```

Run tests for current (default) env
```
hatch run test
```

Run tests for all configured envs
```
hatch run all:test
```

Run test with coverage
```
hatch run cov
```
Binary file added imgs/paita.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[mypy]
check_untyped_defs = True
exclude = ^paita/ai/bedrock.py$
# exclude = ^paita/ai/bedrock.py$

[mypy-desert,marshmallow,nox.*,pytest,pytest_mock,_pytest.*]
ignore_missing_imports = True
4 changes: 0 additions & 4 deletions paita/__main__.py

This file was deleted.

1 change: 0 additions & 1 deletion paita/ai/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion paita/localization/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion paita/tui/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion paita/utils/__init__.py

This file was deleted.

Loading

0 comments on commit dd9bd26

Please sign in to comment.