Skip to content

Commit

Permalink
Moved program_version collection outside of try block to correctly co…
Browse files Browse the repository at this point in the history
…llect program version even if a calculation fails. Added confirm_version check to release.py.
  • Loading branch information
coltonbh committed Jul 17, 2024
1 parent f457fa8 commit 2de16c7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed

- Only respect `collect_file` for for `Adapter.compute` if the adapter has `.uses_files=True`.
- Moved the `program_version = self.program_version(stdout)` call from `BaseAdapter.compute(...)` to outside the `try` block so that program version is collected even if the calculation fails.
- Cleaned up `xtb` cached version implementation.
- Added `confirm_version` check to `release.py`.

## [0.7.4] - 2024-07-16

Expand Down
2 changes: 1 addition & 1 deletion qcop/adapters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ def compute(
# None value covers FileInput case
# TODO: Is there a type safe way to handle this??
output_dict["success"] = True
program_version = self.program_version(stdout)

# Optionally collect wavefunction file
if collect_wfn and not collect_files:
Expand All @@ -186,6 +185,7 @@ def compute(
output_dict["traceback"] = traceback.format_exc()

wall_time = time() - start
program_version = self.program_version(stdout)

# Construct Provenance object
provenance = construct_provenance(
Expand Down
22 changes: 22 additions & 0 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ def run_git_commands(version):
subprocess.run(["git", "push"], check=True)


def confirm_version(version: str):
"""Ask the user to confirm the version number before proceeding."""
while True:
response = (
input(f"Are you sure you want to release {version}? (Y/N): ")
.strip()
.lower()
)
if response == "y":
print("Proceeding with the release...")
return
elif response == "n":
print(
"Release cancelled. Please manually revert pyproject.toml and "
"CHANGELOG.md."
)
sys.exit(0)
else:
print("Invalid input. Please enter 'Y' or 'N'.")


def main():
"""Main entry point for the script."""
if len(sys.argv) != 2:
Expand All @@ -76,6 +97,7 @@ def main():
repo_url = get_repo_url()
update_version_with_poetry(version)
update_changelog(version, repo_url)
confirm_version(version)
run_git_commands(version)


Expand Down

0 comments on commit 2de16c7

Please sign in to comment.