Coder Social home page Coder Social logo

openbadgev2baker's Introduction

README

この Repository の構成

+ data
  入力データ置き場。下記の4点のファイルを置いておくこと
  - バッジの画像ファイル png または svg
  - Assertions.csv
  - BadgeClass.csv
  - Issuer.csv
+ output
  ここには何も置かない。手元でこのプログラムを動かす時には、Assertions.csvの行に従って、順番にディレクトリが作られ、
	- Assertion.json
	- BakedBadge.(png|svg)
	が作成される。
 output 直下には、BadgeClass.json と Issuer.json が作成される。
+ tests テスト用データ
	- unittest は、python3標準のunittestを利用している。
	- unittest利用時は、.profileにexport PYTHONPATH=/home/yabuki/src/OpenBadgeV2 などと書いて置くこと
+ Makefile makeコマンドで実行、unittest, clean などが実行できる。使い方は src/OpenBadgeV2 で make とだけ打って helpを出せ
+ BakeBadgeV2.py モジュール。何をやっているかDocstringをつけているから見てください。

追加モジュール

GitHub Actions (以下GHA) で動かすために、ubuntu 20.04 準拠とした。

これらの設定は、手元のpython3.8環境で動かすときに必要です。 GHAで動かす時には、設定済みなので不要です。

apt install python3-rfc3986 python3-iso8601
apt install python3-pip
pip3 openbadges_bakery

使い方

make ファイルをタスク・ランナーとして利用している。

dataディレクトリにデータ一式を用意したら、make run を実行する。すると、output ディレクトリにデータが生成されている。

もう一度実行するなら、make clean でいったんデータを消去してから、再度 make run すること。

手元の環境

下記の4つのファイルを data/ へ置いて、make run を実行する。 csvにはheaderありが必須です。dialect='execl' を推定しているので、windowsのExcelでもいけると思う。

  • Assertions.csv
  • BadgeClass.csv
  • Issuer.csv
  • pngまたは、svgのファイル

そうすると、 output/ に下記のファイルが生成される。

1/Assertion.json BakedBadge.png または、BakedBadge.svg BadgeClass.json Issuer.json

1の部分は、人数分の数字になります。

GHA(GitHub Actions)

現在のworkflowを参照のこと。

開発していた環境

type-hinting は、ubuntu 20.04 環境のデフォルトである python3.8に合わせてある。python 3.9 だと type-hinting の書き方が変わる。mypy + VSCode の Jedi-LSP を使っていた。

CSV 作成時の TIPs

自動的にファイルを生成するので、uplaod 作業を楽にする命名方法がある。

Assertions.csv

  • id の部分の 下位は、数字/Assertion.json 具体例 2/Assertion.json にする ディレクトリを作成してファイル名を変更する手間を考えると合わせるのが得です。

  • badge の部分も上記と同様です。 数字のディレクトリ配下にAssertion.json と BakedBadge.png または、BakedBadge.svg という名前でBadgeができあがります。

BadgeClass.csv

  • 発見したら追記します。

Issuer.csv

  • 発見したら追記します。

Artifact について

本システムで、生成するデータが人数xバッチの画像データ分増えていきます。 無料枠で使っている場合に、Artifact の容量を使い切ると upload できなくなります。

そのため、既定値では 90日間で Artifact のデータが消える設定になっているかと思いますが、その日数を縮めたり、生成する人数やバッチの画像データを小さくするなどの対策が必要かもしれません。

どうしても、大量のデータを作りたいなら、GitHub に課金して、Artifact をupload する先の容量を増やすことも検討してください。

ライセンス

Apache 2.0 ライセンスです。内容は、LICENSE ファイルを参照してください。

Authors

著作権が発生するほどのコントリビュートを本プロジェクトに頂いた場合に、お名前と連絡先(Email address)をAuthors.md に記載していきます。

Thanks

このリポジトリーにあるソフトウェアおよび、GitHub Actions を使った一連のシステムは、LICENCEファイルで定義されたライセンスで公開されます。 この公開に際して、特別な貢献をいただいている方々にたいしての謝辞を Thanks.md に記載いたします。

openbadgev2baker's People

Contributors

ties-makimura avatar ties-taguchi avatar

Watchers

James Cloos avatar  avatar  avatar  avatar Masumi Hori avatar  avatar Seishi Ono avatar

Forkers

ties-makimura

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.