# GenOS 라이브러리 생성

로컬에서도 필요한 패키지를 사용하기 위해 PyPI 패키지 업로드를 해보겠습니다.

## 1. whl 파일 생성

### 1.1 프로젝트 구조 만들기

```
  whl/
  ├── pyproject.toml          # 패키지 설정 파일
  └── simple_add/             # 패키지 폴더 (패키지 이름과 동일)
      └── __init__.py         # 실제 코드
```

다음과 같은 프로젝트 구조를 만듭니다.

### 1.2. pyproject.toml 작성

```
  [build-system]
  requires = ["hatchling"]
  build-backend = "hatchling.build"

  [project]
  name = "simple_add"
  version = "0.1.0"
  description = "A simple addition package"
  requires-python = ">=3.8"

  [tool.hatch.build.targets.wheel]
  packages = ["simple_add"]
```

다음과 같이 pyproject.toml 파일을 작성합니다.

주요 항목:

* name: 패키지 이름
* version: 버전 (업데이트할 때마다 올려야 함)
* requires: 빌드 도구 (hatchling, setuptools 등)
* packages: 포함할 폴더

### 1.3. 코드 작성

```python
  def add(a: str, b: str) -> str:
      """Add two numbers and return the result as a string."""
      return str(int(a) + int(b))
```

`__init__.py` 파일을 작성합니다.

### 1.4. 빌드

<figure><img src="/files/EyT7donoGgQSgIJfUvCU" alt=""><figcaption></figcaption></figure>

`uv build`를 통해 빌드하여 dist폴더에 다음의 파일들을 생성할 수 있습니다.

* simple\_add-0.1.0.tar.gz - 소스 배포판
* simple\_add-0.1.0-py3-none-any.whl - wheel 파일

`uv build`가 아닌

`pip install build` 이후 `python -m build`로 빌드할 수 있습니다.

## 2. whl 파일 업로드

### 2.1. 메뉴에서 리소스 - PyPI 패키지로 진입

<figure><img src="/files/9XEPZDXChjHVt5RtxEqf" alt=""><figcaption></figcaption></figure>

### 2.2. PyPI 패키지 생성 버튼 클릭

<figure><img src="/files/hxXUw0yZq5h0SFagr1Ad" alt=""><figcaption></figcaption></figure>

### 2.3. whl 파일 업로드

<figure><img src="/files/lAwIk2u9njyVHpuZRcsL" alt=""><figcaption></figcaption></figure>

필요한 패키지, 라이브러리의 whl 파일을 업로드 하면 됩니다.

### 2.4. 생성 버튼 클릭

<figure><img src="/files/8jOVtSFImwSyv6m8j8KY" alt=""><figcaption></figcaption></figure>

생성한 패키지를 확인할 수 있습니다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://genos-docs.gitbook.io/default/v1.7.5/basic-tutorials/guides/development/import-genos/create_genos_library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
