1. FeiWongReed
  2. agatsuma

Wiki

Clone wiki

agatsuma / Current_refactoring_tasks

  1. Move core to agatsuma.
  2. Add agatsuma.core_extensions (or core_mixins)
  3. Reorder code according to Definitions
  4. Use static members for spell configuration. Docstring should be used instead of "description" key. And abstract interfaces should be used instead of provides/requires keys.
  5. Add spell name autogeneration (with overriding support)
  6. Implement different spell loading strategies (implement BaseStrategy class with GreedyStrategy, DependsTreeStrategy and FunctionalityStrategy subclasses)
  7. Implement support of independent library extensions in eggs. Move agatsuma.web to eggs
  • Masterspell support: use special spell to implement main application entry point.
  • Spellmaps,
  • Spellmap generation script (as entry point in agatsuma itself, like agatsuma:genmap)

Different version of roadmap:

  1. Remake project struct:
├── core -> /dev/null
│   ├── base_core.py  -> /core.py
│   └── mp_core.py -> /core_extensions/pythonmp/extension.py
├── doc  -> /../
├── elements
│   ├── atom.py
│   └── named_const.py
├── enumerator.py -> /spellbook.py #merge files
├── errors -> /dev/null
│   ├── abstract_function_call.py -> /dev/null
│   └── __init__.py -> /dev/null
├── interfaces -> /interfaces/agatsuma #it must be spells interfaces, not a general interfaces
│   ├── abstract_core_extension.py #we can keep it, of cause
│   ├── abstract_spell.py #parent of each spell, so, we an keep it too
│-> s/i_//
│   ├── i_filtering_spell.py 
│   ├── i_internal_spell.py
│   ├── i_model_spell.py
│   ├── i_pool_event_spell.py
│   ├── i_settings_backend_spell.py
│   ├── i_setup_spell.py
│   ├── i_storage_spell.py
│   └── settings_backend.py
├── log.py -> /spells/agatsuma/pythonlog
├── minicache.py -> /elements or /primitive
├── mp_log_handler.py -> /core_extensions/pythonmp/
├── settings.py -> split into /spells/agatsuma/jsonsettingsreader AND /spellbook.py
├── setup_helpers.py -> /third_party/
├── spellbook.py
├── spell_helpers.py -> spellbook.py
├── spells
│   ├── common -> agatsuma
│   │   ├── core_filters.py
│   │   ├── core_settings.py
│   │   ├── core_spell.py
│   │   ├── settings_backends
│   │   │   ├── __init__.py
│   │   │   ├── memcached_backend.py
│   │   │   └── mongo_backend.py
│   │   └── storage_drivers
│   │       ├── core_memcached.py
│   │       ├── core_mongo.py
│   │       ├── core_sqla.py
│   │       └── __init__.py
│   ├── __init__.py
│   └── supplemental -> /dev/null
│       ├── __init__.py
│       └── mp -> /core_extensions/pythonmp/spells #will be imported into agatsuma.spells.core_extensions.pythonmp
│           └── mp_core_spell.py

├── third_party
│   └── distribute_setup.py
└── web -> /spells #remove for some time, for reworking

It will be:

