Metadata-Version: 2.4
Name: autoconfigpy
Version: 0.2.3
Summary: Simple JSON config and data storage for Python apps, games, bots, tools, and servers.
Author-email: Daniel <tolmmu979@gmail.com>
Maintainer-email: Daniel <tolmmu979@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/tolmmu979/autoconfigpy
Project-URL: Repository, https://github.com/tolmmu979/autoconfigpy
Project-URL: Issues, https://github.com/tolmmu979/autoconfigpy/issues
Project-URL: PyPI, https://pypi.org/project/autoconfigpy/
Keywords: config,json,settings,save-file,games,apps,bots,servers,data-storage,configuration
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

````md
# AutoConfigPy

AutoConfigPy is a lightweight JSON config and data-storage library for Python apps, games, bots, tools, and servers.

It automatically handles creating folders, creating JSON files, reading data, writing data, adding numbers, incrementing values, appending list items, removing list items, backups, defaults, and update checks.

## Installation

```bash
pip install autoconfigpy
````

## Quick Example

```python
from autoconfigpy import DataFile

data = DataFile("data/players.json")

data.write("players.player1.coins", 100)
data.add("players.player1.coins", 50)
data.increment("players.player1.level")

data.append("players.player1.inventory", "gold_sword")
data.append("players.player1.inventory", "health_potion")
data.remove("players.player1.inventory", "health_potion")

print(data.read("players.player1.coins", 0))
print(data.read("players.player1.level", 1))
print(data.read("players.player1.inventory", []))
```

Output:

```text
150
1
['gold_sword']
```

Created JSON:

```json
{
    "players": {
        "player1": {
            "coins": 150,
            "level": 1,
            "inventory": [
                "gold_sword"
            ]
        }
    }
}
```

## DataFile Usage

`DataFile` is the easiest way to work with one JSON file.

```python
from autoconfigpy import DataFile

data = DataFile("data/save.json")

data.write("game.score", 100)
data.add("game.score", 25)
data.subtract("game.score", 10)

score = data.read("game.score", 0)

print(score)
```

## Function-Style Usage

You can also use AutoConfigPy without creating a `DataFile` object.

```python
from autoconfigpy import write_data, read_data, add_data, append_data

write_data("data/players.json", "players.player1.coins", 100)
add_data("data/players.json", "players.player1.coins", 25)
append_data("data/players.json", "players.player1.inventory", "gold_sword")

coins = read_data("data/players.json", "players.player1.coins", 0)

print(coins)
```

Output:

```text
125
```

## Config Usage

Use `Config` when you want defaults, required keys, environment loading, backups, and manual save control.

```python
from autoconfigpy import Config

cfg = Config("settings.json", defaults={
    "window.width": 1280,
    "window.height": 720,
    "theme": "dark",
})

print(cfg.get("window.width"))

cfg.set("theme", "light")
cfg.save()
```

Created JSON:

```json
{
    "window": {
        "width": 1280,
        "height": 720
    },
    "theme": "light"
}
```

## Lists

AutoConfigPy can manage lists inside JSON files.

```python
from autoconfigpy import DataFile

data = DataFile("data/save.json")

data.append("player.inventory", "sword")
data.append("player.inventory", "shield")
data.remove("player.inventory", "shield")

print(data.read("player.inventory", []))
```

Output:

```text
['sword']
```

## Backups

```python
from autoconfigpy import Config

cfg = Config("settings.json")
backup_path = cfg.backup()

print(backup_path)
```

## Required Keys

```python
from autoconfigpy import Config

cfg = Config("settings.json")

api_key = cfg.require("api.key")
```

If the key is missing, AutoConfigPy raises an error.

## Update Check

AutoConfigPy can check PyPI and tell the user if a newer version is available.

```python
from autoconfigpy import check_for_updates

check_for_updates()
```

Example output when an update exists:

```text
Update available for autoconfigpy: 0.2.1 -> 0.2.2
Run: python -m pip install --upgrade autoconfigpy
```

Example output when current:

```text
autoconfigpy is up to date. Current version: 0.2.2
```

This does not install updates automatically. It only tells the user what command to run.

## License

AutoConfigPy is released under the MIT License.

```
```
