Skip to content

Update version to 0.3.2 and add version update script#5

Merged
regmibijay merged 1 commit intomasterfrom
bugfix/preflight-checks
Sep 21, 2025
Merged

Update version to 0.3.2 and add version update script#5
regmibijay merged 1 commit intomasterfrom
bugfix/preflight-checks

Conversation

@regmibijay
Copy link
Owner

No description provided.

@regmibijay regmibijay requested a review from Copilot September 21, 2025 22:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the project version from 0.3.1 to 0.3.2 across multiple configuration files and introduces a Python script to automate version updates in the future. The changes ensure version consistency across the package metadata, documentation, and source code.

  • Updated version number from 0.3.1 to 0.3.2 in all relevant files
  • Added a version update automation script for future releases
  • Removed GitHub release upload workflow step

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
yarp/init.py Updated package version and added explanatory comments for preflight checks
update_version.py New script to automatically update version numbers across project files
pyproject.toml Updated project version in package configuration
docs/source/conf.py Updated documentation release version
.github/workflows/pip_package.yml Removed GitHub release upload workflow steps

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

version = sys.argv[1] if len(sys.argv) > 1 else None
if not version:
print("Usage: python update_version.py <new_version>")
sys.exit(1)
Copy link

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

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

The script lacks input validation for the version parameter. Consider adding validation to ensure the version follows semantic versioning format (e.g., using a regex pattern like r'^\d+\.\d+\.\d+$') before attempting to update files.

Suggested change
sys.exit(1)
sys.exit(1)
# Validate semantic versioning format
if not re.match(r'^\d+\.\d+\.\d+$', version):
print("Error: Version must follow semantic versioning (e.g., 1.2.3)")
sys.exit(1)

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +33
content = PYPROJECT.read_text()
new_content = re.sub(r'version\s*=\s*"[^"]+"', f'version = "{version}"', content)
PYPROJECT.write_text(new_content)


def update_conf_py(version):
content = CONF_PY.read_text()
# Update 'release' and/or 'version' variables
new_content = re.sub(r'release\s*=\s*"[^"]+"', f'release = "{version}"', content)
new_content = re.sub(
r'version\s*=\s*"[^"]+"', f'version = "{version}"', new_content
)
CONF_PY.write_text(new_content)


def update_init_py(version):
content = INIT_PY.read_text()
new_content = re.sub(
r'__version__\s*=\s*"[^"]+"', f'__version__ = "{version}"', content
)
INIT_PY.write_text(new_content)
Copy link

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

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

The functions don't handle file read/write errors or check if the regex substitution actually found and replaced content. Consider adding error handling and validation that the expected version pattern was found and updated.

Suggested change
content = PYPROJECT.read_text()
new_content = re.sub(r'version\s*=\s*"[^"]+"', f'version = "{version}"', content)
PYPROJECT.write_text(new_content)
def update_conf_py(version):
content = CONF_PY.read_text()
# Update 'release' and/or 'version' variables
new_content = re.sub(r'release\s*=\s*"[^"]+"', f'release = "{version}"', content)
new_content = re.sub(
r'version\s*=\s*"[^"]+"', f'version = "{version}"', new_content
)
CONF_PY.write_text(new_content)
def update_init_py(version):
content = INIT_PY.read_text()
new_content = re.sub(
r'__version__\s*=\s*"[^"]+"', f'__version__ = "{version}"', content
)
INIT_PY.write_text(new_content)
try:
content = PYPROJECT.read_text()
except Exception as e:
print(f"Error reading {PYPROJECT}: {e}", file=sys.stderr)
sys.exit(1)
new_content, count = re.subn(r'version\s*=\s*"[^"]+"', f'version = "{version}"', content)
if count == 0:
print(f"Error: version pattern not found in {PYPROJECT}", file=sys.stderr)
sys.exit(1)
try:
PYPROJECT.write_text(new_content)
except Exception as e:
print(f"Error writing {PYPROJECT}: {e}", file=sys.stderr)
sys.exit(1)
def update_conf_py(version):
try:
content = CONF_PY.read_text()
except Exception as e:
print(f"Error reading {CONF_PY}: {e}", file=sys.stderr)
sys.exit(1)
# Update 'release' and/or 'version' variables
new_content, release_count = re.subn(r'release\s*=\s*"[^"]+"', f'release = "{version}"', content)
new_content, version_count = re.subn(
r'version\s*=\s*"[^"]+"', f'version = "{version}"', new_content
)
if release_count == 0 and version_count == 0:
print(f"Error: neither 'release' nor 'version' pattern found in {CONF_PY}", file=sys.stderr)
sys.exit(1)
try:
CONF_PY.write_text(new_content)
except Exception as e:
print(f"Error writing {CONF_PY}: {e}", file=sys.stderr)
sys.exit(1)
def update_init_py(version):
try:
content = INIT_PY.read_text()
except Exception as e:
print(f"Error reading {INIT_PY}: {e}", file=sys.stderr)
sys.exit(1)
new_content, count = re.subn(
r'__version__\s*=\s*"[^"]+"', f'__version__ = "{version}"', content
)
if count == 0:
print(f"Error: __version__ pattern not found in {INIT_PY}", file=sys.stderr)
sys.exit(1)
try:
INIT_PY.write_text(new_content)
except Exception as e:
print(f"Error writing {INIT_PY}: {e}", file=sys.stderr)
sys.exit(1)

Copilot uses AI. Check for mistakes.
@regmibijay regmibijay merged commit e0cfdf2 into master Sep 21, 2025
4 checks passed
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.

1 participant