Giter VIP home page Giter VIP logo

ramseys-party-game's Introduction

Python template Python

VSCode による開発を推奨する.

Python の依存パッケージの管理

requirements.in の更新

  • 必ず手動で更新すること
  • 直接依存しているパッケージのみを書くこと
  • PyPIで利用可能なパッケージのみを書くこと

例) flake8 の バージョンを 1.2.X にしたい場合: flake8~=1.2.3 参考: https://www.python.org/dev/peps/pep-0440/#version-specifiers

以下のコマンドによる更新は禁止

pip freeze > requirements.in
pip freeze >> requirements.in

requirement.txt の更新

以下のコマンドを実行

./scripts/generate_lockfile.sh

最新のテンプレートを適用する

作業ディレクトリをきれいにした状態で以下のコマンドを実行

./scripts/apply_template_updates.sh

requirements.in などに適用された変更が意図したものかを確認してからコミットする.

開発環境の構築

以下の手順を実行することで開発環境を構築できる.

インストール

VSCode の設定

VSCode を起動し,拡張機能のVisual Studio Code Remote Containers をインストールする.

コマンドパレットを開き,

Remote-Containers: Reopen in Container

を選択する.

ローカルでのサーバーの起動

VSCode の Remote Container のターミナルで

functions-framework --target=example --debug

http://localhost:8080 に対してリクエストを送ることができるようになる.

JSON

curl -X POST -H "Content-Type: application/json" localhost:8080 -d '{"api_name": "Solver", "name": "Taro"}'

JSON Lines

DATA='
{"api_name": "Solver", "name": "Taro"}
{"api_name": "Solver", "name": "Jiro"}
{"api_name": "Solver", "name": "Siro"}
'
curl -X POST -H "Content-Type: application/jsonl" localhost:8080 -d "$DATA"

ローカルでのテストの実行

VSCode の Remote Container のターミナルで

python -m unittest

API の定義について

OpenAPI を用いて定義する. schema.yaml に OpenAPI を置く.

以下を実行することで Python の dataclass を利用した表現に変換したものを src/models/ に置く.

./scripts/convert_open_api_to_dataclass.sh

ここで自動生成したコードを直接編集するのは避ける. また,scripts/convert_open_api_to_dataclass.sh は Docker コンテナ内で実行する想定であることに注意!

ramseys-party-game's People

Contributors

ktr-skmt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.