Skip to main content

discord.guild[mo9mo9study]でDBと連携するために使用するモジュール

Project description

当リポジトリの自作パッケージを使うための準備

pip install mo9mo9db
# https://pypi.org/project/mo9mo9db/

# このパッケージを使用する側のディレクトリに.envのファイルを作成する
# .envファイル内に以下のDB情報とパラメータ情報を入力することが必須
vi .env
> .env ------------------------
###==============================
#MYSQL credential
###==============================
DB_USER=''
DB_PASSWORD=''
DB_HOST=''
DB_PORT=''
DB_DATABASE=''
DB_ECHO=''
------------------------------

about

ddl/
    master/create_table.sql : DDL文。これをDBに流し込めば本番環境と同じ状態になるよう保つ。
    patch/ : TBD。migrationの仕組みが導入されるまで、DBスキーマ変更用DDLはここに置く。レビュー完了後masterのDDLにも反映する。
ERD/
    draw.ioで書かれたERD

commit時のローカル運用

  • ディレクトリ[.githooks/]にてcommitをトリガーに動く処理を記載しています
    • pythonの[autopep8]と[flake8]をcommit対象のファイルに対して実行します
  • これを活用することでpepに準拠するように自動修正やエラー箇所を出力してくれます
  • ファイル[.githooks/pre-commit]はファイル[.pre-commit-config.yaml]を元に作成されています
# pre-commitを活用するための準備
## git configのコマンドを用いて、.git/hooksのパスを変更します
git config core.hooksPath .githooks

Future

Githubのタグ付ルールとpypiのバージョン一致について

  • バージョン記法:x.y.z
バージョン 名称 説明
x メジャーバージョン ほとんど使わないと思われる、破壊的な機能変更の場合に更新
y マイナーバージョン pypiにアップロードする。テーブルの追加など本番環境で適用される機能が新たに追加がされた場合に更新
z リビジョン? test.pypiにアップロードする時。試験的な変更があった時
  • Githubのタグ付方法
# v0.0.20のタグを付与する場合
# 通常のpushではtagは付与されないので別途pushが必要
git tag v0.0.20
git push origin v0.0.20

このパッケージを更新(upload)する方法

共通

## pythonの環境を作成・接続
python3 -m venv venv
source venv/bin/activate
## アップロード用のパッケージインストール
pip install wheel twine

pypiの本番環境にuploadする手順

# (必須)setup.cfgのバージョンを更新すること
rm dist/*
python setup.py bdist_wheel
twine upload --repository pypi dist/*

test.pypiの開発環境にuploadする手順

## pypiへの準備・アップロード
python setup.py bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
  • test.pypiからパッケージインストール
# ※ pip install時にパッケージが見つからないとエラーが出力された場合、
# ※ 個別にpip installしてから改めて自作パッケージをインストールする.
# ※ pip install -U PyMySQL
# バージョンを指定する必要がある.
# test.pypiのURL
# https://test.pypi.org/project/mo9mo9db/
pip install -i https://test.pypi.org/simple/ mo9mo9db

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mo9mo9db-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file mo9mo9db-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mo9mo9db-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for mo9mo9db-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d243482deea9f129e986fc6463ecb39cfa3d825bf2ed777fa1ad80cb225584f4
MD5 dc224a45f21df4739aa032308536e08a
BLAKE2b-256 97099dbd704f70f7d897cc3532a1fa952eb580567eb29d8b7da472d60e42cd4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page