Skip to content

Latest commit

 

History

History
218 lines (146 loc) · 10.5 KB

README.zh-TW.md

File metadata and controls

218 lines (146 loc) · 10.5 KB

throweagile監控

彎曲監測

CI/CD CI - TestCD - Build
包裹 PyPI - VersionPyPI - Python Version
Hatch projectcode style - blacktypes - MypyLicense - MITGitHub Sponsors

一個為創建儀表板的Web應用程序tre縮.

執行摘要

將代碼啟動並在您自己的系統上運行。

筆記: 這pyproject.toml文件應該在存儲庫的根部!

筆記:確保您滿足要求.

  1. 安裝過程:

    $ cd threagile-monitoring # start at sub-directory of the repository where the requirements.txt file is kept.
    $ hatch --version # optional, will print the version of our package to the terminal without modifying the source directory (e.g. `0.0.1`).
    # Without hatch: $ python src/threagile_monitoring/app.py
    $ hatch env create # optional, if the default env already exists you will be told
    $ hatch shell # spawn a shell within an environment
    (.hatch) $ pwd # go to the directory where pyproject.toml resides
    (.hatch) $ pip install -e . # install the package in editable mode
    (.hatch) $ cd threagile-monitoring # go to the sub-directory of the repository where the requirements.txt file is kept.
    (.hatch) $ pip show threagile-monitoring # optional, shows the project details, here 'threagile-monitoring', from `pyproject.toml`
    # Name: threagile-monitoring
    # Version: 0.0.1 # it takes this from src/threagile_monitoring/__about__.py
    # ...
    (.hatch) $ python -c "import sys;print(sys.executable)" # optional, see where your environment's python is located
    (.hatch) $ pip install --upgrade pip # optional, the `run` command allows you to execute commands in an environment as if you had already entered it.
    (.hatch) $ pip install -r requirements.txt # pipx won't do this
    (.hatch) $ git tag # check if you already have a verion tagged
    (.hatch) $ git tag -a v0.0.1 -m "Initial release" # optional, if you have no tags yet
    # setuptools_scm displays the version of our package and perform any side-effects like writing to a file. (here: `__about__.py`)

    **將您的網站與WebPack打包:**一旦擁有足夠好的網站,您就必須將應用程序與WebPack打包。此包裝文件夾在.gitignore為了避免致力於git。

    現在所有設置都應該準備就緒,因此您必須要做的所有設置: 1)(.hatch) $ cd src/threagile_monitoring2)(.hatch) $ npm install3)(.hatch) $ npm run build

    這將創建vendors.#####.jsmain.#####.js文件 - 包含所有組件 - 在/src/threagile_monitoring/static/js/.

    使用WebPack開發:如果您仍在開發網站,則單獨的終端會話,遵循上述安裝過程後,執行此操作: 1)cd ../#轉到存儲庫的根 2)hatch shell3)(.hatch) $ cd threagile-monitoring/src/threagile_monitoring4)(.hatch) $ sudo chown -R $USER:$(id -gn $USER) ~/.npm5)(.hatch) $ npm install6)(.hatch) $ npm run watch

    這將 - 在單獨的終端會話中(即background) - 不斷將更改加載到適當的文件中,而您可以繼續進行這些更改 - 在初始終端會話中(即foreground)。因此,您不必在每次編輯後都必須構建來源,它會自動照顧!

    要查看更改,只需保存並重新加載導航器(通常使用F5)。

    使用Onlook進行UI開發

    Onlook是與您的項目集成的交互式UI開發的強大工具。

    1. 集成設置:

      • 確保您的前端運行(npm run watch)
      • 啟動您的後端服務器(python app.py)
      • 在自己的應用程序中啟動Onlook
      • 將Onlook連接到您的跑步前端
    2. 最佳實踐:

      • 進行小小的增量改變
      • 立即在瀏覽器中進行測試更改
      • 提交之前審查生成的代碼
      • 保持Onlook和您的前端同步
      • 使用版本控制進行所有Onlook生成的更改
    3. 配置:

      • Onlook將檢測您的項目的結構
      • 它將直接更改您的源文件
      • 由於WebPack手錶而立即反映更改
      • 您的後端API在開發過程中仍然可以訪問

    筆記:始終在開始Onlook開發之前確保您的前端運行。這可以實時預覽您的更改。

    確保在使用後端函數測試時運行網頁,如下: 1)cd ../../../#轉到存儲庫的根 2)hatch shell3)(.hatch) $ cd threagile-monitoring/src/threagile_monitoring4)(.hatch) $ python app.py

    測試

    以這種方式測試應用程序(前端): 1)cd ../#轉到存儲庫的根 2)hatch shell3)(.hatch) $ cd threagile-monitoring/src/threagile_monitoring4)(.hatch) $ npm install5)(.hatch) $ npm test6)(.hatch) $ npm test -- --coverage

    跑步:

    如果不開發,請以這種方式運行應用程序(同時和前端):

    $ hatch run python src/threagile_monitoring/app.py # starts the app 
    
  2. 軟件依賴性

  3. 最新版本

  4. API參考

  5. 構建和測試:

    要構建您的代碼,請使用:

    $ cd threagile-monitoring
    $ hatch build

    要使用AI進行拉動請求評論,請使用:

    https://app.coderabbit.ai/dashboard(用途phpstan.neon)

    要運行該應用程序,請使用:

    Linux:

    $ export SECRET_KEY="secret"

    視窗:

    $ setx SECRET_KEY secret

    然後:

    $ cd threagile-monitoring
    # Without hatch: $ python src/threagile_monitoring/app.py
    $ hatch run python src/threagile_monitoring/app.py

    然後,導航到http://127.0.0.1:5000/在您的網絡瀏覽器中。

    要運行測試,請使用:

    $ cd threagile-monitoring
    $ pip install pytest # optional
    $ pytest tests/

API文檔

導航到http://127.0.0.1:5000/docs在您的網絡瀏覽器中,或從中下載OpenApi.jsonhttp://127.0.0.1:5000/openapi.json.

指標

讓像Prometheus Scrape這樣的工具http://127.0.0.1:9464/metrics.

新的

目錄

安裝

pip install threagile-monitoring

版本來源

  • 孵化-VC版本源插件使用git標籤確定項目版本

環境

  • 在獨立中整齊地定義hatch.toml
  • test矩陣使用孵化器插件以在Docker容器中運行每個環境;可以在測試GitHub工作流程

建造

  • 所有構建目標都使用孵化-VC構建掛鉤插件來運送_version.py文件,因此可以在運行時使用該版本
  • 車輪使用孵化 - 摩林構建掛鉤插件以首先使用mypyc
  • 建造github工作流程顯示瞭如何:
    • 使用cibuild輪為每個平台分發二元車輪
    • 使用應用程式建立目標以建立每個平台的獨立分佈

執照

threagile-monitoring根據執照。

100-簡介

README.md

200-要求

README.md

300-構建我們的應用程序

README.md

400-結論

README.md