Skip to content

Commit 547a9e0

Browse files
committed
chore: some improvements
1 parent f49e5c8 commit 547a9e0

7 files changed

Lines changed: 180 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, dev ]
6+
pull_request:
7+
branches: [ main, dev ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
python-version: ['3.12']
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -e .
30+
pip install pytest pytest-cov pytest-xdist
31+
32+
- name: Run unit tests
33+
run: |
34+
pytest tests/test_character.py tests/test_memory.py tests/test_system.py -v
35+
36+
- name: Upload coverage reports
37+
uses: codecov/codecov-action@v3
38+
if: matrix.os == 'ubuntu-latest'
39+
with:
40+
file: ./coverage.xml
41+
flags: unittests
42+
name: codecov-umbrella
43+
44+
lint:
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v4
52+
with:
53+
python-version: '3.12'
54+
55+
- name: Install linting tools
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install black flake8 mypy
59+
60+
- name: Check code formatting with black
61+
run: black --check personaflow tests
62+
63+
- name: Lint with flake8
64+
run: |
65+
# Stop the build if there are Python syntax errors or undefined names
66+
flake8 personaflow --count --select=E9,F63,F7,F82 --show-source --statistics
67+
# Exit-zero treats all errors as warnings
68+
flake8 personaflow --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
69+
70+
- name: Type check with mypy
71+
run: mypy personaflow --ignore-missing-imports
72+
continue-on-error: true
73+

.gitignore

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,53 @@
1+
# Python
2+
*.py[cod]
3+
*$py.class
4+
*.so
5+
.Python
6+
7+
# Virtual environments
18
.venv/
9+
venv/
10+
ENV/
11+
env/
12+
13+
# Testing
214
.pytest_cache/
3-
personaflow.egg-info/
15+
.coverage
16+
htmlcov/
17+
.tox/
18+
.nox/
19+
20+
# Build artifacts
21+
build/
22+
dist/
23+
*.egg-info/
24+
*.egg
25+
.eggs/
26+
27+
# IDEs
28+
.vscode/
29+
.idea/
30+
*.swp
31+
*.swo
32+
*~
33+
34+
# Project specific
435
model_offload/
536
__pycache__/
6-
.mypy_cache
37+
.mypy_cache/
38+
.ruff_cache/
739

40+
# Nix
841
.devenv*
942
devenv.local.nix
10-
11-
# direnv
1243
.direnv
1344

14-
# pre-commit
45+
# OS
46+
.DS_Store
47+
Thumbs.db
48+
49+
# Logs
50+
*.log
51+
52+
# Pre-commit
1553
# .pre-commit-config.yaml

MANIFEST.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Include the license and readme
2+
include LICENSE
3+
include README.md
4+
5+
# Include requirements
6+
include requirements.txt
7+
8+
# Include test configuration
9+
include pytest.ini
10+
11+
# Exclude unnecessary files
12+
exclude .gitignore
13+
exclude .envrc
14+
recursive-exclude * __pycache__
15+
recursive-exclude * *.py[co]
16+
recursive-exclude tests *
17+
recursive-exclude .github *
18+
-16.3 KB
Binary file not shown.

dist/personaflow-0.1.0.tar.gz

-17.3 KB
Binary file not shown.

pytest.ini

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[pytest]
2+
# Test discovery
3+
testpaths = tests
4+
python_files = test_*.py
5+
python_classes = Test*
6+
python_functions = test_*
7+
8+
# Output options
9+
addopts =
10+
-v
11+
--strict-markers
12+
--tb=short
13+
--cov=personaflow
14+
--cov-report=term-missing
15+
--cov-report=html
16+
17+
# Markers
18+
markers =
19+
slow: marks tests as slow (deselect with '-m "not slow"')
20+
integration: marks tests as integration tests
21+
unit: marks tests as unit tests
22+
23+
# Coverage options
24+
[coverage:run]
25+
source = personaflow
26+
omit =
27+
*/tests/*
28+
*/test_*.py
29+
*/__pycache__/*
30+
31+
[coverage:report]
32+
exclude_lines =
33+
pragma: no cover
34+
def __repr__
35+
raise AssertionError
36+
raise NotImplementedError
37+
if __name__ == .__main__.:
38+
if TYPE_CHECKING:
39+
@abstractmethod
40+

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from setuptools import setup, find_packages # type: ignore
2+
from pathlib import Path
23

34
# Core requirements
45
REQUIREMENTS = [
@@ -8,6 +9,10 @@
89
"typing-extensions",
910
]
1011

12+
# Read long description from README
13+
this_directory = Path(__file__).parent
14+
long_description = (this_directory / "README.md").read_text(encoding="utf-8")
15+
1116
setup(
1217
name="personaflow",
1318
version="0.1.2",
@@ -16,7 +21,7 @@
1621
author="Zhiyong (Justin) He",
1722
author_email="justin.he814@gmail.com",
1823
description="A lightweight Python library for managing dynamic multi-persona interactions with LLMs.",
19-
long_description=open("README.md").read(),
24+
long_description=long_description,
2025
long_description_content_type="text/markdown",
2126
url="https://github.com/Ate329/PersonaFlow",
2227
classifiers=[

0 commit comments

Comments
 (0)