Skip to content

Refactor: convert to idiomatic Flask application factory - #127

Merged
guillermodotn merged 7 commits into
release-engineering:mainfrom
guillermodotn:main
Sep 11, 2026
Merged

guillermodotn merged 7 commits into
release-engineering:mainfrom
guillermodotn:main

Conversation

@guillermodotn

Copy link
Copy Markdown
Contributor
  • Introduce create_app() factory, move all module-level initialization inside it
  • Extract db, login_manager, migrate into cts/extensions.py
  • Extract version string into cts/_version.py
  • Convert API routes to an api_v1 Blueprint
  • Remove the Config class and global conf singleton; use current_app.config at request time and explicit config parameters at setup time
  • Remove _sync_conf_binding() hack
  • Untangle circular imports
  • manage.py uses FlaskGroup(create_app=...) with no import-time side effects
  • contrib/cts.wsgi calls create_app(config_section="ProdConfiguration") explicitly

@guillermodotn guillermodotn self-assigned this Sep 10, 2026
@codecov-commenter

codecov-commenter commented Sep 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.67669% with 78 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.39%. Comparing base (641abd1) to head (7451558).

Files with missing lines Patch % Lines
cts/manage.py 0.00% 36 Missing ⚠️
cts/config.py 62.71% 22 Missing ⚠️
cts/__init__.py 88.88% 7 Missing ⚠️
cts/messaging.py 72.00% 7 Missing ⚠️
cts/_version.py 60.00% 2 Missing ⚠️
cts/views.py 93.33% 2 Missing ⚠️
cts/auth.py 96.66% 1 Missing ⚠️
cts/logger.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #127      +/-   ##
==========================================
- Coverage   83.84%   82.39%   -1.46%     
==========================================
  Files          13       15       +2     
  Lines        1374     1414      +40     
==========================================
+ Hits         1152     1165      +13     
- Misses        222      249      +27     
Flag Coverage Δ
unit-tests 82.39% <70.67%> (-1.46%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lubomir lubomir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are some references to create_app in docs/integration.rst. Other than these nitpicks, this looks like a very solid change.

Comment thread cts/_version.py Resolved
Comment thread cts/config.py Resolved
Comment thread cts/manage.py Resolved
Comment thread cts/logger.py Resolved
Comment thread cts/config.py Resolved
@guillermodotn
guillermodotn merged commit 2345512 into release-engineering:main Sep 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants