# weather-query
크라우드웍스 사전과제
## 환경 설정
### 1. install [rye](https://github.com/mitsuhiko/rye)
[install documentation](https://rye-up.com/guide/installation/#installing-rye)
Linux
```bash
curl -sSf https://rye-up.com/get | bash
echo 'source "$HOME/.rye/env"' >> ~/.bashrc
source ~/.bashrc
```
Windows
see [install documentation](https://rye-up.com/guide/installation/)
### 2. Create virtual environment
1 pyproject.toml 파일을 만들고 다음과 같이 작성합니다.
```toml
# pyproject.toml
dependencies = [
"jinja2>=3.1.3",
"flake8>=7.1.1",
"black>=24.10.0",
"fastapi>=0.115.0",
"isort>=5.13.2",
"uvicorn>=0.31.1",
"googletrans==4.0.0rc1",
"ipython>=8.28.0",
"python-dotenv>=1.0.1",
"python-multipart>=0.0.12",
"requests>=2.32.3",
"markdown>=3.7",
]
```
2. 가상환경을 만듭니다.
```bash
rye sync
```
## 코드 구현
```python
import weather_query
result = weather_query.query("내일 서울 날씨 어때?")
print(result)
```
실행하면 다음과 같이 문자열이 출력됩니다.
```
2024년 11월 05일 서울 날씨는 구름조금입니다.
```
## 웹 서버 실행하기
API 서버는 다음과 같이 실행합니다.
```sh
rye run uvicorn app.server:app --host=127.0.0.1 --port=8000 --reload
```
### 폴더 구성
```
├── app
│ ├── __pycache__
│ ├── server.py
│ └── templates
├── main.py
├── pyproject.toml
├── requirements-dev.lock
├── requirements.lock
├── tests
│ ├── __pycache__
│ └── test_query.py
└── weather_forecast
├── __init__.py
├── __pycache__
├── client.py
├── preprocess.py
└── setting.py
```
Raw data
{
"_id": null,
"home_page": null,
"name": "weather-query-test",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "api, weather, forecast",
"author": "Wook Lee",
"author_email": "leewook94@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6c/63/92dc41eaae8c4f3486debc4311824237dbc3767748a8c846bd0c768c1506/weather-query-test-0.0.1.tar.gz",
"platform": null,
"description": "# weather-query\n\ud06c\ub77c\uc6b0\ub4dc\uc6cd\uc2a4 \uc0ac\uc804\uacfc\uc81c\n\n## \ud658\uacbd \uc124\uc815\n\n### 1. install [rye](https://github.com/mitsuhiko/rye)\n\n[install documentation](https://rye-up.com/guide/installation/#installing-rye)\n\nLinux\n```bash\ncurl -sSf https://rye-up.com/get | bash\necho 'source \"$HOME/.rye/env\"' >> ~/.bashrc\nsource ~/.bashrc\n```\n\nWindows \nsee [install documentation](https://rye-up.com/guide/installation/)\n\n\n### 2. Create virtual environment\n\n1 pyproject.toml \ud30c\uc77c\uc744 \ub9cc\ub4e4\uace0 \ub2e4\uc74c\uacfc \uac19\uc774 \uc791\uc131\ud569\ub2c8\ub2e4.\n```toml\n# pyproject.toml\ndependencies = [\n \"jinja2>=3.1.3\",\n \"flake8>=7.1.1\",\n \"black>=24.10.0\",\n \"fastapi>=0.115.0\",\n \"isort>=5.13.2\",\n \"uvicorn>=0.31.1\",\n \"googletrans==4.0.0rc1\",\n \"ipython>=8.28.0\",\n \"python-dotenv>=1.0.1\",\n \"python-multipart>=0.0.12\",\n \"requests>=2.32.3\",\n \"markdown>=3.7\",\n]\n```\n\n2. \uac00\uc0c1\ud658\uacbd\uc744 \ub9cc\ub4ed\ub2c8\ub2e4.\n\n```bash\nrye sync\n```\n\n## \ucf54\ub4dc \uad6c\ud604\n```python\nimport weather_query\n\nresult = weather_query.query(\"\ub0b4\uc77c \uc11c\uc6b8 \ub0a0\uc528 \uc5b4\ub54c?\")\n\nprint(result)\n\n```\n\uc2e4\ud589\ud558\uba74 \ub2e4\uc74c\uacfc \uac19\uc774 \ubb38\uc790\uc5f4\uc774 \ucd9c\ub825\ub429\ub2c8\ub2e4.\n\n```\n2024\ub144 11\uc6d4 05\uc77c \uc11c\uc6b8 \ub0a0\uc528\ub294 \uad6c\ub984\uc870\uae08\uc785\ub2c8\ub2e4.\n```\n\n## \uc6f9 \uc11c\ubc84 \uc2e4\ud589\ud558\uae30\nAPI \uc11c\ubc84\ub294 \ub2e4\uc74c\uacfc \uac19\uc774 \uc2e4\ud589\ud569\ub2c8\ub2e4.\n```sh\nrye run uvicorn app.server:app --host=127.0.0.1 --port=8000 --reload\n```\n\n### \ud3f4\ub354 \uad6c\uc131\n```\n\u251c\u2500\u2500 app\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __pycache__\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 server.py\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 templates\n\u251c\u2500\u2500 main.py\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 requirements-dev.lock\n\u251c\u2500\u2500 requirements.lock\n\u251c\u2500\u2500 tests\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __pycache__\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 test_query.py\n\u2514\u2500\u2500 weather_forecast\n \u251c\u2500\u2500 __init__.py\n \u251c\u2500\u2500 __pycache__\n \u251c\u2500\u2500 client.py\n \u251c\u2500\u2500 preprocess.py\n \u2514\u2500\u2500 setting.py\n```\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "forecast weather",
"version": "0.0.1",
"project_urls": null,
"split_keywords": [
"api",
" weather",
" forecast"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "46cbb0b9e484842f23607f9674d6edeed8c71e99f22b082640d641d81f5578a6",
"md5": "2b82b9fb45509537e2fae9b566b94dd0",
"sha256": "5f9925d5b6684972946b87884f3ad4c53f8aed64aebeb9e1c640d1cb221fdce5"
},
"downloads": -1,
"filename": "weather_query_test-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2b82b9fb45509537e2fae9b566b94dd0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8336,
"upload_time": "2024-11-04T06:25:55",
"upload_time_iso_8601": "2024-11-04T06:25:55.637223Z",
"url": "https://files.pythonhosted.org/packages/46/cb/b0b9e484842f23607f9674d6edeed8c71e99f22b082640d641d81f5578a6/weather_query_test-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6c6392dc41eaae8c4f3486debc4311824237dbc3767748a8c846bd0c768c1506",
"md5": "bac4c706cd71309af285272212c965d6",
"sha256": "79a231c6c6d6c3b569ff6690643a6bc371894ca312bde8e20df1c511a5e8f23d"
},
"downloads": -1,
"filename": "weather-query-test-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "bac4c706cd71309af285272212c965d6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3776,
"upload_time": "2024-11-04T06:25:57",
"upload_time_iso_8601": "2024-11-04T06:25:57.498905Z",
"url": "https://files.pythonhosted.org/packages/6c/63/92dc41eaae8c4f3486debc4311824237dbc3767748a8c846bd0c768c1506/weather-query-test-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-04 06:25:57",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "weather-query-test"
}