Skip to content

replaced discontinued toml with tomlkit #5

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

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

* Replaced `toml` with `tomlkit` as the former is not available for python past 3.9.

### Removed


Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ ruff
sphinx_compas2_theme
twine
wheel
toml
tomlkit
8 changes: 6 additions & 2 deletions src/compas_invocations2/grasshopper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import invoke
import requests
import toml
import tomlkit

from compas_invocations2.console import chdir

Expand Down Expand Up @@ -58,7 +58,11 @@ def _clear_directory(path_to_dir):


def _get_version_from_toml(toml_file: str) -> str:
pyproject_data = toml.load(toml_file)
with open(toml_file, "r") as f:
pyproject_data = tomlkit.load(f)
if not pyproject_data:
raise invoke.Exit("Failed to load pyproject.toml.")

version = pyproject_data.get("tool", {}).get("bumpversion", {}).get("current_version", None)
if not version:
raise invoke.Exit("Failed to get version from pyproject.toml. Please provide a version number.")
Expand Down