Skip to main content

weather-query

크라우드웍스 사전과제

환경 설정

1. install rye

install documentation

Linux

curl -sSf https://rye-up.com/get | bash
echo 'source "$HOME/.rye/env"' >> ~/.bashrc
source ~/.bashrc

Windows
see install documentation

2. Create virtual environment

1 pyproject.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",
]
  1. 가상환경을 만듭니다.
rye sync

코드 구현

import weather_query

result = weather_query.query("내일 서울 날씨 어때?")

print(result)

실행하면 다음과 같이 문자열이 출력됩니다.

2024년 11월 05일 서울 날씨는 구름조금입니다.

웹 서버 실행하기

API 서버는 다음과 같이 실행합니다.

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

Release files for weather-query-test 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weather-query-test 0.0.1
File Size Uploaded
weather-query-test-0.0.1.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for weather-query-test 0.0.1
File Interpreter ABI Platform
weather_query_test-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size:12.1 kB

Release files / weather-query-test-0.0.1.tar.gz

Download URL weather-query-test-0.0.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
79a231c6c6d6c3b569ff6690643a6bc371894ca312bde8e20df1c511a5e8f23d
BLAKE2b-256 checksum
How to use checksums
6c6392dc41eaae8c4f3486debc4311824237dbc3767748a8c846bd0c768c1506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.10

Release files / weather_query_test-0.0.1-py3-none-any.whl

Download URL weather_query_test-0.0.1-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f9925d5b6684972946b87884f3ad4c53f8aed64aebeb9e1c640d1cb221fdce5
BLAKE2b-256 checksum
How to use checksums
46cbb0b9e484842f23607f9674d6edeed8c71e99f22b082640d641d81f5578a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page