wbolster / plyvel

Plyvel, a fast and feature-rich Python interface to LevelDB
https://plyvel.readthedocs.io/
Other
529 stars 75 forks source link

Expose DB name attribute at the Python level #90

Closed sbellem closed 5 years ago

sbellem commented 5 years ago

Related to issue #88.

The DB.name attribute is not exposed at the Python level and could sometimes be useful. One example, is the deletion of a DB instance for which the name has not been "cached" at creation time. One could get the name by parsing DB.__str__() or DB.__repr__() but why not directly from DB.name?

wbolster commented 5 years ago

thanks, is there a way to make the attribute read only?

sbellem commented 5 years ago

thanks, is there a way to make the attribute read only?

Oh, that is a very good point. Will do!

sbellem commented 5 years ago

@wbolster See re-worked commit. The DB.name attribute is now readonly at the Python level. There is a small test to check that an error is raised if one attempts to change the name.

Just in case that helps, I found the following docs useful https://cython.readthedocs.io/en/latest/src/userguide/extension_types.html#static-attributes.

sbellem commented 5 years ago

can you add the documentation to the api docs with a proper version tag? (use 1.1.0)

Yes!

sbellem commented 5 years ago

@wbolster Added docs with a note about the version. Let me know if anything else needs to be done.