-
Notifications
You must be signed in to change notification settings - Fork 5
feat: support and validate CPython 3.14 #17
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
Merged
deleteLater
merged 2 commits into
featbit:master
from
lopezm1:codex/python-3.14-compatibility
Sep 2, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| certifi>=2018.4.16 | ||
| urllib3>=1.22.0 | ||
| urllib3>=1.26.5,<3 | ||
| websocket-client>=1.0.0 | ||
| python-dateutil>=2.8.2 | ||
| flake8 | ||
| pytest | ||
| pytest-mock | ||
| autopep8 | ||
| build | ||
| twine | ||
| twine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| { | ||
| "version":"1.1.8" | ||
| "version":"1.1.9" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| certifi>=2018.4.16 | ||
| urllib3>=1.22.0 | ||
| urllib3>=1.26.5,<3 | ||
| python-dateutil>=2.8.2 | ||
| websocket-client>=1.0.0 | ||
| websocket-client>=1.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| #!/usr/bin/env python3 | ||
| """Exercise the installed wheel through the public offline client API.""" | ||
|
|
||
| import argparse | ||
| import base64 | ||
| import json | ||
| import site | ||
| import threading | ||
| from importlib import metadata | ||
| from pathlib import Path | ||
|
|
||
| import fbclient | ||
| from fbclient.client import FBClient | ||
| from fbclient.config import Config | ||
|
|
||
|
|
||
| PACKAGE_NAME = "fb-python-sdk" | ||
| FAKE_ENV_SECRET = base64.b64encode(b"fake_env_secret").decode() | ||
| FAKE_URL = "http://fake" | ||
| USER_ENABLED = {"key": "test-user-1", "name": "test-user-1", "country": "us"} | ||
| USER_DISABLED = { | ||
| "key": "test-user-3", | ||
| "name": "test-user-3", | ||
| "country": "cn", | ||
| "major": "cs", | ||
| } | ||
|
|
||
|
|
||
| def parse_args(): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument("--bootstrap", type=Path, required=True) | ||
| parser.add_argument("--expected-version") | ||
| parser.add_argument("--expected-version-file", type=Path) | ||
| return parser.parse_args() | ||
|
|
||
|
|
||
| def assert_installed_package(): | ||
| package_path = Path(fbclient.__file__).resolve() | ||
| site_paths = [Path(path).resolve() for path in site.getsitepackages()] | ||
| assert any(package_path.is_relative_to(path) for path in site_paths), ( | ||
| "fbclient was not imported from the wheel environment: %s" % package_path | ||
| ) | ||
|
|
||
|
|
||
| def assert_metadata(expected_version): | ||
| distribution = metadata.distribution(PACKAGE_NAME) | ||
| if expected_version: | ||
| assert distribution.version == expected_version | ||
|
|
||
| package_metadata = distribution.metadata | ||
| assert package_metadata["Requires-Python"] == ">=3.10, <3.15" | ||
| classifiers = package_metadata.get_all("Classifier") or [] | ||
| assert "Programming Language :: Python :: 3.10" in classifiers | ||
| assert "Programming Language :: Python :: 3.14" in classifiers | ||
| requirements = distribution.requires or [] | ||
| assert any(requirement.startswith("urllib3<3,>=1.26.5") for requirement in requirements) | ||
| return distribution.version | ||
|
|
||
|
|
||
| def featbit_thread_ids(): | ||
| return { | ||
| thread.ident | ||
| for thread in threading.enumerate() | ||
| if thread.ident is not None and thread.name.startswith("featbit-") | ||
| } | ||
|
|
||
|
|
||
| def exercise_client(bootstrap_path): | ||
| baseline_threads = featbit_thread_ids() | ||
| states = [] | ||
| config = Config( | ||
| FAKE_ENV_SECRET, | ||
| event_url=FAKE_URL, | ||
| streaming_url=FAKE_URL, | ||
| offline=True, | ||
| ) | ||
| client = FBClient(config) | ||
|
|
||
| def on_status_change(state): | ||
| states.append(state.state_type.name) | ||
|
|
||
| client.update_status_provider.add_listener(on_status_change) | ||
| try: | ||
| assert client.initialize_from_external_json(bootstrap_path.read_text()) | ||
| assert client.initialize | ||
| assert states == ["OK"] | ||
| assert client.variation("ff-test-bool", USER_ENABLED, False) is True | ||
| assert client.variation("ff-test-bool", USER_DISABLED, True) is False | ||
| assert client.variation("missing-flag", USER_ENABLED, False) is False | ||
| for _ in range(100): | ||
| assert client.variation("ff-test-bool", USER_ENABLED, False) is True | ||
| finally: | ||
| client.update_status_provider.remove_listener(on_status_change) | ||
| client.stop() | ||
| client.stop() | ||
|
|
||
| leaked_threads = featbit_thread_ids() - baseline_threads | ||
| assert not leaked_threads, "FeatBit worker threads leaked: %s" % leaked_threads | ||
| return states | ||
|
|
||
|
|
||
| def main(): | ||
| args = parse_args() | ||
| expected_version = args.expected_version | ||
| if args.expected_version_file: | ||
| expected_version = json.loads( | ||
| args.expected_version_file.read_text() | ||
| )["version"] | ||
| assert_installed_package() | ||
| version = assert_metadata(expected_version) | ||
| states = exercise_client(args.bootstrap) | ||
| print(json.dumps({"package": PACKAGE_NAME, "states": states, "version": version})) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.