Place type plugins¶
Place types are used to indicate the type of a Place, such as a country, a city, or a house number.
Creating a place type¶
Create a new class that extends
betty.ancestry.place_type.PlaceType
and implements the abstract methods, for example:from typing import override from betty.ancestry.place_type import PlaceType from betty.machine_name import MachineName class MyPlaceType(PlaceType): @override @classmethod def plugin_id(cls) -> MachineName: return "my-module-my-place-type" # Implement remaining abstract methods... ...
Tell Betty about your place type by registering it as an entry point. Given the place type above in a module
my_package.my_module
, add the following to your Python package:
[project.entry-points.'betty.place_type']
'my-module-my-place-type' = 'my_package.my_module.MyPlaceType'
SETUP = {
'entry_points': {
'betty.place_type': [
'my-module-my-place-type=my_package.my_module.MyPlaceType',
],
},
}
if __name__ == '__main__':
setup(**SETUP)
See also¶
Read more about how to use place types and Betty’s built-in place types at Place Type.