Skip to main content

A tiny NYC restaurant recommender near NYU.

Project description

Python Package Exercise

An exercise to create a Python package, build it, test it, distribute it, and use it. See instructions for details.

eatnyc - NYC Restaurant Recommender

Build and Test

eatnyc is a lightweight Python package that recommends top-rated NYC restaurants based on cuisine, neighborhood, price, and rating.
It’s designed to help users explore the city’s dining scene and discover great places through data-driven recommendations — directly from the command line or in Python.


How to install and use this package

Option 1: Try it from TestPyPI (current test version)

You can try out the latest build of eatnyc from the TestPyPI repository.

  1. Create and Activate a virtual environment
pipenv --python 3.11
pipenv shell
  1. Install from TestPyPI Replace 0.1.0 with your latest version number (see pyproject.toml)
pipenv install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple eatnyc==0.1.0

For now: The --extra-index-url flag ensures dependencies are installed from the real PyPI, while your package is pulled from TestPyPI

  1. Run the package You can use eatnyc either as a CLI app or a Python module.

Command line:

eatnyc -n 5 --sort rating

Python module:

python -m eatnyc

Example Program

from eatnyc import load_data, filter_restaurants, top_n, sample_dish, format_card

data = load_data()

# Filter restaurants by cuisine and neighborhood
italian_manhattan = filter_restaurants(
    data,
    cuisine="Italian",
    neighborhood="Manhattan",
    min_rating=4.0
)

# Get top 5 restaurants by rating
best = top_n(data, n=5, sort_by="rating")

# Show a sample dish recommendation
print(sample_dish(cuisine="Japanese"))

# Print formatted cards
for r in best:
    print(format_card(r, style="ascii", width=48))

Run the example:

pipenv run python examples/demo.py

How to Run Unit Tests

Simple unit tests are included in the 'tests' directory. To run them:

  1. Install 'pytest' inside your virtual environment:
pipenv install pytest
  1. Run the tests from project root:
python3 -m pytest
  1. All tests should pass. Any failed test indicates that the package code is behaving differently from the expected results.

Option 2: Install from PyPI (for users)

pip install eatnyc

Install locally (for developers)

pipenv install -e .

If that set up fails for you, use:

python3 -m pipenv install -e .

Developer Workflow (Building & Publishing)

If you modify the code and want to publish a new version to TestPyPI, follow these steps:

#1. CLEAN old build artifacts
rm -rf dist build src/*.egg-info
pipenv install build

#2. BUMP version number in pyproject.toml (e.g., 0.1.0 → 0.1.1)

#3. BUILD the package
pipenv run python -m build

#4. UPLOAD new version to TestPyPI
pipenv install twine
pipenv run twine upload -r testpypi dist/*
  1. REINSTALL to test it:
pipenv run pip uninstall -y eatnyc
pipenv install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple eatnyc==0.1.1
  1. Once final, UPLOAD to real PyPI (final version) with:
pipenv run twine upload dist/*

Project Links

Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eatnyc-0.1.1.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eatnyc-0.1.1-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file eatnyc-0.1.1.tar.gz.

File metadata

  • Download URL: eatnyc-0.1.1.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for eatnyc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ab3730a38a3e987ea1aa1792fd4866a54a1c86516e9ba795fa694af9b90bf7f9
MD5 544b7efaeec1cb80795596026c78fb7f
BLAKE2b-256 46a02267a550ea20361c4cf3b939eb43ed8c6636b355f96c734c3421e012f3d5

See more details on using hashes here.

File details

Details for the file eatnyc-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: eatnyc-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for eatnyc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1172502632bcd31c272bf77308ef1d3c622a5ca3c96875629531e7b923c9ca71
MD5 2ff1b396479a3702002a4f3cecf199d8
BLAKE2b-256 aaa61413bbe2e430ea032911fb9848be8bd649071291b511a61d536cfb67ee91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page