Metadata-Version: 2.4
Name: autoconfigpy
Version: 0.2.0
Summary: Simple JSON config and data storage for Python apps, games, bots, tools, and servers.
Author-email: Alex <tolmmu979@gmail.com>
Maintainer-email: Alex <tolmmu979@gmail.com>
License: MIT License
        
        Copyright (c) 2026 AutoConfigPy Team
        
        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/tolmmu979/autoconfigpy
Project-URL: Repository, https://github.com/tolmmu979/autoconfigpy
Project-URL: Issues, https://github.com/tolmmu979/autoconfigpy/issues
Keywords: config,json,settings,save-file,games,apps,data-storage
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# AutoConfigPy

AutoConfigPy is a small Python library for JSON config files and simple game/app data.

It is made for Python apps, games, launchers, bots, tools, and servers where you want clean settings and save files without rewriting JSON boilerplate every time.

## Install

For local testing from this folder:

```bash
pip install -e .
```

After publishing to PyPI:

```bash
pip install autoconfigpy
```

## Fast Data API

This is the simple API for saving player coins, usernames, settings, and other small data.

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

write_data("data/players.json", "players.alex.coins", 100)
add_data("data/players.json", "players.alex.coins", 50)

coins = read_data("data/players.json", "players.alex.coins", 0)
print(coins)  # 150
```

That automatically creates `data/players.json`:

```json
{
    "players": {
        "alex": {
            "coins": 150
        }
    }
}
```

## DataFile API

Use `DataFile` when you want to keep using the same JSON file.

```python
from autoconfigpy import DataFile

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

players.write("players.alex.username", "Alex")
players.write("players.alex.coins", 100)
players.add("players.alex.coins", 25)
players.subtract("players.alex.coins", 10)

print(players.read("players.alex.coins", 0))
print(players.exists("players.alex.username"))
```

## Config API

Use `Config` for app settings and more controlled config files.

```python
from autoconfigpy import Config

cfg = Config("settings.json", defaults={
    "app.name": "My App",
    "window.width": 900,
    "window.height": 600,
    "theme": "dark",
    "volume": 80,
})

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

cfg.set("theme", "light")
cfg.set("player.coins", 250)
cfg.save()
```

## Features

- Auto-creates missing JSON files
- Auto-creates missing folders
- Dot-path keys like `player.coins`
- Read, write, add, subtract, delete, and exists helpers
- Defaults that do not overwrite user settings
- Required keys
- Backups
- Environment variable loading
- Autosave mode
- Reset one key or the whole config
- Dictionary-style access
- No required dependencies

## Examples

Run these from the project folder:

```bash
python examples/player_coins.py
python examples/basic_usage.py
python examples/server_config.py
python examples/quick_data_store.py
```

## Test

```bash
python -m unittest discover tests
```

## Build for PyPI

Install build tools:

```bash
python -m pip install --upgrade build twine
```

Build the package:

```bash
python -m build
```

Check it:

```bash
python -m twine check dist/*
```

Upload to TestPyPI first:

```bash
python -m twine upload --repository testpypi dist/*
```

Then upload to real PyPI:

```bash
python -m twine upload dist/*
```

## Important before publishing

Open `pyproject.toml` and change the GitHub links if your repository URL is different.

If PyPI says the name is taken, change this line:

```toml
name = "autoconfigpy"
```

For example:

```toml
name = "autoconfigpy-alex"
```

The import can still stay:

```python
from autoconfigpy import Config
```

## License

MIT
