{"id":16092280,"url":"https://github.com/alecthomas/flam","last_synced_at":"2026-01-12T02:11:41.537Z","repository":{"id":470164,"uuid":"95086","full_name":"alecthomas/flam","owner":"alecthomas","description":"flam /flæm/ noun, verb, flammed, flam⋅ming. Informal. –noun 1. a deception or trick. 2. a falsehood; lie. –verb (used with object), verb (used without object) 3. to deceive; delude; cheat.","archived":false,"fork":false,"pushed_at":"2023-12-02T11:54:35.000Z","size":132,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-09T13:36:21.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alecthomas.png","metadata":{"files":{"readme":"README.rst","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2008-12-22T00:54:53.000Z","updated_at":"2019-08-13T13:49:24.000Z","dependencies_parsed_at":"2024-10-27T17:23:49.689Z","dependency_job_id":"a924f92a-110b-482f-a95e-b629c2c814c6","html_url":"https://github.com/alecthomas/flam","commit_stats":{"total_commits":111,"total_committers":3,"mean_commits":37.0,"dds":"0.12612612612612617","last_synced_commit":"2b8b02bb3ab235dde705a39fb6544a227dc2f67a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fflam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fflam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fflam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fflam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecthomas","download_url":"https://codeload.github.com/alecthomas/flam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246853690,"owners_count":20844625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T16:06:35.561Z","updated_at":"2026-01-12T02:11:41.511Z","avatar_url":"https://github.com/alecthomas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"A minimalist Python application framework\n=========================================\n\nFlam provides utility functions and classes used in 99% of applications (that I\nwrite).\n\nCurrently it provides:\n\n  - Application bootstrapping.\n  - Flag management.\n  - Command-line commands.\n\nApplication bootstrapping\n-------------------------\nTypically all an application writer wants to do is run a main() function,\nregister some flags, maybe take some action based on a command-line argument,\nset up logging defaults.\n\nReleasepeace's \"run\" command takes care of all this:\n\n  from flam import define_flag, flags, command, run\n\n  define_flag('-l', '--long_listing', help='long listing', default=False, action='store_true')\n\n  @command\n  def ls(path):\n    if flags.long_listing:\n      ...\n    else:\n      ...\n\n  def main(args):\n    # Some initialisation code here...\n    ...\n\n  if __name__ == '__main__':\n    run(main)\n\nrun() will parse command line flags, call main with any remaining arguments,\nthen finally dispatch to any commands registered with @command, in this case\n\"ls\".\n\nCommand Management\n------------------\nFlam provides support for both command-line flags and commands, where commands\nare actions passed on the command-line.\n\nFor example, the following will register an \"init\" command:\n\n  @command\n  def init(path):\n    \"\"\"Initialise the system.\"\"\"\n    db = sqlite3.open(path)\n    ...\n\nWhich can then be used like so:\n\n  $ python myapp.py init somefile.db\n\nHelp is automatically generated by inspecting the registered command functions:\n\n  $ python myapp.py help\n  Usage: myapp.py [\u003coptions\u003e] \u003ccommand\u003e ...\n\n  Commands:\n    help  [\u003ccommand\u003e]\n      Display help on available commands.\n\n    init \u003cpath\u003e\n      Initialise the system.\n\n  Options:\n    -h, --help       show this help message and exit\n    --flags=FILE     load flags from FILE\n    --logging=LEVEL  set log level to debug, info, warning, error or fatal\n                    [warning]\n\nFlag Management\n---------------\nRegister new flags with ``flam.define_flag()``. This is an alias for\n``optparse.OptionParser.add_option()`` and thus accepts exactly the same arguments.\n\nThe underlying ``optparse.OptionParser`` object is exposed as ``flam.flag_parser``.\n\nCall ``flam.parse_args()`` to parse command-line arguments. Defaults to\nparsing sys.argv[1:].\n\n``flam.flags`` is an optparse.Values() object that will contain the parsed\nflag values.\n\nThe --flags=FILE flag can be used to load flag values from a file consisting of\n\"key = value\" lines. Both empty lines and those beginning with # are ignored.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecthomas%2Fflam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecthomas%2Fflam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecthomas%2Fflam/lists"}