-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
GitHub CI
committed
Jul 21, 2023
1 parent
ddf9125
commit 7181240
Showing
6 changed files
with
99 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
from pathlib import Path | ||
import sys | ||
import toml | ||
|
||
|
||
PYPROJECT_FILE_PATH = "pyproject.toml" | ||
|
||
|
||
def project_root() -> Path: | ||
"""Root directory of the project.""" | ||
return Path(os.path.dirname(__file__)).parent | ||
|
||
|
||
def pyproject_file_path() -> Path: | ||
"""Path to the pyproject.toml.""" | ||
return project_root() / PYPROJECT_FILE_PATH | ||
|
||
|
||
def get_rasa_version_from_pyproject(pyproject_file=None) -> str: | ||
"""Fetch rasa version from pyproject.""" | ||
if pyproject_file is None: | ||
pyproject_file = pyproject_file_path() | ||
|
||
try: | ||
data = toml.load(pyproject_file) | ||
rasa_oss_version = data["tool"]["poetry"]["version"] | ||
return rasa_oss_version | ||
except (FileNotFoundError, TypeError): | ||
print(f"Unable to fetch from {pyproject_file}: file not found.") | ||
sys.exit(1) | ||
except toml.TomlDecodeError: | ||
print(f"Unable to parse {pyproject_file}: incorrect TOML file.") | ||
sys.exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
print(get_rasa_version_from_pyproject()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[build-system] | ||
requires = [ "poetry-core>=1.0.4",] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.black] | ||
line-length = 88 | ||
target-version = [ "py37", "py38", "py39", "py310",] | ||
exclude = "((.eggs | .git | .pytest_cache | build | dist))" | ||
|
||
[tool.poetry] | ||
name = "rasa" | ||
version = "3.7.1rc1" | ||
description = "Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants" | ||
authors = [ "Rasa Technologies GmbH <hi@rasa.com>",] | ||
maintainers = [ "Tom Bocklisch <tom@rasa.com>",] | ||
homepage = "https://rasa.com" | ||
repository = "https://github.com/rasahq/rasa" | ||
documentation = "https://rasa.com/docs" | ||
classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Libraries",] | ||
keywords = [ "nlp", "machine-learning", "machine-learning-library", "bot", "bots", "botkit", "rasa conversational-agents", "conversational-ai", "chatbot", "chatbot-framework", "bot-framework",] | ||
include = [ "LICENSE.txt", "README.md", "rasa/shared/core/training_data/visualization.html", "rasa/cli/default_config.yml", "rasa/shared/importers/*", "rasa/utils/schemas/*", "rasa/keys",] | ||
readme = "README.md" | ||
license = "Apache-2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from scripts.get_version_from_toml import get_rasa_version_from_pyproject | ||
import os | ||
|
||
|
||
def test_version_from_toml(): | ||
pyproject_file_path = os.path.dirname(__file__) + "/test.toml" | ||
expected = "3.7.1rc1" | ||
version = get_rasa_version_from_pyproject(pyproject_file=pyproject_file_path) | ||
assert version == expected |