Skip to content

use Mapping instead of Dict, Sequence instead of List - #306

Open
Thyrst wants to merge 1 commit into
pinecone-io:mainfrom
Thyrst:generic_types
Open

Thyrst wants to merge 1 commit into
pinecone-io:mainfrom
Thyrst:generic_types

Conversation

@Thyrst

@Thyrst Thyrst commented Feb 6, 2024 •

Copy link
Copy Markdown

Problem

Describe the purpose of this change. What problem is being solved and why?

Solution

Using Mapping and Sequence where appropriate.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Viz Steps To Reproduce in the linked issue.

To test the fix, change pinecone-client version to this branch and run Pyright again.

pip uninstall pinecone-client && pip install git+https://github.com/Thyrst/pinecone-python-client.git@generic_types
pyright main.py

@charles-dyfis-net

Copy link
Copy Markdown

Is there a reason this is in draft?

@Thyrst
Thyrst marked this pull request as ready for review February 22, 2024 10:48
@Thyrst

Thyrst commented Feb 22, 2024

Copy link
Copy Markdown
Author

Is there a reason this is in draft?

It may not cover all places that need change but is ok to be merged. Marked it as ready.

@jhamon

jhamon commented Feb 23, 2024

Copy link
Copy Markdown
Collaborator

I appreciate the effort here, but code in the pinecone/core/ directory is generated off some things that are currently in a private repo. So i'll need to recreate these changes there before we can rebase and merge this PR.

@Thyrst

Thyrst commented Feb 24, 2024

Copy link
Copy Markdown
Author

I appreciate the effort here, but code in the pinecone/core/ directory is generated off some things that are currently in a private repo. So i'll need to recreate these changes there before we can rebase and merge this PR.

I see, thanks for the update. You can let me know once it's ready.

NishchayMahor pushed a commit to NishchayMahor/python-sdk-1 that referenced this pull request Sep 22, 2026
…cy (pinecone-io#311)

pytest-timeout was only ever declared in [project.optional-dependencies].dev,
which `uv sync --group dev` does not install. Every test job in CI syncs the
dependency group, so the plugin has been absent since April.

With the plugin missing, pytest downgraded both of its config surfaces to
warnings: `timeout = 5` in [tool.pytest.ini_options] logged "Unknown config
option: timeout" and was dropped, and all 89 `pytest.mark.timeout` markers in
tests/integration/ parsed as unknown markers and did nothing. The suite has
claimed a per-test timeout for four months without having one.

Add pytest-timeout to [dependency-groups].dev, and set
addopts = ["--strict-config", "--strict-markers"] so the next unrecognized ini
key or unregistered marker is a startup error rather than a warning nobody
reads. That silence is the actual defect; the missing dependency is what it hid.

Installing the plugin activates a timeout policy that nothing has ever been
measured against, so the policy ships with it:

- tests/integration/conftest.py gives the 555 unmarked integration tests a
  120s default instead of 5s. A 5s ceiling is sized for unit tests, which mock
  every sleep away, and cannot survive a live round trip. 120s sits above any
  single round trip while staying under the 180-600s band the explicit markers
  reserve for index-create and ingestion polling, so all 89 keep meaning
  something. The hook is path-filtered: pytest hands a conftest hook the whole
  session's item list, so an unfiltered loop would hit tests/unit too.
- test_grpc_dataframe_upsert_properties.py's partition property test gets a
  scoped 60s. 200 Hypothesis examples x up to 3000 mocked calls is slow, not
  hanging; it timed out on py3.10-3.12 CI while passing locally at 1.52s.
- test_storm_parity.py gets a module-level 30s. Its module-scoped fixture
  sleeps for real, measured at 4.27s, landing in the setup phase of whichever
  test runs first — 0.7s under the cap is a flake generator, not a guard.

No timeout was widened to hide a hang, and `timeout = 5` keeps its authored
value as the default everywhere else.

Refs pinecone-io#306
NishchayMahor pushed a commit to NishchayMahor/python-sdk-1 that referenced this pull request Sep 22, 2026
…r the 5s ceiling (pinecone-io#327) (pinecone-io#341)

* test(tooling): measured scoped timeout markers for the unit tests near the 5s ceiling (pinecone-io#327)

pinecone-io#306 made `timeout = 5` load-bearing for unit tests and handed back eight that
run within 1.7-2.5x of it. Its risk assessment was that they are wall-clock-bound
rather than CPU-bound, so unlike the grpc dataframe property test they should not
amplify on a slower runner. Measuring wall vs CPU per test confirms it: all eight
spend 0.1-0.5% of their runtime on CPU, and both costs are fixed constants in the
test doubles (a `threading.Event.wait(timeout=2)`, and a Retry-After of 2.0s that
the smear can stretch 1.5x).

Scoped markers sized against those measurements, at pinecone-io#306's ~7x ratio: 15s on the
three classes in test_grpc_dataframe_total_timeout.py that let the deadline fire
(2.01s each), and 20s on the sync and async Retry-After smear tests (2.96s). The
global 5s unit default is untouched.

Sweeping the whole suite for anything else above 1.5s found one test the ticket
did not know about, and it is the CPU-bound one: test_gaps_mode_end_to_end runs
1.65s at 94% CPU across two api_coverage.py subprocesses, i.e. the exact profile
that blew the 5s limit before. It gets 30s.

CI now runs pytest tests/unit with --durations, so a claimed margin can be
checked against real runner hardware without a throwaway commit.

Closes pinecone-io#327

* test(grpc): mark the two dataframe property tests the CI durations exposed (pinecone-io#327)

The --durations this PR added to CI paid for itself on its own first run. The
eight wall-clock-bound tests came in at 1.00x local->CI on all five Python
versions, exactly as pinecone-io#306 predicted. But the CPU-bound reference amplified
3.7-4.9x, reaching 6.22s on py3.10 — so pinecone-io#306's 60s marker on
test_batches_form_a_valid_partition is holding back a red on four of five
versions right now, not guarding a hypothetical.

Its two unmarked siblings in the same class share that profile and amplify ~3x
(0.70s/0.73s local -> 1.82-1.86s/1.69-2.19s CI), leaving 2.3x under the 5s
default on a cost that demonstrably clears 5s for the third member. 30s each,
sized against the CI maximum rather than the local reading.

Refs pinecone-io#327
NishchayMahor pushed a commit to NishchayMahor/python-sdk-1 that referenced this pull request Sep 22, 2026
…strict-config stops killing them (pinecone-io#399) (pinecone-io#410)

Both smoke jobs install test deps by name against a published wheel rather
than syncing the dev group, so nothing tied them to the pytest ini block.
`--strict-config` (pinecone-io#306) then made `timeout = 5` a usage error, and in
pytest 9 that error is raised after collection — so the job emitted the
suite's collect-time skips and exited 4 having run none of the 12 tests it
collected.

Names the two plugins explicitly, at the dev group's versions, and adds a
source-scan guard that holds both install lines to
[tool.pytest.ini_options] and to the markers tests/smoke/ applies.

This branch has not been deployed

No deployments
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