Skip to content

Adding makefile to bump __verion__ at 3 places.#409

Open
SB-PawanN wants to merge 2 commits intonextfrom
Pawan/PLAT-5521--version--
Open

Adding makefile to bump __verion__ at 3 places.#409
SB-PawanN wants to merge 2 commits intonextfrom
Pawan/PLAT-5521--version--

Conversation

@SB-PawanN
Copy link

@SB-PawanN SB-PawanN commented Mar 18, 2026

Goal

Implement [bugsnag.version] attribute for programmatic version checking and establish a single source of truth for version management.

Design

VERSION file as the single source of truth. All files ([setup.py], [init.py], [notifier.py]) read from this file. Exposes [bugsnag.version] for programmatic access.

Changeset

  • Added VERSION file containing 4.8.0
  • Updated [init.py] - Exposes [version] attribute
  • Updated [setup.py]& [notifier.py] - Read from VERSION
  • Added [MANIFEST.in] - Includes VERSION in distributions
  • Updated [CHANGELOG.md] & [CONTRIBUTING.md]
  • Updated [env.rb]- Include VERSION in tests

Testing

[bugsnag.version] returns '4.8.0'

All unit tests passing (Python 3.5-3.14)

All maze-runner tests passing

44/44 CI checks successful
Impact: New [version] attribute available. Version now managed in one file.

@SB-PawanN SB-PawanN requested a review from Copilot March 18, 2026 15:41
@SB-PawanN SB-PawanN requested review from tomlongridge and twometresteve and removed request for Copilot March 18, 2026 15:43
@twometresteve
Copy link
Contributor

twometresteve commented Mar 18, 2026

Note that the main intent of the ticket was:

Ideally the version should be returned when bugsnag.__version__ is called.

I can see how the changes so far contribute towards that, but the task isn't quite complete without that. Once it's added then you can meaningfully add an "Enhancement" to CHANGELOG.md for it.

@twometresteve
Copy link
Contributor

When is the maintainer expected to run make bump? I'd expect the release process in CONTRIBUTING.md to be updated to details that.

@tomlongridge
Copy link
Contributor

When is the maintainer expected to run make bump? I'd expect the release process in CONTRIBUTING.md to be updated to details that.

Yes - we need to update that instruction.

Note that this works differently to the other bump scripts which take a parameter and update all the files.

@SB-PawanN SB-PawanN force-pushed the Pawan/PLAT-5521--version-- branch from fb4978a to aa18195 Compare March 19, 2026 06:38
This implements the requested feature to expose bugsnag.__version__
for programmatic version checking, as per PEP 396.

Changes:
- Created VERSION file containing current version (4.8.0)
- Updated bugsnag/__init__.py to read from VERSION and expose __version__
- Updated setup.py to read version from VERSION file
- Updated bugsnag/notifier.py to read version from VERSION file
- Added MANIFEST.in to include VERSION in package distributions
- Updated CHANGELOG.md with enhancement entry
- Updated CONTRIBUTING.md to document simplified release process

Benefits:
- Single source of truth for version number (no more manual updates in 3 places)
- bugsnag.__version__ now available for programmatic access
- Graceful fallback to 'unknown' if VERSION file is missing
@SB-PawanN SB-PawanN force-pushed the Pawan/PLAT-5521--version-- branch from aa18195 to f8a1284 Compare March 19, 2026 06:56
@SB-PawanN
Copy link
Author

I've completely revised this PR based on your feedback. The previous Makefile approach has been replaced with a cleaner VERSION file solution.

Previous approach:

  • Used Makefile for version bumping
  • Missing bugsnag.__version__ attribute (main requirement)

New approach:

  • Implements bugsnag.__version__ attribute and returns the installed version programmatically
  • VERSION file as single source of truth
  • All 3 files (__init__.py, setup.py, notifier.py) read from VERSION
  • Updated CHANGELOG.md with enhancement entry
  • Updated CONTRIBUTING.md with simplified release process

Ready for review!

Implements bugsnag.__version__ for programmatic version checking (PEP 396).
Uses Makefile approach (inspired by bugsnag-cocoa) to address performance concerns.

Changes:
- Added __version__ = '4.8.0' to bugsnag/__init__.py
- Hardcoded version='4.8.0' in setup.py
- Hardcoded 'version': '4.8.0' in bugsnag/notifier.py
- Added Makefile with bump target for automated version updates
- Updated CHANGELOG.md with enhancement entry
- Updated CONTRIBUTING.md to document Makefile usage
- Removed VERSION file and MANIFEST.in (no runtime file I/O overhead)
- Updated features/support/env.rb (removed VERSION from test fixtures)

Usage:
- Users: bugsnag.__version__ returns '4.8.0'
- Maintainers: make VERSION=x.y.z bump (updates all 3 files)

Benefits:
- Zero runtime overhead (no file I/O during import)
- bugsnag.__version__ attribute now available
- Automated version updates via single Makefile command
- Addresses reviewer feedback on performance concerns
Copy link
Contributor

@tomlongridge tomlongridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, but looks good otherwise.

Can you also update the PR description as it's not reflecting your current approach.

Comment on lines +8 to +10
* Add `__version__` attribute for programmatic version checking
* `bugsnag.__version__` now returns the installed package version
* Follows PEP 396 specification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this snappy:

Suggested change
* Add `__version__` attribute for programmatic version checking
* `bugsnag.__version__` now returns the installed package version
* Follows PEP 396 specification
* Add `bugsnag.__version__` attribute for programmatic version checking as per PEP 396 specification
[#409](https://github.com/bugsnag/bugsnag-python/pull/409)

Also include the PR link.

extras_require={
'flask': ['flask', 'blinker']
},
'flask': []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants