From 751852113a7a767809e47379568a6817a17f564d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 7 Jan 2025 09:42:28 -0500 Subject: [PATCH 1/3] Add github action to codespell main on push and PRs --- .github/workflows/codespell.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..b231667 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within pyproject.toml +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 From cb7177ca21baf1e59ed9b7a19603a9149ff91346 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 7 Jan 2025 09:42:28 -0500 Subject: [PATCH 2/3] Add rudimentary codespell config --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 160be2d..332af55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,3 +6,10 @@ build-backend = "setuptools.build_meta" [tool.black] line-length = 79 + +[tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = '.git*,*.lock' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' From eda899c48480aed4475098e38ad0bd334950ed4b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 7 Jan 2025 09:42:32 -0500 Subject: [PATCH 3/3] [DATALAD RUNCMD] run codespell throughout fixing few left typos automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- README.md | 6 +++--- extra/squash/README.md | 2 +- podman_hpc/click_passthrough.py | 2 +- podman_hpc/migrate2scratch.py | 12 ++++++------ podman_hpc/podman_hpc.py | 4 ++-- podman_hpc/siteconfig.py | 2 +- test/test_config.py | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 49cad42..aa8ba02 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ The order of precedence from lowest to highest is: 1. configuration file template (if a template is allowed) 1. environment variable template (if a template is allowed) 1. configuration file -1. enviornment variables +1. environment variables -The enviornment variable override is the configuration parameter in upper case prefixed +The environment variable override is the configuration parameter in upper case prefixed with PODMANHPC_ (e.g. podman_bin becomes PODMANHPC_PODMAN_BIN). The list of configurable values is: @@ -40,7 +40,7 @@ The list of configurable values is: Some parameters can be set using a template. The template is set by the parameter with `_template` appended to the parameter to be templated (e.g. graph_root_template would be used to generate the value for the graph_root parameter). -The template replaces strings with `{{ variable }}` with the approriate value. The following variables are supported. +The template replaces strings with `{{ variable }}` with the appropriate value. The following variables are supported. * uid: replaced with the user id of the calling user * user: replaced with the user name of the calling user * env.VARIABLE: replaced with the value of the environment `VARIABLE`. For example, env.HOME would be replaced with the value of `HOME`. diff --git a/extra/squash/README.md b/extra/squash/README.md index 7211f7a..8717dd9 100644 --- a/extra/squash/README.md +++ b/extra/squash/README.md @@ -4,7 +4,7 @@ This directory contains a Dockerfile that can be used to generate a static mksquashfs. This utility is required during the migration. It needs to be statically compiled so that the -binary can work on any architectually compatible +binary can work on any architecturally compatible image. ## Instructions diff --git a/podman_hpc/click_passthrough.py b/podman_hpc/click_passthrough.py index 3d0d74a..c65c474 100644 --- a/podman_hpc/click_passthrough.py +++ b/podman_hpc/click_passthrough.py @@ -221,7 +221,7 @@ def filterValidOptions(options, subcmd, option_regex=None): if (opt == uk and idx not in uk_safe_index.get(uk, [])) ] uk = unknowns.pop(0) - # find and remove an invalid occurence of uk + # find and remove an invalid occurrence of uk while True: valid_options_tmp = valid_options.copy() valid_options_tmp.pop(ukd[uk][0]) diff --git a/podman_hpc/migrate2scratch.py b/podman_hpc/migrate2scratch.py index 552999b..bcf3a09 100755 --- a/podman_hpc/migrate2scratch.py +++ b/podman_hpc/migrate2scratch.py @@ -84,7 +84,7 @@ def get_img_info(self, img_name): def get_manifest(self, imgid): """ - Retruns the contents of the manifest for the given image ID + Returns the contents of the manifest for the given image ID Inputs: imgid: image id @@ -98,7 +98,7 @@ def init_storage(self): the minimum directories and JSON files. """ if self.read_only: - raise ValueError("Cannot init read-only stroage") + raise ValueError("Cannot init read-only storage") if not os.path.exists(self.base): os.mkdir(self.base) @@ -138,7 +138,7 @@ def del_rec(self, otype, id, key="id"): key: key name for the ID """ if self.read_only: - raise ValueError("Cannot init read-only stroage") + raise ValueError("Cannot init read-only storage") fn = os.path.join(self.base, f"overlay-{otype}", f"{otype}.json") data = json.load(open(fn)) @@ -163,7 +163,7 @@ def drop_tag(self, tags): tags: list of tags """ if self.read_only: - raise ValueError("Cannot init read-only stroage") + raise ValueError("Cannot init read-only storage") data = self.images @@ -186,7 +186,7 @@ def add_recs(self, otype, recs): for duplicate IDs. """ if self.read_only: - raise ValueError("Cannot init read-only stroage") + raise ValueError("Cannot init read-only storage") fn = os.path.join(self.base, f"overlay-{otype}", f"{otype}.json") data = json.load(open(fn)) @@ -287,7 +287,7 @@ def _get_img_layers(self, store, top_layer): def _add_parent(layer, layer_map, layers=None, layer_ids=None): """ - Recrusive function to walk up parent graph. + Recursive function to walk up parent graph. Inputs: layer: layer to walk diff --git a/podman_hpc/podman_hpc.py b/podman_hpc/podman_hpc.py index 4663a4e..bee9963 100755 --- a/podman_hpc/podman_hpc.py +++ b/podman_hpc/podman_hpc.py @@ -272,7 +272,7 @@ def _shared_run(conf, run_args, **site_opts): # We need to filter out any run args in the run_args cmd = [conf.podman_bin, "run", "--help"] valid_params = cpt.filterValidOptions(list(run_args), cmd) - # Find the first occurence not in the valid list + # Find the first occurrence not in the valid list idx = 0 for idx, item in enumerate(run_args): if item in valid_params: @@ -280,7 +280,7 @@ def _shared_run(conf, run_args, **site_opts): break image = run_args[idx] container_cmd = run_args[idx+1:] - # TODO: maybe do some validation on the iamge and container_cmd + # TODO: maybe do some validation on the image and container_cmd options = sys.argv[ sys.argv.index("shared-run") + 1: sys.argv.index(image) diff --git a/podman_hpc/siteconfig.py b/podman_hpc/siteconfig.py index 918faa5..42771ef 100755 --- a/podman_hpc/siteconfig.py +++ b/podman_hpc/siteconfig.py @@ -195,7 +195,7 @@ def _check_and_set(self, attr: str, envname=None, parname=None): if setval: # Expand to a list if the type should be a list - # Assumes a common seperated string + # Assumes a common separated string if isinstance(getattr(self, attr), list) and \ isinstance(newval, str): newval = newval.split(',') diff --git a/test/test_config.py b/test/test_config.py index 6a24626..a024d1e 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -45,7 +45,7 @@ def test_conf_file(fix_paths, conf_file, monkeypatch): assert str(uid) in conf.run_root assert f"/imagedir/{user}/storage" == conf.graph_root assert f"/tmp/{uid}/run" == conf.run_root - # This test environment variable substition and + # This test environment variable substitution and # environment variables precedence monkeypatch.setenv("FOO", "BAR") tmpl = "/tmp/{{ env.FOO }}"