Skip to content

Convert to namespace package#130

Merged
bryfox merged 6 commits intomainfrom
bryan/fg-12641-namespace-package
Aug 12, 2025
Merged

Convert to namespace package#130
bryfox merged 6 commits intomainfrom
bryan/fg-12641-namespace-package

Conversation

@bryfox
Copy link
Copy Markdown
Contributor

@bryfox bryfox commented Aug 8, 2025

Changelog

Release as a namespace package. This should have no effect on most users.

Docs

None

Description

This converts foxglove-client to an implicit namespace package for better compatibility with the Foxglove SDK. The SDK also uses the foxglove namespace, and currently can't be installed alongside foxglove-client without workarounds.

foxglove/__init__.py is removed, and all code is moved into a client sub-package. I put the core code in client/api.py so as not to have everything in the init file.

For most users, this should not be a breaking change. Usage from the example remains the same: basically, from foxglove.client import Client.

Only the contents of __all__ are exported from the client package. Other symbols (DEFAULT_DECODER_FACTORIES, camelize, bool_query_param, without_nulls) appear to be for internal use, so I explicitly didn't re-export them. This is a breaking change for anyone who uses them, and I did so intentionally to avoid polluting the primary package. These can now be imported from foxglove.client.api if needed. There may be some other edge cases that would break — e.g. relying on file or path locations — but I can't think of any likely cases.

@linear
Copy link
Copy Markdown

linear Bot commented Aug 8, 2025

@@ -0,0 +1,3 @@
from .api import Client, FoxgloveException, OutputFormat

__all__ = ["Client", "FoxgloveException", "OutputFormat"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does this actually change anything when those 3 names are exactly the ones that have already been imported?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, I can remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Flake8 complains about unused imports in that case; I left this in place rather than ignoring the warning.

Comment thread setup.cfg
python_requires = >=3.7

[options.packages.find]
include = foxglove*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does this mean we were previously including tests in the published package? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no, I think it's different behavior with find_namespace

@bryfox
Copy link
Copy Markdown
Contributor Author

bryfox commented Aug 12, 2025

I added a minor version bump for the next release: 0.16.2->0.17.0

@bryfox bryfox merged commit 961ecce into main Aug 12, 2025
1 check passed
@bryfox bryfox deleted the bryan/fg-12641-namespace-package branch August 12, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants