Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
4b0b5c4
package-try1
ems9856-lgtm Oct 31, 2025
1d9ca7b
snacktime-2
ems9856-lgtm Oct 31, 2025
59bbd8c
spelling-correction
ems9856-lgtm Nov 3, 2025
993f1ba
Merge pull request #1 from swe-students-fall2025/feature/new-api
ems9856-lgtm Nov 3, 2025
30d198a
test-edit
ems9856-lgtm Nov 3, 2025
1627fb3
Formatted tests to run with pypi. Updated minimum python version
jawarbx Nov 3, 2025
d441413
Merge pull request #2 from swe-students-fall2025/test_setup
ems9856-lgtm Nov 3, 2025
23b2cc6
Added pr_test.yaml to automate checking PRs
jawarbx Nov 3, 2025
a6d6000
Added build file for testing PRs
jawarbx Nov 3, 2025
8d5d986
Merge pull request #3 from swe-students-fall2025/test_setup
jawarbx Nov 3, 2025
f69a57a
Update test_random_snack.py
hanqigui Nov 3, 2025
28d8e79
Merge pull request #4 from swe-students-fall2025/fix/recipe-and-snack…
ems9856-lgtm Nov 4, 2025
cd15703
Create demo.py
hanqigui Nov 4, 2025
d9cb58f
Update Pipfile
hanqigui Nov 4, 2025
d9ea6dc
Create ci.yml
hanqigui Nov 4, 2025
ee45552
Merge pull request #7 from swe-students-fall2025/CI-pytest
ems9856-lgtm Nov 4, 2025
cbb502a
Update README.md
qiexian-mf Nov 4, 2025
70bd2cc
Update README.md
hanqigui Nov 5, 2025
b584a16
Merge pull request #5 from swe-students-fall2025/feat/examples-demo
jawarbx Nov 5, 2025
176f000
Merge pull request #9 from swe-students-fall2025/readme-update
jawarbx Nov 5, 2025
b8faa8a
Update core.py
hanqigui Nov 5, 2025
86ef821
Update core.py
hanqigui Nov 5, 2025
0ffe332
Update core.py
hanqigui Nov 5, 2025
0cf7038
Merge pull request #11 from swe-students-fall2025/hanqigui-patch-1
jawarbx Nov 5, 2025
efa0bf2
Merge pull request #6 from swe-students-fall2025/python-version
jawarbx Nov 5, 2025
500a802
added CI badge and updated license
funfig16 Nov 5, 2025
607b8f5
Fix formatting in README.md
funfig16 Nov 5, 2025
5456662
Fix link to Build & Test badge in README
funfig16 Nov 5, 2025
0325866
Update Build & Test badge link in README.md
funfig16 Nov 5, 2025
1e0ddbf
Update Build & Test badge link in README.md
funfig16 Nov 5, 2025
d7553aa
Add push event trigger for pipfile-experiment branch
funfig16 Nov 5, 2025
4d612d3
Update README.md
funfig16 Nov 5, 2025
d8f12f9
Update push branches in PR workflow
funfig16 Nov 5, 2025
236775a
Fix license abbreviation from GLP to GPL
funfig16 Nov 5, 2025
ca4f4b9
push request
funfig16 Nov 5, 2025
36b316a
Update build & test badge link in README.md
funfig16 Nov 5, 2025
380abe2
Fix workflow trigger configuration in PR tests
funfig16 Nov 5, 2025
3bc8030
Update README.md
funfig16 Nov 5, 2025
06a58fa
trigger CI for badge
funfig16 Nov 5, 2025
1069c76
Update Build & Test badge link in README.md
funfig16 Nov 5, 2025
3574b20
Fix CI badge link in README
funfig16 Nov 5, 2025
091b520
Revise README formatting and link placement
funfig16 Nov 5, 2025
9a756ad
Update README to include build badge image
funfig16 Nov 5, 2025
74939fd
CI badge
funfig16 Nov 5, 2025
9f67b62
Update README badge link for CI workflow
funfig16 Nov 5, 2025
5d7c9df
Merge pull request #12 from swe-students-fall2025/readme-update2
jawarbx Nov 5, 2025
32fe3af
Modify PR test workflow for additional Python versions
funfig16 Nov 5, 2025
d51becd
Add Python version badges to README
funfig16 Nov 5, 2025
d064205
Update README.md
funfig16 Nov 5, 2025
9d0dc7a
Update README.md
funfig16 Nov 5, 2025
b4dbcca
Update README.md
funfig16 Nov 5, 2025
121cf05
Update README.md
funfig16 Nov 5, 2025
ad801bb
Update README.md
funfig16 Nov 5, 2025
b055926
Update README.md
funfig16 Nov 5, 2025
7643a8c
Update README.md
funfig16 Nov 5, 2025
08857ae
Update README.md
funfig16 Nov 5, 2025
6875886
Update pr_test.yaml
funfig16 Nov 5, 2025
b0058e4
Update README.md
funfig16 Nov 5, 2025
bb6a8c8
Update README.md
funfig16 Nov 5, 2025
dc82acb
github repo link update
funfig16 Nov 5, 2025
829ce4d
Added delivery job to workflow and updated minimum python version to …
jawarbx Nov 5, 2025
4458c99
Merge pull request #13 from swe-students-fall2025/final_polish
jawarbx Nov 5, 2025
815a859
Typo fix to delivery workflow
jawarbx Nov 5, 2025
c81a946
Merge pull request #14 from swe-students-fall2025/final_polish
jawarbx Nov 5, 2025
385795a
tests added
funfig16 Nov 5, 2025
b230785
Update README.md
funfig16 Nov 5, 2025
c8ccb61
Update README.md
qiexian-mf Nov 5, 2025
d2f4f25
Merge pull request #16 from swe-students-fall2025/qiexian-mf-patch-1
qiexian-mf Nov 5, 2025
797d8b8
Merge branch 'pipfile-experiment' into funfig16-patch-1
jawarbx Nov 5, 2025
123250c
Merge pull request #15 from swe-students-fall2025/funfig16-patch-1
jawarbx Nov 5, 2025
4f98b99
Fixed build upload and updated metadata
jawarbx Nov 5, 2025
d310a80
Updated url for workflow again
jawarbx Nov 5, 2025
47c5c83
Merge pull request #17 from swe-students-fall2025/upload_patch
jawarbx Nov 5, 2025
130abab
Updated metadata and README links
jawarbx Nov 5, 2025
d680cee
Readded files from original forked repo
jawarbx Nov 6, 2025
7fed67d
Added command line instructions
jawarbx Nov 6, 2025
e121ec1
Updated metadata
jawarbx Nov 6, 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
48 changes: 48 additions & 0 deletions .github/workflows/pr_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tests
on:
push:
branches: [pipfile-experiment]
tags: ['*']
pull_request:
branches: [pipfile-experiment]
types: [opened, synchronize, reopened, closed]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
python-version: ["3.9","3.10","3.11"]
steps:
- uses: actions/checkout@v4
- name: Install Python, pipenv and Pipfile packages
uses: kojoru/prepare-pipenv@v1
with:
python-version: ${{ matrix.python-version }}
- name: Turn on 'editable' mode
run: |
pipenv install -e .
- name: Test with pytest
run: |
pipenv install pytest
pipenv --venv
pipenv run python -m pytest
deliver:
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Install Python, pipenv and Pipfile packages
uses: kojoru/prepare-pipenv@v1
- name: Build package
run: |
pipenv install build
pipenv run python -m build .
- name: Publish to PyPI test server
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
repository-url: https://upload.pypi.org/legacy/
17 changes: 17 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

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

