Contributing
Any kind of contribution is more than welcomed! There are several ways you can contribute:
- Opening GitHub issues to list the bugs you've found
- Implementation of new features or resolution of existing bugs
- Enhancing the documentation
How pyfonts
works
Under the bonnet, pyfonts
does several things, but it can be summarised as follows:
- Take the user's data (font name, weight, italics) and create a url that will be passed to Google's Font API.
- Parse the response to obtain the url of the actual font file
- Retrieve the font file from a temporary file
- Use this temporary file to create a matplotlib font object (which is
FontProperties
) - Return this object
By default, the font file url is cached to reduce the number of requests required and improve performance. The cache can be cleared with clear_pyfonts_cache()
.
Setting up your environment
Install for development
-
Fork the repository to your own GitHub account.
-
Clone your forked repository to your local machine (ensure you have Git installed):
- Create a new branch:
- Set up your Python environment (ensure you have uv installed):
Code!
You can now make changes to the package and start coding!
Run the test
- Test that everything works correctly by running:
Preview documentation locally
Push changes
- Commit and push your changes:
- Go back to your fork and click on the "Open a PR" popup
Congrats! Once your PR is merged, it will be part of pyfonts
.