diff --git a/CHANGELOG.md b/CHANGELOG.md index 330bdc2..de9b179 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +## TBD + +### Enhancements + +* Add `bugsnag.__version__` attribute for programmatic version checking as per PEP 396 specification + [#409](https://github.com/bugsnag/bugsnag-python/pull/409) + ## v4.8.0 (2024-07-08) ### Enhancements diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 901910d..e0072bd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,9 +97,21 @@ If you're on the core team, you can release Bugsnag as follows: git checkout -b release/v4.x.x ``` -* Update the version number in [`setup.py`](./setup.py) and `bugsnag/notifier.py`(./bugsnag/notifier.py) -* Update the CHANGELOG.md and README.md if necessary +* Update the version number using the Makefile + + ``` + make VERSION=4.x.x bump + ``` + +* Update the CHANGELOG.md (add version and date) and README.md if necessary * Commit and open a pull request into `master` + + ``` + git add bugsnag/__init__.py setup.py bugsnag/notifier.py CHANGELOG.md + git commit -m "Release v4.x.x" + git push origin release/v4.x.x + ``` + * Merge the PR when it's been reviewed * Create a release on GitHub, tagging the new version `v4.x.x` * Push the release to PyPI diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7a2e6c4 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +.PHONY: bump + +bump: ## Bump the version numbers to $VERSION +ifeq ($(VERSION),) + @$(error VERSION is not defined. Run with `make VERSION=number bump`) +endif + @echo Bumping the version number to $(VERSION) + @sed -i.bak "s/__version__ = '.*'/__version__ = '$(VERSION)'/" bugsnag/__init__.py && rm bugsnag/__init__.py.bak + @sed -i.bak "s/version='.*',/version='$(VERSION)',/" setup.py && rm setup.py.bak + @sed -i.bak "s/'version': '.*'/'version': '$(VERSION)'/" bugsnag/notifier.py && rm bugsnag/notifier.py.bak + @echo "Successfully bumped version to $(VERSION)" + @echo "Updated files: bugsnag/__init__.py, setup.py, bugsnag/notifier.py" diff --git a/bugsnag/__init__.py b/bugsnag/__init__.py index 9c023b2..6c4c9b6 100644 --- a/bugsnag/__init__.py +++ b/bugsnag/__init__.py @@ -18,6 +18,8 @@ clear_feature_flag, clear_feature_flags, aws_lambda_handler) +__version__ = '4.8.0' + __all__ = ('Client', 'Event', 'Configuration', 'RequestConfiguration', 'configuration', 'configure', 'configure_request', 'add_metadata_tab', 'clear_request_config', 'notify', @@ -27,4 +29,4 @@ 'OnBreadcrumbCallback', 'leave_breadcrumb', 'add_on_breadcrumb', 'remove_on_breadcrumb', 'FeatureFlag', 'add_feature_flag', 'add_feature_flags', 'clear_feature_flag', 'clear_feature_flags', - 'aws_lambda_handler') + 'aws_lambda_handler', '__version__') diff --git a/setup.py b/setup.py index 7c0b5e2..dccb2fb 100755 --- a/setup.py +++ b/setup.py @@ -49,5 +49,5 @@ install_requires=['webob'], extras_require={ 'flask': ['flask', 'blinker'] - }, + } )