Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b47d3c2
initialize the repo and add two functions
HelenZhutt Nov 3, 2025
2e48b36
Set up project dirs and wrote compliment function
Nov 3, 2025
9766d4a
Merge pull request #1 from swe-students-fall2025/Adding-line-function
danielleesignup Nov 3, 2025
db5772a
Merge branch 'pipfile-experiment' into compliment-function
Nov 3, 2025
3d15746
Integrated compliment function to existing file structure
Nov 3, 2025
95332c6
Merge pull request #2 from swe-students-fall2025/compliment-function
danielleesignup Nov 3, 2025
7f2178c
added search function and test
mlv8821-beep Nov 3, 2025
d06baa8
Units tests + rater
SamMurshed Nov 4, 2025
d5a19af
update ci.yml
SamMurshed Nov 4, 2025
f024794
Try 3
SamMurshed Nov 4, 2025
dddccaa
Update api.py
jjl9930 Nov 5, 2025
4ce8d09
Delete pyflirt directory
jjl9930 Nov 5, 2025
c144822
Update __init__.py
jjl9930 Nov 5, 2025
87fffc6
Update test_pyflirt.py
jjl9930 Nov 5, 2025
c15ec59
Update ci.yml
jjl9930 Nov 5, 2025
b5341f9
Add more functions, tests and the demo to run all the functions
HelenZhutt Nov 5, 2025
c293267
Merge pull request #10 from swe-students-fall2025/Add-Readme
HelenZhutt Nov 5, 2025
9bbde50
Merge branch 'pipfile-experiment' into Samm-Try2
HelenZhutt Nov 5, 2025
cd7a697
Merge pull request #7 from swe-students-fall2025/Samm-Try2
HelenZhutt Nov 5, 2025
111b6d0
Merge branch 'pipfile-experiment' into pipfile-experiment
HelenZhutt Nov 5, 2025
25005cf
Merge pull request #9 from jjl9930/pipfile-experiment
HelenZhutt Nov 5, 2025
3820438
Merge branch 'pipfile-experiment' into add_search
HelenZhutt Nov 5, 2025
9288065
Merge pull request #4 from swe-students-fall2025/add_search
HelenZhutt Nov 5, 2025
7bac3e2
Fix error appear due to late merge of pr
HelenZhutt Nov 5, 2025
d683e5b
Merge pull request #11 from swe-students-fall2025/Fix-merge-conflict
HelenZhutt Nov 5, 2025
c103aaa
Add at least three test for each function
HelenZhutt Nov 5, 2025
d8444d6
Fix init to make the test run
HelenZhutt Nov 5, 2025
da59e8f
Merge pull request #12 from swe-students-fall2025/Add-at-least-three-…
HelenZhutt Nov 5, 2025
592fe0f
Update the demo of running all functions
HelenZhutt Nov 5, 2025
3e035ee
Merge pull request #13 from swe-students-fall2025/update-running-demo
HelenZhutt Nov 5, 2025
6fa8008
upload links and fix ci yaml
HelenZhutt Nov 5, 2025
ffd4d4d
Merge pull request #14 from swe-students-fall2025/upload-links-fix-ci…
HelenZhutt Nov 5, 2025
155eb8d
Fix ci yaml
HelenZhutt Nov 5, 2025
5deccfd
Merge pull request #15 from swe-students-fall2025/fix-ci-yaml
HelenZhutt Nov 5, 2025
fdff5d0
Added my name to contributers in README
Nov 5, 2025
c2fa9dd
Adding functions rainbow and ascii heart
Nov 5, 2025
0bf130f
Added test functions for rainbow function
Nov 5, 2025
cc58cc4
Added test functions for ascii heart function
Nov 5, 2025
d5047ce
Added import heart and rainbow to test file
Nov 5, 2025
1dafab1
Updated demo.py to include new functions
Nov 5, 2025
d256817
Updated readme to include new functions
Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
pull_request:
branches: [ "pipfile-experiment" ]
push:
branches: [ "pipfile-experiment" ]
workflow_dispatch:

jobs:
test-and-build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.12"]

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e . pytest build

- name: Run tests
run: pytest -q

- name: Build (sdist & wheel)
run: python -m build

- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: pyflirt-dist-${{ matrix.python-version }}
path: dist/*
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,22 @@ dmypy.json

# Cython debug symbols
cython_debug/
# Python
__pycache__/
*.pyc
*.pyo
*.pyd
*.egg-info/
.build/
.dist/
.pytest_cache/
.venv/
.env/
.envrc
.DS_Store
/.coverage
.mypy_cache/
.python-version

# Pipenv
Pipfile.lock
15 changes: 15 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]
pytest = "*"
build = "*"
twine = "*"

[requires]
python_version = "3.12"
python_full_version = "3.12.4"
392 changes: 392 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

233 changes: 231 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,232 @@
# Python Package Exercise
# pyflirt

[![CI](https://github.com/swe-students-fall2025/3-python-package-team_quartz/actions/workflows/ci.yml/badge.svg)](https://github.com/swe-students-fall2025/3-python-package-team_quartz/actions/workflows/ci.yml)

A small Python package with developer‑themed pickup lines and compliments. Nothing serious—just something light to play with while practicing packaging, testing, and CI.

## What is this?

This package has a collection of cheesy (but configurable) pickup lines and compliments for developers, designers, managers, and data scientists. You can get random lines, filter by category, adjust the cheesiness level, and customize compliments.

## Installation

```bash
pip install pyflirt
```

## Quick Start

```python
from pyflirt import line, lines, compliment, categories

# Get one random pickup line
print(line())

# Get a line in a specific category
print(line(category="nerdy"))

# Get multiple lines
print(lines(n=5, category="cs"))

# Get a compliment
print(compliment(role="developer", mood="sweet"))
```

## Demo program

Run the example that showcases all functions (`categories`, `line`, `lines`, `compliment`, `search`, `stats`, `stylize`, `say`, `rate_line`, `rainbow`, `ascii_heart`):

```bash
# from the repo root
PYTHONPATH=src python examples/demo.py

# or with pipenv
pipenv run python -c "import sys; sys.path.insert(0, 'src'); import examples.demo as d; d.main()"
```

## Functions

### `line(category="nerdy", name=None, cheese=2, seed=None)`

Returns one random pickup line.

- `category`: Pick a category like "nerdy", "cs", "math", "poetic", or "classic". Default is "nerdy".
- `name`: If the line supports it, this name will be inserted.
- `cheese`: How cheesy should it be? 1 (least cheesy) to 5 (very cheesy). Default is 2.
- `seed`: Optional number for reproducible results.

Example:
```python
line(category="cs", name="Alex", cheese=2)
```

### `lines(n=5, category=None, name=None, cheese=2, seed=None)`

Returns a list of pickup lines.

- `n`: How many lines you want.
- Other parameters work the same as `line()`.

Example:
```python
lines(n=3, category="math", cheese=3)
```

### `compliment(role="developer", mood="sweet", name=None, emojis=0, seed=None)`

Returns a compliment for a specific role.

- `role`: Choose from "developer", "designer", "manager", or "data".
- `mood`: "sweet", "cheeky", or "nerdy".
- `name`: Optional name to include in the compliment.
- `emojis`: Number of heart emojis to add (0-5).
- `seed`: Optional number for reproducible results.

Example:
```python
compliment(role="designer", mood="cheeky", name="Sam", emojis=2)
```

### `categories()`

Returns a list of all available pickup line categories.

Example:
```python
print(categories())
# ['classic', 'cs', 'math', 'nerdy', 'poetic']
```

### `search(query, category=None, name=None, cheese=5, limit=10, seed=None)`

Find up to `limit` lines containing `query` (case-insensitive), optionally filtered.

- `query`: substring to match (required)
- `category`: filter by category or search all
- `name`: optional replacement for `{name}` placeholders
- `cheese`: 1–5 max cheese allowed in results
- `limit`: max results to return
- `seed`: for deterministic ordering

Example:
```python
search("code", category="cs", limit=3, seed=7)
```

### `stats()`

Return counts for available lines.

Returns a dict with keys: `total`, `by_category`, and `cheese_hist`.

Example:
```python
s = stats()
print(s["total"], s["by_category"], s["cheese_hist"])
```

### `stylize(text, width=None, uppercase=False, color="auto")`

Format a string with optional wrapping, uppercasing, and ANSI color.

- `width`: wrap to this many columns (None = no wrap)
- `uppercase`: True to uppercase the text
- `color`: one of `"auto"`, `"none"`, `"magenta"`, `"cyan"`, `"green"`

Example:
```python
stylize("hello world", width=8, uppercase=True, color="none")
```

### `say(category="nerdy", name=None, cheese=2, seed=None, width=None, uppercase=False, color="auto", emojis=0)`

Generate a line, decorate it (wrap/case/color/emojis), print it, and return it.

Example:
```python
say(category="nerdy", seed=1, width=16, color="none", emojis=2)
```

### `rate_line(text, metric="length"|"cheese_level"|"random", seed=None)`

Score a line by the chosen metric.

- `length`: higher for shorter lines (simple heuristic)
- `cheese_level`: counts cheesy keywords
- `random`: seeded 0–10 score

Example:
```python
rate_line("You are so sweet", metric="cheese_level")
```

### `rainbow(text)`

Colorize text with rainbow ANSI codes 🌈
Useful for terminals that support color formatting.

Example:
```python
print(rainbow("You light up my console! 💻"))
```

### `ascii_heart()`

Return a multi-line ASCII heart ❤️. A great decoration after a compliment.

Example:
```python
print(ascii_heart())
```
## Development Setup

If you want to work on this package:

1. Clone the repo:
```bash
git clone https://github.com/swe-students-fall2025/3-python-package-team_quartz.git
cd 3-python-package-team_quartz
```

2. Install pipenv (if you don't have it):
```bash
pip install pipenv
```

3. Install dependencies:
```bash
pipenv install --dev
```

4. Activate the virtual environment:
```bash
pipenv shell
```

5. Run tests:
```bash
pytest
```

6. Build the package:
```bash
python -m build
```

## Links

- [PyPI Package](https://pypi.org/project/pyflirt/0.1.0/)
- [TestPyPI (0.1.0)](https://test.pypi.org/project/pyflirt/0.1.0/)
- [GitHub Repository](https://github.com/swe-students-fall2025/3-python-package-team_quartz)

## Contributors

Team
- Siqi Zhu — [@HelenZhutt](https://github.com/HelenZhutt)
- Daniel Lee - [@danielleesignup](https://github.com/danielleesignup)


More links
- [Contributors Graph](https://github.com/swe-students-fall2025/3-python-package-team_quartz/graphs/contributors)
- [Commits](https://github.com/swe-students-fall2025/3-python-package-team_quartz/commits)

An exercise to create a Python package, build it, test it, distribute it, and use it. See [instructions](./instructions.md) for details.
68 changes: 68 additions & 0 deletions examples/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from pyflirt import (
line,
lines,
categories,
compliment,
search,
stats,
stylize,
say,
rate_line,
rainbow,
ascii_heart,
)

def main():
print("== categories() ==")
cats = categories()
print(cats)

cat = "nerdy" if "nerdy" in cats else (cats[0] if cats else None)

print("\n== line() ==")
print(line(category=cat or "nerdy", name="Alex", cheese=3, seed=1))

print("\n== lines() ==")
for s in lines(n=3, category=cat, name="Sam", cheese=3, seed=2):
print("-", s)

print("\n== compliment() ==")
print(compliment(role="developer", mood="sweet", name="Jamie", emojis=2, seed=3))

print("\n== search() ==")
for h in search(query="you", limit=5, seed=4):
print("-", h)

print("\n== stats() ==")
st = stats()
print("total:", st["total"])
print("by_category:", st["by_category"])
print("cheese_hist:", st["cheese_hist"])

print("\n== stylize() ==")
sample = line(category=cat or "nerdy", seed=5)
styled = stylize(sample, width=20, uppercase=True, color="none")
print(styled)

print("\n== say() ==")
# say() prints the formatted line and returns it
returned = say(category=cat or "nerdy", seed=6, width=18, emojis=1, color="none")
print("(returned)", returned)

print("\n== rate_line() ==")
txt = line(category=cat or "nerdy", seed=7)
print("text:", txt)
print("length score:", rate_line(txt, metric="length"))
print("cheese score:", rate_line(txt, metric="cheese_level"))
print("random score (seeded):", rate_line(txt, metric="random", seed=42))

print("\n== rainbow() ==")
rainbow_text = rainbow("You brighten up my terminal 💻💘")
print(rainbow_text)

print("\n== ascii_heart() ==")
print(ascii_heart())


if __name__ == "__main__":
main()
Loading
Loading