Skip to content

fix(starter-code): repair expense tracker syntax error#671

Open
DhruvalBhinsara1 wants to merge 2 commits into
komalharshita:mainfrom
DhruvalBhinsara1:fix/expense-tracker-starter-code
Open

fix(starter-code): repair expense tracker syntax error#671
DhruvalBhinsara1 wants to merge 2 commits into
komalharshita:mainfrom
DhruvalBhinsara1:fix/expense-tracker-starter-code

Conversation

@DhruvalBhinsara1
Copy link
Copy Markdown

What

Fixes the Personal Expense Tracker starter file so users can run or compile the downloaded starter code without hitting a Python syntax error. The file had a closing module docstring delimiter but no opening delimiter, so its introductory metadata was parsed as executable Python.

How

Added the missing opening triple-quote to make the starter-code metadata a valid module docstring. Added a regression test that compiles every Python file in starter_code with py_compile, and recorded the user-facing fix in CHANGELOG.md per the contribution guide.

Testing

  • .venv/bin/python tests/test_basic.py
  • .venv/bin/python -m py_compile starter_code/*.py
  • git diff --check

Risks / Notes

No linked issue number yet. Scope is limited to starter-code syntax validity, one regression test, and the changelog entry.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

@DhruvalBhinsara1 is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working type:testing and removed type:bug Something isn't working gssoc-2026 labels May 28, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting your first pull request to DevPath.

Before review:

  • Complete the PR template fully
  • Ensure all tests pass
  • Link your PR to an issue
  • Keep changes scoped to the issue

A maintainer will review your contribution soon.

@DhruvalBhinsara1 DhruvalBhinsara1 marked this pull request as ready for review May 28, 2026 12:47
Copilot AI review requested due to automatic review settings May 28, 2026 12:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a regression test to ensure Python starter code is syntactically valid, fixes a syntax/indentation issue in the Personal Expense Tracker starter file, and documents the fix in the changelog.

Changes:

  • Add a test that compiles starter_code/*.py to catch syntax errors early.
  • Fix starter_code/expense_tracker.py so it parses/runs (module docstring + correct main() invocation indentation).
  • Update CHANGELOG.md to record the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/test_basic.py Adds a test that compiles starter-code Python files to prevent shipping syntactically invalid examples.
starter_code/expense_tracker.py Fixes invalid syntax/formatting so the starter script runs correctly.
CHANGELOG.md Records the starter-code compilation fix under “Fixed”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_basic.py Outdated
for filename in os.listdir(starter_code_dir):
if filename.endswith(".py"):
path = os.path.join(starter_code_dir, filename)
py_compile.compile(path, doraise=True)
Comment thread tests/test_basic.py Outdated
Comment on lines +64 to +67
for filename in os.listdir(starter_code_dir):
if filename.endswith(".py"):
path = os.path.join(starter_code_dir, filename)
py_compile.compile(path, doraise=True)
Copy link
Copy Markdown

@Xenon010101 Xenon010101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed both Copilot suggestions:

  1. Side-effect-free compile: Changed py_compile.compile(path, doraise=True) to py_compile.compile(path, doraise=True, cfile=os.devnull) to avoid writing .pyc files to __pycache__ during test runs.

  2. Recursive directory walk: Replaced os.listdir with os.walk so that Python files in subdirectories under starter_code/ are also checked for syntactic validity.

def test_python_starter_code_files_compile():
    "Python starter files must be syntactically valid for users to run."
    starter_code_dir = os.path.join(os.path.dirname(__file__), .., starter_code)

    for root, dirs, files in os.walk(starter_code_dir):
        for filename in files:
            if filename.endswith(.py):
                path = os.path.join(root, filename)
                py_compile.compile(path, doraise=True, cfile=os.devnull)

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working labels May 30, 2026
@DhruvalBhinsara1
Copy link
Copy Markdown
Author

Follow-up status: pushed bf61cc2 to address the review feedback. The starter-code compile test now walks nested Python files and writes bytecode into a temporary directory so test runs do not create persistent .pyc files.\n\nVerification: ......................................... [100%]
41 passed in 0.04s passes with 41 tests.\n\nCI note: repository label checks are passing. The only failing check is Vercel, which fails before deployment with "Authorization required to deploy" and requires maintainer-side Vercel authorization.

@DhruvalBhinsara1
Copy link
Copy Markdown
Author

@Xenon010101 I believe you haven't assigned me the issue yet, could you please assign it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants