hackf / rpi_door

MIT License
2 stars 3 forks source link

project modularization #4

Open jeffszusz opened 10 years ago

jeffszusz commented 10 years ago

Refactor so that GPIO drivers, the SQLAlchemyBinding mixin and AbstractDoor are all swappable with additional potential modules and make this configurable. Right now, GPIO.py glues these together, and GPIO.py is supposed to be an optional driver.

Taar commented 10 years ago

The idea is to change the project so that door.py doesn't exist and use setup tool so it can be installed. RPiDoor is meant to be a rebuilt class that does everything you need. If you don't want to use the GPIO pins or require a different setup, you could create your own class that extends the AbstractDoor. Basically you would use the rpi_door package the same way as the door.py currently does.

I'm currently working on a way to provide configuration either by using a config file or passing in the config when you instantiate the class.

jeffszusz commented 10 years ago

I know you can extend AbstractDoor yourself, but you've got GPIO included in your package as a driver and AbstractDoor is not separate. Shouldn't the binding between the GPIO driver and the AbstractDoor happen outside of the package?

Taar commented 10 years ago

No I don't think so. The idea is to provide some form of pre-built functionality so you can pass in some configuration and you're done. But we also want to leave room so you can create your own drivers if you want. I suppose GPIO.py should maybe be placed in a contrib folder instead or at least labeled in some way indecating it's pre-configured to use the GPIO pins.