Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Refactor to Modular Program #3

Merged
merged 4 commits into from
Feb 2, 2022
Merged

Refactor to Modular Program #3

merged 4 commits into from
Feb 2, 2022

Conversation

Ecss11
Copy link
Member

@Ecss11 Ecss11 commented Feb 2, 2022

The finalized plan of the current project, and it's not expected to be revised in a short period of time.

Description

Convert all python programs to package modules.

Features

  • Now the entry of the program is __main__.py, and the configuration file is all imported from __init__.py.
  • The new structure provides better expansion and flexibility.
  • Clearer naming of packages, blocks, classes, methods, and variables.
  • Simple installation method, just run setup.py with pip command.

Configuration

The config.json needs to include database connection information, as well as the connection API of Websockets and the events that needs to be subscribed.

Subscription

Remember to use asynchronous IO to accelerate the processing speed.

Follow the steps below to add a new event subscription.

  1. Add a new event subscription in the configuration file.
  2. Configure new event handling methods in database.py.
  3. Add a conditional method to the event in __main__.py.

How Has This Been Tested?

30 minutes stability and reconnect testing.

Test Configuration:

  • Hardware: I5-11400 @ 2.60GHz, 16 GB 3200 MHz
  • SDK: Python 3.9

Future Plan

  • Add tests for most modules.
  • Add more subscription event handling.
  • Do a final optimization for performance.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Signed-off-by: Eleven 53446819+voidswordQQJ@users.noreply.github.com

Signed-off-by: Eleven <53446819+voidswordQQJ@users.noreply.github.com>
@Ecss11 Ecss11 added the enhancement New feature or request label Feb 2, 2022
@Ecss11 Ecss11 added this to the stable architecture milestone Feb 2, 2022
@Ecss11 Ecss11 requested review from yinxuea, MicroYF and a team February 2, 2022 03:14
@Ecss11 Ecss11 self-assigned this Feb 2, 2022
Copy link
Member Author

@Ecss11 Ecss11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected the current version number and modified the description of setup.py.

Signed-off-by: Eleven <53446819+voidswordQQJ@users.noreply.github.com>
@Ecss11 Ecss11 merged commit 6052118 into master Feb 2, 2022
@Ecss11 Ecss11 deleted the v2.0.0 branch February 18, 2022 23:45
@Ecss11 Ecss11 restored the v2.0.0 branch February 18, 2022 23:57
@Ecss11 Ecss11 deleted the v2.0.0 branch February 21, 2022 22:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant