diff --git a/.github/workflows/Pyinstaller-windows.yml b/.github/workflows/Pyinstaller-windows.yml index 6fa23b1..599ac1d 100644 --- a/.github/workflows/Pyinstaller-windows.yml +++ b/.github/workflows/Pyinstaller-windows.yml @@ -33,7 +33,7 @@ jobs: zip -r osc-cli-x86_64.zip pkg/osc-cli ./pkg/osc-cli/osc-cli.exe api ReadRegions | grep api.eu-west-2.outscale.com - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v5 if: ${{ github.event_name != 'push' }} with: name: osc-cli-win diff --git a/.github/workflows/pull-local-request.yml b/.github/workflows/pull-local-request.yml index 71fe1fd..b19650b 100644 --- a/.github/workflows/pull-local-request.yml +++ b/.github/workflows/pull-local-request.yml @@ -13,11 +13,11 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v5 - - uses: pre-commit/action@v3.0.0 + - uses: pre-commit/action@v3.0.1 - name: setup fuse run: | sudo apt-get update --fix-missing - sudo apt-get install -y -f -o Acquire::Retries=3 libfuse2 + sudo apt-get install -y -f -o Acquire::Retries=3 libfuse2 desktop-file-utils - name: Package bdist run: make build - name: Package AppImage @@ -25,7 +25,7 @@ jobs: cd pkg && make osc-cli-x86_64.AppImage ./osc-cli-x86_64.AppImage 2>&1 | grep Usage - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v5 with: name: osc-cli path: | @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - uses: pre-commit/action@v2.0.3 + - uses: pre-commit/action@v3.0.1 - name: Set up Python uses: actions/setup-python@v2 with: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 9418e4e..ad4ba8e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -13,11 +13,11 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v5 - - uses: pre-commit/action@v3.0.0 + - uses: pre-commit/action@v3.0.1 - name: setup fuse run: | sudo apt-get update --fix-missing - sudo apt-get install -y -f -o Acquire::Retries=3 libfuse2 + sudo apt-get install -y -f -o Acquire::Retries=5 libfuse2 desktop-file-utils - name: Package bdist run: make build - name: Package AppImage @@ -28,7 +28,7 @@ jobs: cd pkg && make ./configure --py3_ver=11 --arch_old=2014 && make osc-cli-x86_64.AppImage ./osc-cli-x86_64.AppImage 2>&1 | grep Usage - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v5 with: name: osc-cli path: | @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - uses: pre-commit/action@v2.0.3 + - uses: pre-commit/action@v3.0.1 - name: Set up Python uses: actions/setup-python@v2 with: @@ -75,18 +75,3 @@ jobs: OSC_TEST_REGION: ${{ secrets.OSC_TEST_REGION }} - name: Test python package building run: make build - dependabot-auto-merge: - needs: [tests-packaging, tests-app] - runs-on: ubuntu-latest - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@v1.1.1 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Auto-merge - run: gh pr merge --auto --rebase "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5f61ae4..110cfce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer diff --git a/README.md b/README.md index 7a5cfb6..d267d58 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Official command-line interface for the OUTSCALE API. -> **Maintenance mode**: bug fixes only; no new features. +> **Maintenance mode**: bug fixes only; no new features. > Looking for new features and an improved UX? See **[oapi-cli](https://github.com/outscale/oapi-cli)**. ## Quick start @@ -74,4 +74,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). ## License -BSD-3-Clause. See [LICENSE](LICENSE). \ No newline at end of file +BSD-3-Clause. See [LICENSE](LICENSE). diff --git a/docs/faq.md b/docs/faq.md index af8c23d..67a02f3 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -1,10 +1,10 @@ # FAQ -**Is osc-cli still maintained?** +**Is osc-cli still maintained?** Yes, in maintenance mode (bug fixes only). Prefer `oapi-cli` for new features. -**Where is the configuration file?** +**Where is the configuration file?** `~/.osc/config.json` -**How do I list available services/actions?** +**How do I list available services/actions?** Consult the OUTSCALE API documentation and service references at https://docs.outscale.com/en/ diff --git a/docs/install/windows.md b/docs/install/windows.md index bdbebb2..dbf02ba 100644 --- a/docs/install/windows.md +++ b/docs/install/windows.md @@ -74,4 +74,4 @@ This guide explains how to install and configure `osc-cli` on a Windows system. osc-cli api ReadVolumes ``` -If everything is correctly configured, you should see a JSON response from the Outscale API. \ No newline at end of file +If everything is correctly configured, you should see a JSON response from the Outscale API. diff --git a/osc_sdk/sdk.py b/osc_sdk/sdk.py index 43db46e..0f6e30a 100755 --- a/osc_sdk/sdk.py +++ b/osc_sdk/sdk.py @@ -16,7 +16,7 @@ import fire import requests import xmltodict -from requests.models import Request, Response +from requests.models import Response from typing_extensions import TypedDict CANONICAL_URI = "/" @@ -141,8 +141,8 @@ def __str__(self) -> str: return ( f"Error --> status = {self.status_code}, " f"code = {self.error_code}, " - f'{"code_type = " if self.code_type is not None else ""}' - f'{self.code_type + ", " if self.code_type is not None else ""}' + f"{'code_type = ' if self.code_type is not None else ''}" + f"{self.code_type + ', ' if self.code_type is not None else ''}" f"Reason = {self.message}, " f"request_id = {self.request_id}" ) @@ -389,7 +389,7 @@ def make_request(self, call: str, **kwargs: CallParameters): "content-type": self.CONTENT_TYPE, "host": self.host, "x-amz-date": self.date, - "x-amz-target": f'{self.API_NAME}_{datetime.date.today().strftime("%Y%m%d")}.{call}', + "x-amz-target": f"{self.API_NAME}_{datetime.date.today().strftime('%Y%m%d')}.{call}", } payload_hash = hashlib.sha256( @@ -521,7 +521,7 @@ def build_headers(self, target: str, json_parameters: str) -> Headers: signed_headers = "host;x-amz-date;x-amz-target" canonical_headers = ( - f"host:{self.host}\n" f"x-amz-date:{self.date}\n" f"x-amz-target:{target}\n" + f"host:{self.host}\nx-amz-date:{self.date}\nx-amz-target:{target}\n" ) headers = { "content-type": self.CONTENT_TYPE, @@ -607,7 +607,7 @@ def get_parameters( # Specific to ICU if ( self.authentication_method == "accesskey" - or self.authentication_method == None + or self.authentication_method is None ): data.update({"AuthenticationMethod": "accesskey"}) @@ -702,7 +702,7 @@ def build_headers(self, target: str, _) -> Headers: signed_headers = "host;x-osc-date;x-osc-target" canonical_headers = ( - f"host:{self.host}\n" f"x-osc-date:{self.date}\n" f"x-osc-target:{target}\n" + f"host:{self.host}\nx-osc-date:{self.date}\nx-osc-target:{target}\n" ) headers = { "Content-Type": self.CONTENT_TYPE, @@ -733,15 +733,14 @@ def get_conf(profile: str) -> Configuration: for v in json_profiles: json_profile = json_profiles[v] if "region" in json_profile: - # use default stuffs only when "region" is use # to keep region_name format retrocompatible - if not "host" in json_profile and not "endpoint" in json_profile: + if "host" not in json_profile and "endpoint" not in json_profile: json_profile["host"] = DEFAULT_HOST - if not "https" in json_profile: + if "https" not in json_profile: json_profile["https"] = True - if not "region_name" in json_profile: + if "region_name" not in json_profile: json_profile["region_name"] = json_profile["region"] del json_profile["region"] conf = cast(Mapping[str, Configuration], json_profiles) @@ -768,7 +767,6 @@ def api_connect( config_path: Optional[str] = None, **kwargs: CallParameters, ): - calls = { "api": OSCCall, "directlink": DirectLinkCall, @@ -811,10 +809,9 @@ def main(): global PASSWORD_ARG PASSWORD_ARG = argv[i + 1] elif a == "--bash_completion": - f = open(BASH_COMPLETION_PATH, "r") - print(f.read()) + with open(BASH_COMPLETION_PATH, "r") as f: + print(f.read()) sys.exit() - return 0 elif a == "--version": print(SDK_VERSION) return 0 diff --git a/pkg/Makefile b/pkg/Makefile index 4cebddc..7f5c90e 100644 --- a/pkg/Makefile +++ b/pkg/Makefile @@ -31,7 +31,7 @@ osc-cli.AppDir/done: $(PY_TARGET) appimagetool-x86_64.AppImage: - wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage + wget https://github.com/AppImage/appimagetool/releases/download/1.9.0/appimagetool-x86_64.AppImage chmod +x appimagetool-x86_64.AppImage osc-cli-x86_64.AppImage: osc-cli.AppDir/done appimagetool-x86_64.AppImage diff --git a/requirements.txt b/requirements.txt index 197b059..d46b17f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,33 @@ -bandit==1.7.1 -dataclasses==0.8; python_version < "3.7" +astroid==4.0.2 +bandit==1.9.2 +certifi==2025.11.12 +charset-normalizer==3.4.4 defusedxml==0.7.1 -fire==0.4.0 -mypy==0.942 -mypy-extensions==0.4.3 -pylint==2.13.0 -pytest==7.0.1 -requests==2.31.0 -types-dataclasses==0.6.4 -types-requests==2.27.14 -typing_extensions==4.1.1 -xmltodict==0.12.0 +dill==0.4.0 +fire==0.7.1 +idna==3.11 +iniconfig==2.3.0 +isort==7.0.0 +markdown-it-py==4.0.0 +mccabe==0.7.0 +mdurl==0.1.2 +mypy==1.18.2 +mypy-extensions==1.1.0 +packaging==25.0 +pathspec==0.12.1 +platformdirs==4.5.0 +pluggy==1.6.0 +pygments==2.19.2 +pylint==4.0.3 +pytest==9.0.1 +pyyaml==6.0.3 +requests==2.32.5 +rich==14.2.0 +setuptools==80.9.0 +stevedore==5.6.0 +termcolor==3.2.0 +tomlkit==0.13.3 +types-requests==2.32.4.20250913 +typing-extensions==4.15.0 +urllib3==2.5.0 +xmltodict==1.0.2 diff --git a/setup.py b/setup.py index 77ee4a9..4980681 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,14 @@ +import os + from setuptools import find_packages, setup + +def get_long_description(): + root_path = os.path.dirname(os.path.abspath(__file__)) + with open(os.path.join(root_path, "README.md"), "r", encoding="utf-8") as fd: + return fd.read() + + setup( name="osc-sdk", version="1.11.0", @@ -7,7 +16,7 @@ author="Outscale SAS", author_email="contact@outscale.com", description="Outscale API SDK and CLI", - long_description=open("README.md").read(), + long_description=get_long_description(), long_description_content_type="text/markdown", include_package_data=True, license="BSD", @@ -20,6 +29,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", ], url="https://github.com/outscale/osc-cli",