Metadata-Version: 2.4
Name: godlights
Version: 0.1.2
Summary: GL: All In One (aio) - 여러 변수에 같은 attribute/함수를 한 번에 적용하는 유틸
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# godlights

GL: All In One (`aio`) — 여러 변수에 같은 attribute / 같은 함수를 한 번에 적용.

## 설치

```bash
pip install .          # 프로젝트 폴더에서
pip install -e .       # 개발용(편집 즉시 반영)
```

## 사용

```python
from godlights import allinone as aio   # 또는: from godlights import aio

class P:
    def __init__(self, hp): self.hp = hp
    def heal(self, amount):
        self.hp += amount
        return self.hp

a, b, c = P(10), P(20), P(30)

aio.call_all(a, b, c, argument="hp")    # [10, 20, 30]
aio.call_all(a, b, c, "hp")             # [10, 20, 30]

aio.set_all(a, b, c, argument="hp", value=100)   # a.hp = b.hp = c.hp = 100, [100, 100, 100] 반환

x1, x2, x3 = aio.run_func(str.upper, "a", "b", "c")   # 'A', 'B', 'C'
d1, d2 = aio.run_func(lambda x, n: x**n, 2, 3, n=2)   # 4, 9

aio.call_method(a, b, c, method="heal", amount=10)   # [110, 110, 110]

aio.flatten_call([a, b, c], argument="hp")   # [110, 110, 110]

# 결과를 바로 출력하고 싶으면 뒤에 .print()를 붙이면 됨 (출력 후 같은 값을 그대로 반환)
aio.call_all(a, b, c, argument="hp").print()   # 콘솔에 [110, 110, 110] 출력
```

## 함수

- `call_all(*args, argument)` — 각 변수의 `argument` attribute를 리스트로 반환.
- `set_all(*args, argument, value)` — 각 변수의 `argument` attribute에 동일한 `value`를 한 번에 설정하고, 설정된 값들을 리스트로 반환.
- `run_func(function, *args, **kwargs)` — `function(arg)`를 각 arg마다 실행해 리스트로 반환. `kwargs`는 공통 전달.
- `call_method(*args, method, **kwargs)` — 각 변수의 같은 메서드를 동일 kwargs로 호출해 결과를 리스트로 반환.
- `flatten_call(iterable, argument)` — list/tuple 등에 든 변수들의 같은 attribute를 리스트로 반환.

모든 `*args` 헬퍼(`call_all`, `set_all`, `call_method`)는 `argument`/`method`를 키워드로 넘기거나, 마지막 위치 인자로 넘길 수 있습니다.

## `.print()`로 바로 출력하기

위 5개 함수(`call_all`, `set_all`, `run_func`, `call_method`, `flatten_call`)는 모두 일반 `list`처럼 동작하는 `AioList`를 반환합니다. 결과 뒤에 `.print()`를 붙이면 즉시 콘솔에 출력되고, 같은 값이 그대로 반환되어 계속 체이닝하거나 변수에 담을 수 있습니다.

```python
from godlights import AioList

result = aio.call_all(a, b, c, argument="hp").print()   # [110, 110, 110] 출력
assert isinstance(result, AioList)
assert result == [110, 110, 110]
```

## 빌드 / 배포

```bash
pip install build twine
python -m build            # dist/ 에 sdist, wheel 생성
twine upload dist/*        # PyPI 업로드
```

## 테스트

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

## CI/CD

- `.github/workflows/test.yml` — push/PR마다 Python 3.8~3.12에서 pytest 실행
- `.github/workflows/publish.yml` — GitHub Release를 publish하면 빌드 후 PyPI에 업로드 (Trusted Publishing/OIDC 사용, PyPI 프로젝트 설정에서 이 저장소를 trusted publisher로 먼저 등록해야 함)