├── core.py
├── core_extensions
│   └── python_mp
│       ├── mp_log_handler.py #perhaps, need to rename
│       ├── extension.py #mp_core.py
│       └── spells
│           └── mp_core_spell.py
│
├── elements
│   ├── atom.py
│   ├── thread-safe_dict+shit.py #minicache.py
│   └── named_const.py
│
├── spellbook.py # spellbook.py + spell_helpers.py + enumerator.py + settings.py
│
├── interfaces
│   └── agatsuma
│       ├── abstract_core_extension.py #we can keep it, of cause
│       ├── abstract_spell.py #parent of each spell, so, we an keep it too
│       ├── filtering_spell.py 
│       ├── internal_spell.py
│       ├── model_spell.py
│       ├── pool_event_spell.py
│       ├── settings_backend_spell.py
│       ├── setup_spell.py
│       ├── storage_spell.py
│       └── settings_backend.py
│
├── spells
│   └── agatsuma
│       ├── json_settings_reader.py #part of settings.py
│       ├── python_log.py #log.py
│       ├── core_filters.py
│       ├── core_settings.py
│       ├── core_spell.py
│       ├── settings_backends
│       │   ├── memcached_backend.py
│       │   └── mongo_backend.py
│       └── storage_drivers
│           ├── core_memcached.py
│           ├── core_mongo.py
│           └── core_sqla.py
│
├── third_party
│   ├── setup_helpers.py #setup_helpers.py
│   └── distribute_setup.py
│
└── web -> /spells #remove for some time, for reworking
  1. 1
    1. Move files
    2. Rewrite spellbook.py + spell_helpers.py + enumerator.py + pieces of settings.py in ONE file - spellbook.py OR spellbook.py + settings.py
      1. Remove all files-oriented logic. We need just 2 steps: appending paths into pythonpath and import spells and interfaces from it.
      2. SpellBook helpers must be in SpellBook module because of its size.
      3. Map processing etc will be in the SpellBook
      4. Spells Settings processing in spellbook
      5. WARNING!!! SpellBook must be created in the core by calling its constructor with CURRENT(saves in the db) settings OR config file(if it's w/o db mode or first start). We need to get a dict SPELL_NAME:DICT_OF_VARIABLES.
    3. Write interface ISettingReaderSpell
    4. Write spell JSONSettingsReaderSpell as implementation of ISettingReaderSpell and move all JSON(backend)-specific logic from settings.py into it.
    5. Write interface ILoggingSystemSpell
    6. Write PythonLoggingSystemSpell as implementation of ILoggingSystemSpell and move log.py logic into it.
    7. Review Core Extensions system and make it more.. more dynamic. Make it able to use different extensions w/o pain in the ass.
    8. Review Python MP core extension.
    9. Review minicache.py
    10. Review basic interfaces of Agatsuma(remove most of 'em, but adding with other system, with namespace)
    11. Review basic spells of Agatsuma(remove some, some reimplement with different ideas)
  2. Eliminate agatsuma.errors namespace Will be done in 1.
  3. Move setup_helpers to agatsuma.adaptations.distribute (preferrable) No needed
  4. Rename elements to primitives. Maybe extract them to separate project. Optional. As you wish.
  5. Move core to agatsuma. Done in 1.
  6. Add agatsuma.core_extensions (or core_mixins) Done in 1.
  7. Reorder code according to Definitions Done in 1.
  8. Rewrite settings system for using static members as spell configuration variables. Class docstring will be description.
  9. User dependencies OR deps static member as dict of dependencies, where key will be a key, that obtain a result of deps resolving, value - list with one Atom or just Atom. For example:
class FooBarSpell(...):
    deps = {
            "plugins": [ChainedAtom.Foo.IFooBarPluginSpell],
            "backend": ChainedAtom.Agatsuma.IKeyValueStorageBackendSpell,
            "jsonreader": ChainedAtom.Agatsuma.JsonSettingsReader,
           }

After spell deps calculating, all needed spells will be in self.spells special dict(class for access via dot) by key. In this example: plugins - will be collection of implementations of IFooBarPluginSpell from Foo sub-collection of packages(agatsuma.interfaces.foo) interfaces; backend - one implementation of IKeyValueStorageBackendSpell interface from standart agatsuma interfaces; jsonreader - certain spell by name - JsonSettingsReader.

  1. Add ChainedAtom class to elements. It returns ChainedAtom on each getatt calling and appends new getattr value to result with '_' separator. ChainedAtom.A.B.C -> "A_B_C".
  2. Add spell name autogeneration by namespace and spell name(all after agatsuma.spell.)
  • Discuss about "why yohoho idea of million and one spells loading strategies dont works in real".
  • Masterspell support: use special spell to implement main application entry point.
  • Discuss about map of spells. We have problem: current idea - dict of interface:implementation, but we need to make system able to choose special spells for each spell by its name.
  • Discuss about default spells hierarchy.
  • Discuss about web(separated python, tornado, tornado WSGI wrapper) spells hierarchy.
  • Spellmap generation script (as entry point in agatsuma itself, like agatsuma:genmap), spells generation script, projects generation script, config generation script.

And YES, i want my ZOPE-like system

Updated