Pychievements is a framework for creating and tracking achievements within a Python application. It includes functions specifically for creating command line applications, though it is flexible enough to be used for any application such as web applications.
See the examples to get a good feel for what Pychievements offers. Documentation can be found RTD: http://pychievements.readthedocs.org/en/latest/
A simple achievement.
class MyAchievement(Achievement): name = "My Achievement" category = "achievements" keywords = ("my", "achievement") goals = ( {"level": 10, "name": "Level 1", "icon": icons.star, "description": "Level One"}, {"level": 20, "name": "Level 2", "icon": icons.star, "description": "Level Two"}, {"level": 30, "name": "Level 3", "icon": icons.star, "description": "Level Three"}, )
Increment a level for a user.
tracker.increment(user_id, MyAchievment)
Re-evaluating a level for a user based on arguments (requires the evaluate function to be defined or the Achievement).
tracker.evaluate(user_id, MyAchievement, some, extra, args)
Retrieve achievements.
tracker.achievements() # retrieves all registered achievements in the tracker tracker.achieved(uid, achievement) # all achieved goals by uid for achievement tracker.unachieved(uid, achievement) # all unachieved goals by uid for achievement tracker.current(uid, achievement) # goal currently being worked torwards by uid
To install pychievements, simply:
$ pip install pychievements
Pychievements is licensed under the MIT License, see the LICENSE.
If you'd like to contribute, simply fork the repository, commit your changes to the master branch (or branch off of it), and send a pull request. Make sure you add yourself to AUTHORS.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4