[requires]
python_version = "3.9"

[scripts]
snacktime = "python -m snacktime"
375 changes: 375 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

149 changes: 147 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,148 @@
# Python Package Exercise
# 🥗 snacktime

An exercise to create a Python package, build it, test it, distribute it, and use it. See [instructions](./instructions.md) for details.
**Build & Tests**
Python 3.09 ![Python 3.09](https://github.com/swe-students-fall2025/3-python-package-team_solace/actions/workflows/pr_test.yaml/badge.svg?branch=pipfile-experiment&label=Python%203.09)
Python 3.10 ![Python 3.10](https://github.com/swe-students-fall2025/3-python-package-team_solace/actions/workflows/pr_test.yaml/badge.svg?branch=pipfile-experiment&label=Python%203.10)
Python 3.11 ![Python 3.11](https://github.com/swe-students-fall2025/3-python-package-team_solace/actions/workflows/pr_test.yaml/badge.svg?branch=pipfile-experiment&label=Python%203.11)



A lightweight and fun Python package that helps you pick a **random snack**, **vegetable**, **sweet treat**, or even generate a **simple salad recipe**.
Originally created as part of the Software Engineering Fall 2025 team project — this package demonstrates Python packaging, publishing, and CI automation.

---

## 📦 PyPI Project

🔗 **Link:** [https://pypi.org/project/snacktime/](https://pypi.org/project/snacktime/)

---

## 🚀 Installation

You can install directly from PyPI using pip:

```bash
pip install snacktime
```

---

## 🧩 Usage

Once installed, simply import and call any of the available functions:

```python
import snacktime

print(snacktime.random_snack())
print(snacktime.random_vegetable())
print(snacktime.random_treat())
print(snacktime.recipe_salad(serves=2, dressing="balsamic"))
```

### 🧾 Example Output

```bash
granola bar
spinach
cupcake

Simple Green Salad
Serves: 2

Ingredients
-----------
- 4 cups mixed greens
- 2 cups chopped vegetables (e.g., cucumber, tomato, carrot)
- 4 tbsp nuts or seeds (optional)
- Salt & pepper to taste
- Dressing: 4 tbsp olive oil, 2 tbsp balsamic vinegar, pinch of salt

Steps
-----
1) Toss greens and chopped veggies in a bowl.
2) Whisk dressing separately, then drizzle over salad.
3) Sprinkle nuts/seeds. Season with salt & pepper. Toss and serve.
```


Or, if preferred, snacktime can be called from the command line once installed:
```bash
$ pipenv run snacktime snack
pretzels
$ pipenv run snacktime treat
churro
$ pipenv run snacktime vegetable
spinach
$ pipenv run snacktime recipe
Simple Green Salad
Serves: 2

Ingredients
----------
- 4 cups mixed greens
- 2 cup chopped vegetables (e.g., cucumber, tomato, carrot)
- 4 tbsp nuts or seeds (optional)
- Salt & pepper to taste
- Dressing: 4 tbsp olive oil, 2 tbsp balsamic vinegar, pinch of salt

Steps
-----
1) Toss greens and chopped veggies in a bowl.
2) Whisk dressing separately, then drizzle over salad.
3) Sprinkle nuts/seeds. Season with salt & pepper. Toss and serve.
```

Make sure not to snack too much!


---

## ✨ Features

- 🍎 **`random_snack()`** — pick a random healthy or quick snack
- 🥦 **`random_vegetable()`** — choose a random vegetable
- 🍩 **`random_treat()`** — get a random dessert idea
- 🥗 **`recipe_salad()`** — generate a simple, customizable salad recipe

---

## 👥 Team Solace

- **Member**: [funfigwat](https://github.com/funfig16), [qiexian-mf](https://github.com/qiexian-mf), [ems9856-lgtm](https://github.com/ems9856-lgtm), [hanqigui](https://github.com/hanqigui), [jawarbx](https://github.com/jawarbx)

---

## 🧠 Notes

- Tested with **Python 3.9+** on macOS and Linux.
- All random functions can be made deterministic with a `seed` argument.
```python
snacktime.random_snack(seed=42)
```
- Supports CLI and programmatic use.

---

## 🧑‍💻 Project Details

| Field | Description |
|-------|-------------|
| **Package Name** | `snacktime` |
| **Author** | Team Solace |
| **License** | GPL 3.0 |
| **Language** | Python 3.9+ |
| **PyPI Page** | [https://pypi.org/project/snacktime/](https://pypi.org/project/snacktime/)

---

## 🥳 Credits

Developed by **Team Solace** for *Software Engineering (Fall 2025)*
as part of the Python Package exercise.
This project demonstrates collaboration, testing, automation, and packaging best practices.

---

**Enjoy your snacks and code responsibly,thank you! 🍪🥗🍫**
15 changes: 15 additions & 0 deletions examples/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# examples/demo.py

from snacktime import random_snack, random_treat, random_vegetable, recipe_salad

def main():
print("=== snacktime demo ===")
print("snack:", random_snack(seed=1))
print("treat:", random_treat(seed=2))
print("vegetable:", random_vegetable(seed=3))

print("\n--- salad recipe ---")
print(recipe_salad(serves=3, dressing="lemon"))

if __name__ == "__main__":
main()
42 changes: 42 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "snacktime"
version = "0.5.1"
description = "CLI that gives a random snack, a simple salad recipe, a random vegetable, or a sweet treat."
authors = [
{name="Ezra Shapiro", email="ems9856@nyu.edu"},
{name="Athena Luo", email="athenaluoxy@gmail.com"},
{name="Jasir Nawar", email="jn2691@nyu.edu"},
{name="Hanqi Gui", email="hg2542@nyu.edu"},
{name="Kaiyuan Wu", email="wkyklmf@gmail.com"}
]

maintainers = [
{name="Ezra Shapiro", email="ems9856@nyu.edu"},
{name="Athena Luo", email="athenaluoxy@gmail.com"},
{name="Jasir Nawar", email="jn2691@nyu.edu"},
{name="Hanqi Gui", email="hg2542@nyu.edu"},
{name="Kaiyuan Wu", email="wkyklmf@gmail.com"}
]

license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.9"

[project.scripts]
snacktime = "snacktime.__main__:main"

[project.optional-dependencies]
dev = ['pytest']

[project.urls]
"Homepage" = "https://github.com/swe-students-fall2025/3-python-package-team_solace"
"Repository" = "https://github.com/swe-students-fall2025/3-python-package-team_solace.git"
"Bug Tracker" = "https://github.com/swe-students-fall2025/3-python-package-team_solace/issues"

[tool.setuptools.packages.find]
where = ["."]
include = ["snacktime*"]
10 changes: 10 additions & 0 deletions snacktime/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
__version__ = "0.2.0"

from .core import (
random_snack,
random_vegetable,
random_treat,
recipe_salad,
)

__all__ = ["random_snack", "random_vegetable", "random_treat", "recipe_salad"]
55 changes: 55 additions & 0 deletions snacktime/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import sys
from . import random_snack, random_vegetable, random_treat, recipe_salad, __version__

USAGE = """\
snacktime v{v}

Usage:
snacktime snack # random snack
snacktime recipe [--serves N] [--dressing NAME]
snacktime vegetable [--seed N] # random vegetable
snacktime treat [--seed N] # random sweet treat

Options:
--seed N Deterministic selection for snack/vegetable/treat (default: none)
--serves N Servings for the salad recipe (default: 2)
--dressing NAME lemon | balsamic | olive (default: balsamic)
"""

def main(argv=None):
argv = list(sys.argv[1:] if argv is None else argv)
if not argv:
print(USAGE.format(v=__version__))
return 0

cmd = argv[0].lower().strip()
args = argv[1:]

# parse simple flags
def read_flag(name, cast=int, default=None):
if name in args:
i = args.index(name)
try:
return cast(args[i+1])
except Exception:
raise SystemExit(f"Invalid value for {name}")
return default

seed = read_flag("--seed", int, None)
serves = read_flag("--serves", int, 2)
dressing = read_flag("--dressing", str, "balsamic")

if cmd == "snack":
print(random_snack(seed=seed)); return 0
if cmd == "vegetable":
print(random_vegetable(seed=seed)); return 0
if cmd == "treat":
print(random_treat(seed=seed)); return 0
if cmd == "recipe":
print(recipe_salad(serves=serves, dressing=dressing)); return 0

print(USAGE.format(v=__version__))
return 1

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