Scribe-Data icon indicating copy to clipboard operation
Scribe-Data copied to clipboard

Fix file deletion and version parsing in upgrade.py; resolve related test issue

Open haasham1 opened this issue 8 months ago • 2 comments

Contributor Checklist

  • [x] Pull request is made from a separate branch, not the main branch
  • [x] Code has been tested using pytest as explained in the contributing guide
  • [x] I agree to follow Scribe-Data's Code of Conduct

Description

Improved File Safety During Upgrade

  • Prevents deletion of important folders like venv, .venv, and user files.
  • Introduces MANAGED_DIRS and MANAGED_FILES to specify which files should be updated (e.g., scribe_data/, setup.py).
  • Adds EXCLUDE_DIRS to skip folders like .git and virtual environments.
  • Ensures only Scribe-managed files are updated while preserving everything else.

Fixed Version Parsing to Prevent 404 Errors

  • Replaces version strings like "Scribe-Data 4.1.0" with just the number using regex (e.g., 4.1.0).
  • Builds the correct GitHub tag URL (e.g., v4.1.0) to avoid broken links during download.

Testing

  • Ran scribe-data --upgrade when current version is 4.1.0
    ✅ "You already have the latest version of Scribe-Data: 4.1.0"

  • Mocked a newer version (4.2.0) → Confirmed:
    venv and user files were preserved
    ✅ Managed files were updated properly

  • 🔧 Added Unit tests using pytest.


Related Issue

Fixes #596

haasham1 avatar May 02 '25 22:05 haasham1

Thank you for the pull request! ❤️

The Scribe-Data team will do our best to address your contribution as soon as we can. If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and Data rooms once you're in. Also consider attending our bi-weekly Saturday dev syncs. It'd be great to meet you 😊

github-actions[bot] avatar May 02 '25 22:05 github-actions[bot]

Maintainer Checklist

The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

  • [x] The linting and formatting workflow within the PR checks do not indicate new errors in the files changed

  • [x] The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

github-actions[bot] avatar May 02 '25 22:05 github-actions[bot]