Skip to content

chore: Remove API key usage in CI#39

Merged
Abhijeet Prasad (AbhiPrasad) merged 5 commits intomainfrom
abhi-no-api-keys-ci
Mar 5, 2026
Merged

chore: Remove API key usage in CI#39
Abhijeet Prasad (AbhiPrasad) merged 5 commits intomainfrom
abhi-no-api-keys-ci

Conversation

@AbhiPrasad
Copy link
Member

  • Remove ANTHROPIC_API_KEY, OPENAI_API_KEY, and GEMINI_API_KEY secrets from all CI workflows — tests use VCR cassettes with record_mode="none" in CI, so real API keys are never needed
  • Add dummy ANTHROPIC_API_KEY fallback in conftest.py (OpenAI and Google already had one) to prevent Anthropic client instantiation failures
  • Skip test_latest_wrappers_novcr nox session in CI since it disables VCR and requires real keys
  • Add CONTRIBUTING.md with repo setup, structure, testing, and CI docs
  • Add docs/vcr-testing.md with detailed VCR testing guide covering local vs CI differences and contributor workflow

The vcr-testing.md and CONTRIBUTING.md were fully AI generated.

@nox.session()
def test_latest_wrappers_novcr(session):
"""Run the latest wrapper tests without vcrpy."""
if os.environ.get("CI") or os.environ.get("GITHUB_ACTIONS"):
Copy link
Contributor

Choose a reason for hiding this comment

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

i think if we don't have this, we might want some way of asserting we eventually test reality. maybe if oldest VCR file is X days/weeks/months old, fail the build and force downloading new cassettes. open to whatever idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. let me think about this a bit.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, maybe we should have a nightly or weekly build that runs without VCR enabled. (Similar to one we might use to check for updated 3rd party package compatibility.)

cd braintrust-sdk-python

# Create venv and install all dependencies
make develop
Copy link
Contributor

@clutchski Matt Perpick (clutchski) Mar 4, 2026

Choose a reason for hiding this comment

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

i think we use mise for this now. we should eliminate all of the old ways of creating venvs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can go and clean this up after I merge the PR in. I'll also do a refactor of the readmes then.

Copy link
Member Author

Choose a reason for hiding this comment

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

I opened two PRs as a follow up to this:

  - Remove ANTHROPIC_API_KEY, OPENAI_API_KEY, and GEMINI_API_KEY secrets from all CI workflows
  — tests use VCR cassettes with record_mode="none" in CI, so real API keys are never needed
  - Add dummy ANTHROPIC_API_KEY fallback in conftest.py (OpenAI and Google already had one) to
  prevent Anthropic client instantiation failures
  - Skip test_latest_wrappers_novcr nox session in CI since it disables VCR and requires real
  keys
  - Add CONTRIBUTING.md with repo setup, structure, testing, and CI docs
  - Add docs/vcr-testing.md with detailed VCR testing guide covering local vs CI differences
  and contributor workflow
Copy link
Contributor

@delner David Elner (delner) left a comment

Choose a reason for hiding this comment

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

Generally in favor of this (removing keys makes things more portable.)

Following on Matt's point, perhaps separate from this implementation, I do think its a good idea to have some kind of automated non-VCR build to check if/when we've drifted from real API calls. That would require some secrets in the env, but I assume that can easily be added for just that build without a lot of code changes here.

@AbhiPrasad
Copy link
Member Author

Going to merge this in to unblock a contributor PR, but I’ll follow up on the automated non-VCR check asap.

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit eb53011 into main Mar 5, 2026
33 checks passed
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the abhi-no-api-keys-ci branch March 5, 2026 21:02
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