Skip to content

Conversation

Dando18
Copy link
Collaborator

@Dando18 Dando18 commented Oct 21, 2025

Adds a pyproject.toml to make installing the plotting library in a virtualenv and using it easier.

Also distributes the font directly in the package, so no quirky path is needed.
If not found for some reason, then it falls back to system font or user supplied font.

@Dando18 Dando18 self-assigned this Oct 21, 2025
@Dando18 Dando18 added the enhancement New feature or request label Oct 21, 2025
@Dando18 Dando18 requested review from bhatele and Copilot October 21, 2025 19:12
Copy link

@Copilot 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

This PR adds Python packaging configuration and bundles fonts with the library to simplify installation and usage. The changes eliminate the need for users to manually specify font paths by automatically discovering bundled or system fonts with appropriate fallbacks.

Key changes:

  • Added pyproject.toml with project metadata, dependencies, and build configuration
  • Implemented font resolution logic that searches for bundled fonts, system fonts, and falls back to defaults
  • Updated README to remove the explicit font_path parameter from the usage example

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
pyproject.toml Defines packaging configuration, dependencies, and project metadata for distribution
pssgplot/pssgplot.py Refactored font handling with new _resolve_font method that searches bundled and system fonts
README.md Simplified usage example and added installation instructions
Comments suppressed due to low confidence (1)

README.md:9

  • Corrected spacing in 'Aquick' to 'A quick'.
A quick demo of plotting a simple bar chart:

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

return font_name

# Use bundled Gill Sans font if available
bundled_font_path = Path(__file__).parent.parent / "fonts" / "gillsans.ttf"
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

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

The bundled font path is incorrect. According to pyproject.toml line 50, fonts are packaged inside the pssgplot package (pattern pssgplot = ["*.ttf", "fonts/*.ttf"]), but this code looks for them at parent.parent / "fonts", which would be outside the package. The path should be Path(__file__).parent / "fonts" / "gillsans.ttf" to correctly locate fonts within the pssgplot package directory.

Suggested change
bundled_font_path = Path(__file__).parent.parent / "fonts" / "gillsans.ttf"
bundled_font_path = Path(__file__).parent / "fonts" / "gillsans.ttf"

Copilot uses AI. Check for mistakes.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant