bobfang1992 / pytomlpp

A python wrapper for tomlplusplus
https://bobfang1992.github.io/pytomlpp/pytomlpp.html
MIT License
86 stars 11 forks source link

Feature request: overloading load/dump to accept filename/paths #51

Closed neutrinoceros closed 3 years ago

neutrinoceros commented 3 years ago

Would you be interested in a patch to allow pytomlpp.load and pytomlpp.dump to accept a filename/path object instead of an io.TextIOBase object ? Rationale: this change would allow for a seamless migration from the better known pure Python toml parser to this package. The whole process would be done by simply replacing

import toml

with

import pytomlpp as toml
bobfang1992 commented 3 years ago

Ack, isn't this a breaking change? I will need to consider if this s a breaking change.

neutrinoceros commented 3 years ago

I honestly don't think it has to be, unless you consider that raising an error from pytomlpp.load("myfile.toml") is a feature :) I'm game to propose a patch, with tests.

bobfang1992 commented 3 years ago

That would be great! Thanks!