From 4a5387164bb984d7d747cc39da37fa8d42e5a46c Mon Sep 17 00:00:00 2001 From: Laure-di Date: Thu, 9 Oct 2025 18:06:59 +0200 Subject: [PATCH 1/3] docs: make import package private to prevent documentation generation --- scaleway/scaleway/__init__.py | 21 +-------------------- scaleway/scaleway/_bridge.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 scaleway/scaleway/_bridge.py diff --git a/scaleway/scaleway/__init__.py b/scaleway/scaleway/__init__.py index 040211548..5837ed584 100644 --- a/scaleway/scaleway/__init__.py +++ b/scaleway/scaleway/__init__.py @@ -22,17 +22,7 @@ WaitForStopCondition, ) -from scaleway_core.bridge import ( - Money, - Region, - ALL_REGIONS, - Zone, - ALL_ZONES, - ScwFile, - ServiceInfo, - TimeSeriesPoint, - TimeSeries, -) +from . import _bridge __all__ = [ "API", @@ -43,13 +33,4 @@ "ProfileDefaults", "WaitForOptions", "WaitForStopCondition", - "Money", - "Region", - "ALL_REGIONS", - "Zone", - "ALL_ZONES", - "ScwFile", - "ServiceInfo", - "TimeSeriesPoint", - "TimeSeries", ] diff --git a/scaleway/scaleway/_bridge.py b/scaleway/scaleway/_bridge.py new file mode 100644 index 000000000..b5f208a27 --- /dev/null +++ b/scaleway/scaleway/_bridge.py @@ -0,0 +1,25 @@ +# scaleway_async/_bridge.py +from scaleway_core.bridge import ( + Money, + Region, + ALL_REGIONS, + Zone, + ALL_ZONES, + ScwFile, + ServiceInfo, + TimeSeriesPoint, + TimeSeries, +) + +__all__ = [ + "Money", + "Region", + "ALL_REGIONS", + "Zone", + "ALL_ZONES", + "ScwFile", + "ServiceInfo", + "TimeSeriesPoint", + "TimeSeries", +] + From bd2aecf2f46513d93c789e6bb58f248298452bf6 Mon Sep 17 00:00:00 2001 From: Laure-di Date: Wed, 15 Oct 2025 15:07:47 +0200 Subject: [PATCH 2/3] doc: move dependancies to private file --- scaleway-async/scaleway_async/__init__.py | 3 ++ .../scaleway_async/bridge.py | 3 +- scaleway/scaleway/__init__.py | 35 ++----------- scaleway/scaleway/_dependancies.py | 52 +++++++++++++++++++ 4 files changed, 61 insertions(+), 32 deletions(-) rename scaleway/scaleway/_bridge.py => scaleway-async/scaleway_async/bridge.py (92%) create mode 100644 scaleway/scaleway/_dependancies.py diff --git a/scaleway-async/scaleway_async/__init__.py b/scaleway-async/scaleway_async/__init__.py index c22dc86a4..40d19a47a 100644 --- a/scaleway-async/scaleway_async/__init__.py +++ b/scaleway-async/scaleway_async/__init__.py @@ -52,4 +52,7 @@ "ServiceInfo", "TimeSeriesPoint", "TimeSeries", + "InstanceV1API", ] + +from scaleway_async.instance.v1 import InstanceV1API diff --git a/scaleway/scaleway/_bridge.py b/scaleway-async/scaleway_async/bridge.py similarity index 92% rename from scaleway/scaleway/_bridge.py rename to scaleway-async/scaleway_async/bridge.py index b5f208a27..d3d97c2d1 100644 --- a/scaleway/scaleway/_bridge.py +++ b/scaleway-async/scaleway_async/bridge.py @@ -1,4 +1,4 @@ -# scaleway_async/_bridge.py +# scaleway_async/bridge.py from scaleway_core.bridge import ( Money, Region, @@ -22,4 +22,3 @@ "TimeSeriesPoint", "TimeSeries", ] - diff --git a/scaleway/scaleway/__init__.py b/scaleway/scaleway/__init__.py index 5837ed584..f4dd43189 100644 --- a/scaleway/scaleway/__init__.py +++ b/scaleway/scaleway/__init__.py @@ -2,35 +2,10 @@ import importlib.metadata -__version__: str = importlib.metadata.version(__name__) +__version__ = importlib.metadata.version(__name__) -from scaleway_core.api import ( - API, - ScalewayException, -) +# import internal dependencies +from ._dependancies import * -from scaleway_core.client import Client - -from scaleway_core.profile import ( - Profile, - ProfileConfig, - ProfileDefaults, -) - -from scaleway_core.utils.waiter import ( - WaitForOptions, - WaitForStopCondition, -) - -from . import _bridge - -__all__ = [ - "API", - "ScalewayException", - "Client", - "Profile", - "ProfileConfig", - "ProfileDefaults", - "WaitForOptions", - "WaitForStopCondition", -] +# optional: explicitly define __all__ for public API +# __all__ = _dependancies.__all__ diff --git a/scaleway/scaleway/_dependancies.py b/scaleway/scaleway/_dependancies.py new file mode 100644 index 000000000..6264fcc55 --- /dev/null +++ b/scaleway/scaleway/_dependancies.py @@ -0,0 +1,52 @@ +# scaleway_async/_dependancies.py + +from scaleway_core.api import ( + API, + ScalewayException, +) + +from scaleway_core.client import Client + +from scaleway_core.profile import ( + Profile, + ProfileConfig, + ProfileDefaults, +) + +from scaleway_core.utils.waiter import ( + WaitForOptions, + WaitForStopCondition, +) + +from scaleway_core.bridge import ( + Money, + Region, + ALL_REGIONS, + Zone, + ALL_ZONES, + ScwFile, + ServiceInfo, + TimeSeriesPoint, + TimeSeries, +) + +__all__ = [ + "API", + "ScalewayException", + "Client", + "Profile", + "ProfileConfig", + "ProfileDefaults", + "WaitForOptions", + "WaitForStopCondition", + "Money", + "Region", + "ALL_REGIONS", + "Zone", + "ALL_ZONES", + "ScwFile", + "ServiceInfo", + "TimeSeriesPoint", + "TimeSeries", +] + From dd60519d0d1bdf02de0f4a9514206676098c1b1f Mon Sep 17 00:00:00 2001 From: Laure-di Date: Wed, 15 Oct 2025 15:49:36 +0200 Subject: [PATCH 3/3] refacto script --- docs/generate_docs.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 docs/generate_docs.sh diff --git a/docs/generate_docs.sh b/docs/generate_docs.sh new file mode 100755 index 000000000..2622383a1 --- /dev/null +++ b/docs/generate_docs.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Chemins vers les packages racines (doivent contenir __init__.py et des sous-modules) +SCALEWAY_PKG="../scaleway/scaleway" +CORE_PKG="../scaleway-core/scaleway_core" +ASYNC_PKG="../scaleway-async/scaleway_async" + +# Vérifier que les dossiers racines existent et sont bien des packages +for pkg in "$SCALEWAY_PKG" "$CORE_PKG" "$ASYNC_PKG"; do + if [ ! -d "$pkg" ]; then + echo "❌ Erreur : Le dossier '$pkg' n'existe pas." + exit 1 + fi + if [ ! -f "$pkg/__init__.py" ] ; then + echo "⚠️ Attention : '$pkg' ne semble pas être un package Python (pas de __init__.py)." + fi + echo "✅ Package trouvé : $pkg" +done + +# Exporter PYTHONPATH pour que tous les modules soient accessibles +export PYTHONPATH="..:$PYTHONPATH" + +# Générer la doc pour chaque package racine (pdoc explore automatiquement les sous-modules) +echo "📚 Génération de la documentation avec pdoc..." +poetry run pdoc \ + -o html \ + -d google \ + "$SCALEWAY_PKG" \ + "$CORE_PKG" \ + "$ASYNC_PKG" + +if [ $? -eq 0 ]; then + echo "✅ Documentation générée avec succès dans le dossier 'html/'." +else + echo "❌ Échec de la génération de la documentation." + exit 1 +fi \ No newline at end of file