Skip to content
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

Generated SDK #3652 #64

Merged
merged 1 commit into from
Jun 25, 2024
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
20 changes: 20 additions & 0 deletions .bump_version.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[tool.bumpversion]
commit = false
tag = false
current_version = "placeholder_version"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\-(?P<release>[a-z]+))?"
serialize = [
"{major}.{minor}.{patch}-{release}",
"{major}.{minor}.{patch}"
]
[[tool.bumpversion.files]]
filename = "setup.py"

[[tool.bumpversion.files]]
filename = "pyproject.toml"

[[tool.bumpversion.files]]
filename = "fireblocks/__init__.py"

[[tool.bumpversion.files]]
filename = "fireblocks/configuration.py"
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
os: [macos-11, macos-12, windows-latest, ubuntu-20.04, ubuntu-22.04]
os: [macos-12, windows-latest, ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
46 changes: 43 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,52 @@ on:
types: [published]

jobs:
deploy:

bump-version:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bump-my-version
- name: Bump version
run: |
initialTag=${{ github.event.release.tag_name }}
tag="${initialTag//[v]/}"
echo $tag
git remote update
git fetch
echo "finished fetching"
git checkout --track origin/master
echo "finished checkout"
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
echo "finished configuration"
bump-my-version bump --config-file .bump_version.toml --current-version 0.0.0 --new-version $tag
echo "bumpversion finished"
git add .
git commit -m "release $tag"
git push
- name: Move tag
run: |
TAG_NAME=${{ github.event.release.tag_name }}
echo $tag
git tag -d $TAG_NAME
git push origin :refs/tags/$TAG_NAME
git tag $TAG_NAME
git push origin $TAG_NAME

publish:
needs: bump-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check out repository code
uses: actions/checkout@v3
with:
token: ${{ secrets.RELEASE_TOKEN }}
- name: Set up Python
Expand Down
1 change: 1 addition & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.bump_version.toml
.gitignore
LICENSE.txt
README.md
Expand Down
2 changes: 1 addition & 1 deletion fireblocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
""" # noqa: E501


__version__ = "1.0.3"
__version__ = "0.0.0"

# import apis into sdk package
from fireblocks.api.api_user_api import ApiUserApi
Expand Down
2 changes: 1 addition & 1 deletion fireblocks/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = "OpenAPI-Generator/1.0.3/python"
self.user_agent = "fireblocks/sdk/python"
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
Expand Down
2 changes: 1 addition & 1 deletion fireblocks/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def to_debug_report(self):
"OS: {env}\n"
"Python Version: {pyversion}\n"
"Version of the API: 1.6.2\n"
"SDK Package Version: 1.0.3".format(env=sys.platform, pyversion=sys.version)
"SDK Package Version: 0.0.0".format(env=sys.platform, pyversion=sys.version)
)

def get_host_settings(self):
Expand Down
3 changes: 2 additions & 1 deletion fireblocks/user_agent_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
""" # noqa: E501

import platform
from fireblocks import __version__


class UserAgentUtil:
@staticmethod
def get_user_agent(is_anonymous_platform: bool, custom_user_agent: str) -> str:
user_agent = "fireblocks/sdk/python/1.0.3"
user_agent = f"fireblocks/sdk/python/{__version__}"
if not is_anonymous_platform:
os_type = platform.system()
os_version = platform.release()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fireblocks"
version = "1.0.3"
version = "0.0.0"
description = "Fireblocks API"
authors = ["Fireblocks <[email protected]>"]
license = "MIT License"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
NAME = "fireblocks"
VERSION = "1.0.3"
VERSION = "0.0.0"
PYTHON_REQUIRES = ">=3.8"
REQUIRES = [
"urllib3 >= 1.25.3, < 2.1.0",
Expand Down
9 changes: 5 additions & 4 deletions test/fireblocks/test_user_agent_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import pytest
from fireblocks.user_agent_util import UserAgentUtil
from fireblocks import __version__

@pytest.fixture
def mock_platform(mocker):
Expand All @@ -21,10 +22,10 @@ def mock_platform(mocker):
mocker.patch('platform.machine', return_value="x86_64")

@pytest.mark.parametrize("is_anonymous_platform, user_agent, expected", [
(False, "customUserAgent", "customUserAgent fireblocks/sdk/python/1.0.3 (Linux 5.4.0-42-generic; x86_64)"),
(True, "customUserAgent", "customUserAgent fireblocks/sdk/python/1.0.3"),
(False, None, "fireblocks/sdk/python/1.0.3 (Linux 5.4.0-42-generic; x86_64)"),
(True, None, "fireblocks/sdk/python/1.0.3")])
(False, "customUserAgent", f"customUserAgent fireblocks/sdk/python/{__version__} (Linux 5.4.0-42-generic; x86_64)"),
(True, "customUserAgent", f"customUserAgent fireblocks/sdk/python/{__version__}"),
(False, None, f"fireblocks/sdk/python/{__version__} (Linux 5.4.0-42-generic; x86_64)"),
(True, None, f"fireblocks/sdk/python/{__version__}")])
def test_get_user_agent(mock_platform, is_anonymous_platform, user_agent, expected):
# Create an instance of UserAgentUtil
util = UserAgentUtil()
Expand Down
Loading