Metadata-Version: 2.1
Name: relative-addons-system
Version: 2.4.4
Summary: Easier way to manage your project addons
Home-page: 
Author: YoungTitanium
Author-email: "kuyugama(youngtitanium)" <kuyugamas@gmail.com>
License: Copyright 2022 kuyugama(youngtitanium)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
        
Project-URL: Homepage, https://github.com/youngtitanium/RelativeAddonsSystem
Keywords: addons,system,relative,requirement,dependency,addon
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE

## Relative Addons System
**This is special system which allow you to manage your addons**

**Addon** is a folder with ``addon.json`` and ``__init__.py`` files

**_Example:_**
```python
from pathlib import Path

from RelativeAddonsSystem import RelativeAddonsSystem, Addon, AddonMeta

# Init addons system
system = RelativeAddonsSystem(Path(__file__).parent / "addons")

# return list of Addon objects
addons: list[Addon] = system.get_all_addons()

if len(addons) < 1:
    print("No addons found")
else:
    for addon in addons:
        # loaded meta(AddonMeta) from ADDON_DIR/addon.json
        meta: AddonMeta = addon.meta
        
        print("Working with", meta.name, "at", addon.path.absolute())
        
        # Check dependencies
        if not addon.check_requirements(alert=False):
            print("Installing addon dependencies")
            # Install dependencies
            installed: list[str] = addon.install_requirements()
            print("Successfully installed addon dependencies (", ", ".join(installed), ")")
        else:
            print("Addon dependencies already satisfied")
        
        # Get addon module
        module = addon.module # ADDON_DIR / __init__.py module
        ...
```

**In this example, we have listed all addons and install their dependencies if they are not installed**

**You can also disable or enable addons:**

```python
from pathlib import Path

from RelativeAddonsSystem import RelativeAddonsSystem, Addon

# Init addons system
system = RelativeAddonsSystem(Path(__file__).parent / "addons")

addons: list[Addon] = system.get_enabled_addons() # get all enabled addons

if len(addons) > 0:
    addon: Addon = addons[0] # first addon from list
    addon.disable() # disable addon
    
    ...
    
    addon.enable() # enable addon
```

**_Or import, reimport(Useful when you updated your addon) module:_**
```python
from pathlib import Path

from RelativeAddonsSystem import RelativeAddonsSystem, Addon

# Init addons system
system = RelativeAddonsSystem(Path(__file__).parent / "addons")

addons: list[Addon] = system.get_enabled_addons() # get all enabled addons

if len(addons) > 0:
    addon: Addon = addons[0] # first addon from list
    
    module = addon.module
    
    ... # Work with module

    # Reimport module
    module = addon.reload_module()
    
    ... # Work with module
```

**_You can also change the meta in your code:_**
```python
from pathlib import Path

from RelativeAddonsSystem import RelativeAddonsSystem, Addon, AddonMeta

# Init addons system
system = RelativeAddonsSystem(Path(__file__).parent / "addons")

addons: list[Addon] = system.get_enabled_addons() # get all enabled addons

if len(addons) > 0:
    addon: Addon = addons[0] # first addon from list
    
    meta: AddonMeta = addon.meta

    meta.set("version", "1.2")

    meta.save()
```
