Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideBumps the project version from 1.3.0 to 1.4.0 in both the packaging metadata and the library’s exposed version constant to prepare for the v1.4.0 release. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="pystreamapi/__init__.py" line_range="4" />
<code_context>
from pystreamapi._streams.error.__levels import ErrorLevel
-__version__ = "1.3.0"
+__version__ = "1.4.0"
__all__ = ["Stream", "ErrorLevel"]
</code_context>
<issue_to_address>
**suggestion:** Consider deriving __version__ from pyproject.toml (or a single source) to avoid drift between version declarations.
Having the version in both pyproject.toml and __init__.py increases the risk of mismatch. Consider reading it from a single authoritative source (e.g., importlib.metadata, a generated _version module, or a small script) so it only needs updating in one place.
Suggested implementation:
```python
from importlib import metadata
from pystreamapi.__stream import Stream
from pystreamapi._streams.error.__levels import ErrorLevel
try:
# Derive version from package metadata (pyproject.toml / setup)
__version__ = metadata.version("pystreamapi")
except metadata.PackageNotFoundError:
# Fallback for editable / local usage when package metadata is unavailable
__version__ = "0.0.0"
__all__ = ["Stream", "ErrorLevel"]
```
1. Ensure the project name in `pyproject.toml` is exactly `"pystreamapi"` so `metadata.version("pystreamapi")` matches the distribution name.
2. If you want `__version__` to be part of the public API, you may also want to add `"__version__"` to `__all__` elsewhere in your codebase, or in this file.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| from pystreamapi._streams.error.__levels import ErrorLevel | ||
|
|
||
| __version__ = "1.3.0" | ||
| __version__ = "1.4.0" |
There was a problem hiding this comment.
suggestion: Consider deriving version from pyproject.toml (or a single source) to avoid drift between version declarations.
Having the version in both pyproject.toml and init.py increases the risk of mismatch. Consider reading it from a single authoritative source (e.g., importlib.metadata, a generated _version module, or a small script) so it only needs updating in one place.
Suggested implementation:
from importlib import metadata
from pystreamapi.__stream import Stream
from pystreamapi._streams.error.__levels import ErrorLevel
try:
# Derive version from package metadata (pyproject.toml / setup)
__version__ = metadata.version("pystreamapi")
except metadata.PackageNotFoundError:
# Fallback for editable / local usage when package metadata is unavailable
__version__ = "0.0.0"
__all__ = ["Stream", "ErrorLevel"]- Ensure the project name in
pyproject.tomlis exactly"pystreamapi"sometadata.version("pystreamapi")matches the distribution name. - If you want
__version__to be part of the public API, you may also want to add"__version__"to__all__elsewhere in your codebase, or in this file.
|



Summary by Sourcery
Build: