Repository navigation
Upgrade dependencies to latest stable and modernize for Python 3.11 - #825
Open
ebubekirrcihangirr6060 wants to merge 5 commits into
Open
ebubekirrcihangirr6060 wants to merge 5 commits into
ebubekirrcihangirr6060 wants to merge 5 commits into
Conversation
- Bump all runtime and dev dependencies to their latest stable releases (pydantic 2.14, mypy 2.4, black 26.10, ipython 9, ipykernel 7, pymongo 4.19, ...) - Raise requires-python to >=3.11 (3.9/3.10 are EOL and several latest releases need 3.11) - Move pytest-mock and types-python-dateutil from runtime to dev dependencies - Bump uv_build backend to 0.13 and CI Python to 3.11 - Disable pylint import-self (false positive on mkinit __init__ files in pylint 4.1) Co-authored-by: GaziFe <233933832+GaziFe@users.noreply.github.com> Co-authored-by: Abdullah Kadir Çelik <207906693+Kadircelik-stack@users.noreply.github.com>
- Use PEP 585/604 annotations (list[...], X | None) and collections.abc imports - Use datetime.UTC, drop redundant open modes and super() arguments - Fix Singleton: keep one instance per subclass and type get_instance as Self (previously all subclasses shared a single slot and returned the base instance) - Simplify redundant comprehensions, nested ifs and boolean returns - Move broad-exception pylint pragmas inline (pylint 4.1 no longer applies the preceding-line form to the except clause) and use the current message name - Make the utc_to_str test independent of the local timezone Co-authored-by: GaziFe <233933832+GaziFe@users.noreply.github.com> Co-authored-by: Abdullah Kadir Çelik <207906693+Kadircelik-stack@users.noreply.github.com>
- checkout/setup-python v7, upload-artifact v7, codeql-action v4, retry v4, setup-uv v10.3.0 (codeql-action@v2 and upload-artifact@v2 are retired, so CI could not run) - Replace archived create-release/upload-release-asset with softprops/action-gh-release@v3 Co-authored-by: GaziFe <233933832+GaziFe@users.noreply.github.com> Co-authored-by: Abdullah Kadir Çelik <207906693+Kadircelik-stack@users.noreply.github.com>
Co-authored-by: GaziFe <233933832+GaziFe@users.noreply.github.com> Co-authored-by: Abdullah Kadir Çelik <207906693+Kadircelik-stack@users.noreply.github.com>
- DiscreteLog: use get_instance() so set_max_exponent/set_lazy_evaluation take effect; precompute_cache_async now fills the instance cache instead of a module-level dict - Scheduler: stop opening pools twice in __enter__, make close() idempotent and add use_scheduler() so tally/decryption close the schedulers they create - ReadOnlyDataStore: follow the Mapping contract (iterate keys, raise KeyError) and remove the self-recursive __eq__ - Add regression tests for each defect Co-authored-by: GaziFe <233933832+GaziFe@users.noreply.github.com> Co-authored-by: Abdullah Kadir Çelik <207906693+Kadircelik-stack@users.noreply.github.com>
ebubekirrcihangirr6060
force-pushed
the
chore/upgrade-deps-refactor
branch
from
October 22, 2026 16:48
183877f to
d1c754a
Compare
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Upgrade dependencies to latest stable and modernize for Python 3.11
⚠️ Breaking change: minimum Python is now 3.11
Python 3.9 and 3.10 are end-of-life, and several of the latest releases require 3.11 (ipython 9, ipykernel 7, pymongo 4.19, hypothesis).
requires-pythonis now>=3.11,<4.0.0; CI workflows, black/mypy targets and the README/docs are updated to match.Commit 1: dependency upgrade
uv_build0.13.uv.lockregenerated.pytest-mockandtypes-python-dateutilmoved from runtime dependencies to the dev group (only tests and mypy use them).import-selfandcyclic-importdisabled: pylint 4.1 reports false positives on the mkinit-generated__init__.pyfiles when a submodule name starts with the package name (e.g.encrypt_ballots/encrypt_ballots_*). Noted inpyproject.toml; the trade-off is that real import cycles are no longer reported until this is fixed upstream in pylint.Commit 2: refactor
list[...],X | None),collections.abcimports,datetime.UTC.__init__.pyre-exports are untouched.Singleton: all subclasses shared one instance slot, soget_instance()returned the baseSingletonobject rather than the subclass. It now keeps one instance per class and is typed as returningSelf. Added a regression test that fails on the old code.ifs, boolean returns anddict.keys()checks.broad-exception-caughtpylint pragmas onto theexceptline (pylint 4.1 no longer applies the preceding-line form to theexceptclause) and use the current message name.test_utc_to_str_with_valid_utc_dateno longer depends on the local timezone (it failed in UTC+3, where the hour has two digits).Commit 3: GitHub Actions
actions/checkout,actions/setup-python→ v7,actions/upload-artifact→ v7,github/codeql-action→ v4,nick-fields/retry→ v4,astral-sh/setup-uv→ v10.3.0 (still pinned by SHA). The previouscodeql-action@v2andupload-artifact@v2have been retired by GitHub, so CI could not run with them.actions/create-release+actions/upload-release-assetpair is replaced bysoftprops/action-gh-release@v3. The release is now created after the PyPI upload, together with its zip asset.Commit 4: design pattern fixes
An audit of the library's patterns (Singleton, Context Manager, Repository, Mediator, Builder, CLI step pipeline, GUI dependency injection) found these defects. Each fix comes with a test that fails on the old code:
DiscreteLog(Singleton): call sites created a throwaway instance withDiscreteLog(), soset_max_exponent/set_lazy_evaluationnever took effect. The library now usesDiscreteLog.get_instance().precompute_cache_asyncfilled a module-level dict instead of the instance cache; it now fills the instance cache.Scheduler(Context Manager):with Scheduler()opened the pools twice and leaked the first set, andtally.py/decryption.pycreated a scheduler per call (per contest during decryption) without ever closing it. Addeduse_scheduler(), which reuses a caller's scheduler or closes the one it creates.close()is now idempotent. The docstring no longer claims the class guarantees a single set of pools.ReadOnlyDataStore(Repository view):__eq__called itself (RecursionError),__iter__yielded(key, value)pairs, and__getitem__returnedNoneinstead of raisingKeyError. As a resultin,keys(),items()anddict(view)were all wrong. It now follows theMappingcontract.Union[...]type aliases now use|syntax.Verification
pytest tests: 231 passed, 1 skipped on both Python 3.11.17 and 3.13 (Windows). Before these changes: 221 passed, 1 failed (the timezone test).uv build,twine checkandmkdocs build --strictpass; workflow YAML validated.