Add Scaleway Object Storage backup integration#166868
Add Scaleway Object Storage backup integration#166868BjoernPetersen wants to merge 4 commits intohome-assistant:devfrom
Conversation
There was a problem hiding this comment.
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
There was a problem hiding this comment.
Pull request overview
Adds a new Home Assistant integration to store backups in Scaleway Object Storage, including config flow support and initial test coverage.
Changes:
- Introduces
scaleway_object_storageintegration (config flow, backup agent, exceptions, translations, quality scale metadata). - Adds config flow tests (user / reauth / reconfigure) and shared fixtures.
- Registers dependency (
aiohttp-s3-client), code ownership, strict typing, and generated registry updates.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/components/scaleway_object_storage/test_config_flow_step_user.py | Adds user-step config flow tests. |
| tests/components/scaleway_object_storage/test_config_flow_step_reconfigure.py | Adds reconfigure-step config flow tests. |
| tests/components/scaleway_object_storage/test_config_flow_step_reauth.py | Adds reauth-step config flow tests. |
| tests/components/scaleway_object_storage/conftest.py | Adds shared fixtures for Scaleway Object Storage tests. |
| tests/components/scaleway_object_storage/init.py | Initializes the test package. |
| requirements_test_all.txt | Adds aiohttp-s3-client to test requirements. |
| requirements_all.txt | Adds aiohttp-s3-client to runtime requirements. |
| mypy.ini | Enables strict mypy settings for the new integration package. |
| homeassistant/generated/integrations.json | Registers the new integration in generated metadata. |
| homeassistant/generated/config_flows.py | Adds the integration domain to generated config flow registry. |
| homeassistant/components/scaleway_object_storage/strings.json | Adds config flow text, selector options, and exception translations. |
| homeassistant/components/scaleway_object_storage/quality_scale.yaml | Declares quality scale compliance status for the integration. |
| homeassistant/components/scaleway_object_storage/manifest.json | Defines integration metadata and dependency requirements. |
| homeassistant/components/scaleway_object_storage/helpers.py | Adds S3 client creation, connection check, and metadata read helpers. |
| homeassistant/components/scaleway_object_storage/exceptions.py | Adds translated, typed exception hierarchy for config/runtime errors. |
| homeassistant/components/scaleway_object_storage/const.py | Adds integration constants (config keys, limits, headers). |
| homeassistant/components/scaleway_object_storage/config_flow.py | Implements user / reauth / reconfigure config flow steps. |
| homeassistant/components/scaleway_object_storage/backup.py | Implements BackupAgent against Scaleway S3-compatible object storage. |
| homeassistant/components/scaleway_object_storage/init.py | Sets up the config entry and wires runtime client creation. |
| CODEOWNERS | Assigns ownership for the new integration and its tests. |
| .strict-typing | Marks the new integration for strict typing enforcement. |
homeassistant/components/scaleway_object_storage/config_flow.py
Outdated
Show resolved
Hide resolved
24c5809 to
0cd40e8
Compare
cffb3f4 to
f30177a
Compare
homeassistant/components/scaleway_object_storage/config_flow.py
Outdated
Show resolved
Hide resolved
homeassistant/components/scaleway_object_storage/config_flow.py
Outdated
Show resolved
Hide resolved
f30177a to
c3bf285
Compare
3b5b5e8 to
d6972ae
Compare
d6972ae to
b3830b6
Compare
01ee5ee to
a2ac1a7
Compare
a2ac1a7 to
ba4d663
Compare
ba4d663 to
2cd6049
Compare
2cd6049 to
f6b1b3b
Compare
f6b1b3b to
e848757
Compare
homeassistant/components/scaleway_object_storage/config_flow.py
Outdated
Show resolved
Hide resolved
homeassistant/components/scaleway_object_storage/config_flow.py
Outdated
Show resolved
Hide resolved
| if bucket_scoped: | ||
| if "." in bucket_name: | ||
| # fall back to canonical path addressing | ||
| # see https://www.scaleway.com/en/docs/object-storage/faq/#is-there-a-limitation-in-the-bucket-name | ||
| endpoint_url = f"https://s3.{region}.scw.cloud/{bucket_name}" | ||
| else: | ||
| endpoint_url = f"https://{bucket_name}.s3.{region}.scw.cloud" | ||
| else: | ||
| endpoint_url = f"https://s3.{region}.scw.cloud" |
There was a problem hiding this comment.
Isn't this something the library should handle?
(Hold off on any library changes for now, will ask someone who worked on backup integrations to have a look)
There was a problem hiding this comment.
Now that you pointed it out, I at least found a way to simplify this to two cases.
As far as I saw, other S3-based backup integrations expect an endpoint URL and a bucket name and let aiobotocore auto-select the addressing style. As noted in the original PR body, I decided against aiobotocore because its asyncio support is pretty flawed. I also thought that it's more user-friendly to avoid an endpoint URL user input since Scaleway offers very few choices anyway.
Other than (aio)botocore, the aiohttp-s3-client library will not build a virtual-host style URL by itself, so further simplifying the integration code here would mean either changing the library, or always using path-style addressing. S3-API providers generally prefer it if you use virtual-host style (AWS has deprecated path-style addressing years ago). In any case, the library will never fill in Scaleway-specifics (s3.{region}.scw.cloud) for us.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Reduce code to make review easier.
Reduce code to make review easier.
Proposed change
This PR adds a new Scaleway Object Storage integration that allows users to store Home Assistant backups in Scaleway Object Storage.
Type of change
Additional information
No AI tools were used to create this PR (except for the Copilot PR review over here).
I choose the
aiohttp-s3-clientpackage as a dependency because - other than aiobotocore - it's a fully async dependendency and offers type hints without a separate stub package.I plan to add further improvements and achieve a higher ranking on the quality scale in the future. This PR just adds what I consider a "basic" feature set. I'm sorry it's still that large, but I guess that's unavoidable when adding a completely new integration 😅.
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: