Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 18, 2025

This change synchronizes the documentation version with the CMake project version by automatically parsing the version from CMakeLists.txt, eliminating the need for manual updates when the project version changes.

Changes Made

  • Added regex parsing in docs/source/conf.py to read the version from the CMake project configuration
  • Replaced hardcoded version string 'v0.3.0' with dynamic parsing logic
  • Maintained consistent formatting with 'v' prefix for documentation display (e.g., v0.3.0)

Implementation Details

The solution follows the same pattern used in MICM PR #581:

# Read version from CMakeLists.txt
regex = r'project\(\w+\s+VERSION\s+([\d\.]+)'
version = '0.0.0'
# read the version from the cmake files
with open('../../CMakeLists.txt', 'r') as f:
    for line in f:
        match = re.match(regex, line)
        if match:
            version = match.group(1)
            break

version = f'v{version}'

Testing

  • ✅ Documentation builds successfully with parsed version
  • ✅ Version appears correctly in generated HTML pages
  • ✅ Automation tested by temporarily changing CMake version
  • ✅ Main C++ project builds without issues

Now when the project version is updated in CMakeLists.txt, the documentation will automatically reflect the new version without requiring manual edits to conf.py.

Fixes #75.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Parse CMake version for use in the docs Parse CMake version for use in docs Jul 18, 2025
Copilot AI requested a review from K20shores July 18, 2025 21:13
Copilot finished work on behalf of K20shores July 18, 2025 21:13
@K20shores K20shores marked this pull request as ready for review July 18, 2025 21:14
@K20shores K20shores requested a review from boulderdaze July 18, 2025 21:14
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.95%. Comparing base (a3647c4) to head (e2f584b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #122   +/-   ##
=======================================
  Coverage   86.95%   86.95%           
=======================================
  Files           3        3           
  Lines          23       23           
=======================================
  Hits           20       20           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@K20shores K20shores merged commit 8fe0f4f into main Jul 18, 2025
15 checks passed
@K20shores K20shores deleted the copilot/fix-75 branch July 18, 2025 21:33
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.

Parse CMake version for use in the docs

4 participants