Skip to content

Drop version field from xxxPGCtl classes#158

Merged
pgiraud merged 1 commit into
masterfrom
ctl_version_property
Apr 14, 2025
Merged

Drop version field from xxxPGCtl classes#158
pgiraud merged 1 commit into
masterfrom
ctl_version_property

Conversation

@pgiraud
Copy link
Copy Markdown
Member

@pgiraud pgiraud commented Apr 11, 2025

No description provided.

The value for this field was set in `init`, which required a call to the
`pg_ctl --version` command.

We may want to instanciate a class without executing `pg_ctl`. Since this
version field is not really useful, we drop it.

This is a breaking change.
@pgiraud
Copy link
Copy Markdown
Member Author

pgiraud commented Apr 11, 2025

The other option is to simply drop the version field. See f6f096b

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.61%. Comparing base (9bad2e0) to head (9897afd).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #158   +/-   ##
=======================================
  Coverage   97.60%   97.61%           
=======================================
  Files          10       10           
  Lines        1211     1214    +3     
=======================================
+ Hits         1182     1185    +3     
  Misses         29       29           

☔ View full report in Codecov by Sentry.
📢 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.

Comment thread pgtoolkit/ctl.py Outdated
return parse_control_data(r.splitlines())

@property
def version(self) -> int:
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.

It's not cached actually.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I was wondering if it would be a good idea or not if it was cached. Hence the inaccurate commit message.

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.

In fact, for the async version it's already quite weird to query a property with await because in most common cases, properties are not expected to involve complex computations, especially not I/O. At least, in that case (in contrast with the sync case), this is explicit. So I think it should not be a property at all; rather a method, which itself may be cached. Or we can drop it if we don't use it as you suggest in your other comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Let's drop it.

PR updated.

@pgiraud pgiraud force-pushed the ctl_version_property branch from 9897afd to f6f096b Compare April 14, 2025 07:38
@pgiraud pgiraud changed the title Convert version field to a cached property Drop version field from xxxPGCtl classes Apr 14, 2025
Copy link
Copy Markdown
Contributor

@dlax dlax left a comment

Choose a reason for hiding this comment

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

If someone appears to use this, they will hopefully complain and we may reintroduce this as a method.

@pgiraud pgiraud merged commit c8876a9 into master Apr 14, 2025
12 checks passed
@pgiraud pgiraud deleted the ctl_version_property branch April 14, 2025 07:58
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