Skip to content

Commit

Permalink
feat: Support version in generate script (box/box-codegen#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build committed Mar 4, 2024
1 parent a50d189 commit 2149f34
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "1ec6b5f", "specHash": "b2f7568", "version": "0.5.1" }
{ "engineHash": "be0f8b2", "specHash": "b2f7568", "version": "0.5.1" }
34 changes: 34 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"types": [
{
"type": "feat",
"section": "New Features and Enhancements",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "chore",
"hidden": true
},
{
"type": "docs",
"hidden": true
},
{
"type": "style",
"hidden": true
},
{
"type": "refactor",
"hidden": true
},
{
"type": "test",
"hidden": true
}
]
}
3 changes: 2 additions & 1 deletion box_sdk_gen/networking/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
sd_to_url_params,
json_to_serialized_data,
)
from .version import __version__

DEFAULT_MAX_ATTEMPTS = 5
_RETRY_RANDOMIZATION_FACTOR = 0.5
_RETRY_BASE_INTERVAL = 1
SDK_VERSION = '0.1.0'
SDK_VERSION = __version__
USER_AGENT_HEADER = f'box-python-generated-sdk-{SDK_VERSION}'
X_BOX_UA_HEADER = (
f'agent=box-python-generated-sdk/{SDK_VERSION}; '
Expand Down
1 change: 1 addition & 0 deletions box_sdk_gen/networking/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.5.1'
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@

from os.path import dirname, join

import re


def main():
install_requires = ['requests', 'requests_toolbelt']
install_requires = ['requests', 'requests-toolbelt']
tests_require = ['pytest', 'pytest-timeout', 'pytest-cov']
dev_requires = ['tox']
jwt_requires = ['pyjwt>=1.7.0', 'cryptography>=3']
version_file = open(join(dirname(__file__), 'box_sdk_gen/networking/version.py'))
version_regex = re.compile('.*__version__ = \'(.*?)\'', re.S)
version_string_grouped = version_regex.match(version_file.read())
__version__ = version_string_grouped.group(1)
extras_require = {
'test': tests_require + jwt_requires,
'dev': dev_requires,
'jwt': jwt_requires,
}
setup(
name='box-sdk-gen',
version='0.1.0',
version=__version__,
description='[Box Platform](https://box.dev) provides functionality to provide access to content stored within [Box](https://box.com). It provides endpoints for basic manipulation of files and folders, management of users within an enterprise, as well as more complex topics such as legal holds and retention policies.',
url='https://github.com/box/box-python-sdk-gen.git',
licence='Apache-2.0, http://www.apache.org/licenses/LICENSE-2.0',
Expand Down

0 comments on commit 2149f34

Please sign in to comment.