Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(v3)!: make util module private #884

Merged
merged 2 commits into from
Nov 28, 2024
Merged

chore(v3)!: make util module private #884

merged 2 commits into from
Nov 28, 2024

Conversation

JP-Ellis
Copy link
Contributor

📝 Summary

The pact.v3.util module contains useful utility functions used internally, but otherwise should not be used by Pact Python end-users. As a result, I am making it private now.

🚨 Breaking Changes

  • pact.v3.util is renamed to pact.v3._util
  • Functions within said module have had their leading underscores removed

Furthermore, as pact.v3._util is now a private module, breaking changes to private functions will not be considered breaking changes to the Pact Python library.

🔥 Motivation

Simplify the ongoing maintenance of the utility functions without burdening ourselves with backward compatibility.

🔨 Test Plan

Regular CI

🔗 Related issues/PRs

None

@JP-Ellis JP-Ellis self-assigned this Nov 27, 2024
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78%. Comparing base (6f8db31) to head (ccad5fc).
Report is 6 commits behind head on main.

Additional details and impacted files
@@         Coverage Diff         @@
##           main   #884   +/-   ##
===================================
  Coverage    78%    78%           
===================================
  Files        30     30           
  Lines      3365   3373    +8     
===================================
+ Hits       2634   2642    +8     
  Misses      731    731           
Flag Coverage Δ
examples 59% <100%> (+<1%) ⬆️
tests 75% <100%> (+<1%) ⬆️

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

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

Within the `pact.v3.util` module, a _find_free_port utility has been
added. It is used within tests, and more importantly, it is used to find
a free port for the Pact server.

As part of this change, "find a port for me" option is denoted using
`None` as opposed to `0`. The value of 0 will still allocate a random
port, though this is done using the Pact Core Library as opposed to the
higher leve Python library.

This should _not_ be a breaking change for anyone as:

1. If someone explicitly used the default value of `0`, the behaviour
    remains unchanged (that is, port is allocated by the Pact Core
    library).
2. If the default is implicitly provided, a random port is still being
    allocated, albeit now by the Python library as opposed to the Rust
    core library.

Signed-off-by: JP-Ellis <josh@jpellis.me>
The `pact.v3.util` module was created as a public module, but serves no
purpose to end-users of Pact Python. This commit renames it and marks it
as private.

If anyone was relying on functions from this module, they are still
accessible within the (now private) `pact.v3._util` module.

BREAKING CHANGE: `pact.v3.util` has been renamed to `pact.v3._util` and
    is now private.

Signed-off-by: JP-Ellis <josh@jpellis.me>
@JP-Ellis JP-Ellis merged commit 5162c80 into main Nov 28, 2024
36 of 37 checks passed
@JP-Ellis JP-Ellis deleted the chore/util-refactor branch November 28, 2024 01:42
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.

1 participant