Closed EpicWink closed 4 years ago
I want to deal with all possible IO with pure python... I will think about this and see if I can implement it.
Hey @EpicWink do you know how to combine pure python code with the compiled module in one project? I imagine we need to change the setup.[py|cfg]
a bit to do it but not sure how. Do you have any guidance on that?
Choose one:
packages = find:
exclude = tests/
(etc)packages = find:
and package_dir = =src
(yes two equals signs)where = src
py_modules = <module name>
(etc)py_modules = <module name>
and package_dir = =src
Packages and modules inside a subdirectory are preferred as it means when you run pytest
, it runs against the installed version of the code instead of the local directory (sys.path
related things). This makes no difference when install packags as editable (ie pip install -e .
). This is particularly important when running coverage reporting, as pytest --cov pytomlpp
will see the local directory/file first before trying to find the package in sys.path
, but the tests are run against the installed version.
Have
pytomlpp.load
to parse TOML from a text stream, andpytomlpp.dump
to serialise TOML to a text stream.This will then match the functionality of the standard-library JSON module. This could be implemented in either Python or PyBind11, simply calling the existing
pytomlpp.loads
andpytomlpp.dumps
for now. Further iterations I imagine could use C++ streams.