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: use dynamic versioning #24

Merged
merged 13 commits into from
Nov 12, 2024
Merged

Conversation

aaronsteers
Copy link
Contributor

@aaronsteers aaronsteers commented Nov 12, 2024

Summary by CodeRabbit

  • New Features

    • Introduced dynamic versioning for the project, allowing automatic version updates during the publish process.
    • Enhanced workflow for publishing Python packages with improved configurability for different environments.
  • Bug Fixes

    • Updated workflow job names and environment settings for clarity and consistency.
  • Chores

    • Adjusted build configuration to streamline the release process.
    • Updated project metadata with new homepage and repository URLs.
    • Added a new dependency to support dynamic versioning.

Copy link
Contributor

coderabbitai bot commented Nov 12, 2024

Warning

Rate limit exceeded

@aaronsteers has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 52 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6a141e1 and bb21c26.

Walkthrough

The changes in the pyproject.toml file involve updates to the build system and versioning strategy. A new requirement for poetry-dynamic-versioning has been added, and the build backend has been changed to utilize this dynamic versioning. The project version has been set to 0.0.0 to allow for dynamic replacement during publishing, and a new section for enabling dynamic versioning has been introduced. Additionally, the workflow file for publishing to PyPI has been modified to enhance flexibility and configurability, including changes to job names and environment variables.

Changes

File Change Summary
pyproject.toml - Added requirement: poetry-dynamic-versioning>=1.0.0,<2.0.0 in [build-system]
- Updated build backend to poetry_dynamic_versioning.backend
- Changed version from 6.5.2 to 0.0.0 in [tool.poetry]
- Introduced new section [tool.poetry-dynamic-versioning] with enable = true
- Updated homepage and repository URLs in [tool.poetry]
- Added dependency: dunamai = "^1.22.0" in [tool.poetry.dependencies]
.github/workflows/pypi_publish.yml - Updated workflow name to "Python Packaging"
- Added job: "Build"
- Updated environment URL to https://pypi.org/p/airbyte-cdk
- Changed conditional for publish step to check for tags starting with 'refs/tags/v'
- Updated step names for clarity and added input parameter repository-url set to ${{vars.PYPI_PUBLISH_URL}}
airbyte_cdk/__init__.py - Updated version assignment to use dunamai for dynamic version retrieval instead of static metadata.
- Added comment regarding dynamic versioning during the publish process.

Poem

In the garden where the bunnies play,
A new version hops in, brightening the day.
With dynamic magic, it leaps and it bounds,
Updating with ease, as joy abounds.
So let’s dance and twirl, with code so fine,
For every release, a new version to shine! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
pyproject.toml (1)

27-28: Consider additional version format configuration.

While the basic configuration is correct, consider adding these optional configurations for more control:

  • style to specify version format (pep440, semver, etc.)
  • pattern to customize version regex pattern
  • format to customize version format string

Example configuration:

 [tool.poetry-dynamic-versioning]
 enable = true
+style = "pep440"
+format = "{base}"
+pattern = "^(?P<base>\\d+\\.\\d+\\.\\d+)$"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6042387 and b2b4735.

📒 Files selected for processing (1)
  • pyproject.toml (2 hunks)
🔇 Additional comments (2)
pyproject.toml (2)

2-3: LGTM! Version constraints follow best practices.

The build system changes are well-structured:

  • Version constraint >=1.0.0,<2.0.0 follows best practices by allowing patches while preventing breaking changes
  • Build backend change is required for dynamic versioning to work

Let's verify we're using the latest stable version:


24-25: LGTM! Clear documentation of version management strategy.

The version change and documentation are well-implemented:

  • Setting version to "0.0.0" is correct for dynamic versioning
  • Comment clearly explains the versioning strategy and links to documentation

Let's verify there are no hardcoded version references:

✅ Verification successful

Version reference in CHANGELOG.md is historical and should be kept

The version "6.5.2" appears only in the CHANGELOG.md file as part of the version history, which is the correct location for it. This is not a hardcoded reference that needs updating, as changelogs should maintain the historical record of previous versions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any hardcoded references to version 6.5.2 that might need updating
rg -l "6\.5\.2" --type-not toml

Length of output: 46


Script:

#!/bin/bash
# Check the context of version 6.5.2 in CHANGELOG.md
rg -A 5 "6\.5\.2" CHANGELOG.md

Length of output: 133

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
.github/workflows/pypi_publish.yml (3)

1-1: Consider a more descriptive workflow name

While "PyPI" is concise, consider a name that better describes the workflow's purpose, such as "PyPI Build & Publish" or "Package Release".


26-27: Add URL validation and documentation

While using an environment variable for the PyPI URL provides flexibility, consider:

  1. Adding URL validation to prevent misconfiguration
  2. Documenting the expected URL format in the repository

Add this step before the publish job:

      - name: Validate PyPI URL
        run: |
          if [[ ! "$PYPI_PUBLISH_URL" =~ ^https://(test\.)?pypi\.org/p/airbyte$ ]]; then
            echo "Invalid PYPI_PUBLISH_URL: $PYPI_PUBLISH_URL"
            exit 1
          fi

Line range hint 1-46: Consider implementing release environment strategy

The current setup allows toggling between production and test PyPI through an environment variable. Consider implementing a more structured approach using GitHub Environments:

  • Create separate "PyPI-Test" and "PyPI-Production" environments
  • Define environment-specific variables and protection rules
  • Use environment conditions in the workflow

This would provide better separation of concerns and enhanced security controls.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b2b4735 and 10b20b6.

📒 Files selected for processing (1)
  • .github/workflows/pypi_publish.yml (4 hunks)
🔇 Additional comments (2)
.github/workflows/pypi_publish.yml (2)

45-46: Verify environment variable configuration

The repository-url configuration looks correct, but ensure the PYPI_PUBLISH_URL environment variable is properly configured in the repository settings.

Let's check for any existing environment variable documentation:

#!/bin/bash
# Description: Look for environment variable documentation
# Expected: Documentation mentioning PYPI_PUBLISH_URL configuration

rg -l "PYPI_PUBLISH_URL" --type md
fd -e md -x cat {} \; | rg -A 5 -B 5 "PYPI_PUBLISH_URL" || true

Line range hint 10-16: LGTM! Build configuration is well structured

The use of hynek/build-and-inspect-python-package@v2 with full history fetch is appropriate for dynamic versioning.

Let's verify the action's compatibility with poetry-dynamic-versioning:

✅ Verification successful

LGTM! Build configuration is compatible with poetry-dynamic-versioning

The project correctly uses poetry-dynamic-versioning:

  • Configured in pyproject.toml with poetry-dynamic-versioning>=1.0.0,<2.0.0 in build requirements
  • Uses poetry_dynamic_versioning.backend as the build backend
  • Has dynamic versioning enabled with [tool.poetry-dynamic-versioning]
  • The fetch-depth: 0 in the workflow ensures full git history for version calculation

The hynek/build-and-inspect-python-package@v2 action will work correctly with this setup as it's a standard build process that respects the configured build backend.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the build action supports poetry-dynamic-versioning
# Expected: Documentation or issues mentioning poetry-dynamic-versioning support

gh api repos/hynek/build-and-inspect-python-package/issues \
  --jq '.[] | select(.body + .title | contains("poetry-dynamic-versioning"))' || true

Length of output: 315


Script:

#!/bin/bash
# Let's verify if poetry-dynamic-versioning is configured in the project
fd -e toml -x cat {} \; | grep -A 5 -B 5 "poetry-dynamic-versioning"

# Check the build system requirements
fd pyproject.toml -x cat {} \; | grep -A 10 "\[build-system\]"

# Look for any dynamic version configuration
fd -e toml -x cat {} \; | grep -A 5 "dynamic"

# Check workflow files for any poetry setup steps
fd "\.ya?ml$" .github/workflows -x cat {} \; | grep -A 5 -B 5 "poetry"

Length of output: 13454

@aaronsteers aaronsteers merged commit 2edf3fa into main Nov 12, 2024
16 of 17 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant