cloudsh 0.3.9__tar.gz → 0.3.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. cloudsh-0.3.10/.coveragerc +15 -0
  2. cloudsh-0.3.10/.github/copilot-instructions.md +115 -0
  3. cloudsh-0.3.10/.github/workflows/build.yml +43 -0
  4. cloudsh-0.3.10/.github/workflows/release.yml +28 -0
  5. cloudsh-0.3.10/.gitignore +165 -0
  6. {cloudsh-0.3.9 → cloudsh-0.3.10}/PKG-INFO +20 -20
  7. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/utils.py +1 -1
  8. {cloudsh-0.3.9 → cloudsh-0.3.10}/pyproject.toml +10 -6
  9. cloudsh-0.3.10/tests/__init__.py +0 -0
  10. cloudsh-0.3.10/tests/conftest.py +37 -0
  11. cloudsh-0.3.10/tox.ini +6 -0
  12. cloudsh-0.3.10/uv.lock +2977 -0
  13. cloudsh-0.3.9/cloudsh.egg-info/PKG-INFO +0 -203
  14. cloudsh-0.3.9/cloudsh.egg-info/SOURCES.txt +0 -53
  15. cloudsh-0.3.9/cloudsh.egg-info/dependency_links.txt +0 -1
  16. cloudsh-0.3.9/cloudsh.egg-info/entry_points.txt +0 -2
  17. cloudsh-0.3.9/cloudsh.egg-info/requires.txt +0 -26
  18. cloudsh-0.3.9/cloudsh.egg-info/top_level.txt +0 -1
  19. cloudsh-0.3.9/setup.cfg +0 -4
  20. {cloudsh-0.3.9 → cloudsh-0.3.10}/LICENSE +0 -0
  21. {cloudsh-0.3.9 → cloudsh-0.3.10}/README.md +0 -0
  22. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/__init__.py +0 -0
  23. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/__main__.py +0 -0
  24. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/cat.toml +0 -0
  25. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/complete.toml +0 -0
  26. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/cp.toml +0 -0
  27. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/head.toml +0 -0
  28. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/less.toml +0 -0
  29. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/ls.toml +0 -0
  30. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/mkdir.toml +0 -0
  31. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/more.toml +0 -0
  32. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/mv.toml +0 -0
  33. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/rm.toml +0 -0
  34. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/sink.toml +0 -0
  35. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/tail.toml +0 -0
  36. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/args/touch.toml +0 -0
  37. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/cat.py +0 -0
  38. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/complete.py +0 -0
  39. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/cp.py +0 -0
  40. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/head.py +0 -0
  41. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/less.py +0 -0
  42. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/ls.py +0 -0
  43. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/mkdir.py +0 -0
  44. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/more.py +0 -0
  45. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/mv.py +0 -0
  46. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/rm.py +0 -0
  47. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/sink.py +0 -0
  48. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/tail.py +0 -0
  49. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/commands/touch.py +0 -0
  50. {cloudsh-0.3.9 → cloudsh-0.3.10}/cloudsh/main.py +0 -0
  51. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_cat.py +0 -0
  52. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_complete.py +0 -0
  53. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_cp.py +0 -0
  54. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_head.py +0 -0
  55. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_less.py +0 -0
  56. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_ls.py +0 -0
  57. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_main_module.py +0 -0
  58. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_mkdir.py +0 -0
  59. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_more.py +0 -0
  60. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_mv.py +0 -0
  61. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_rm.py +0 -0
  62. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_sink.py +0 -0
  63. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_tail.py +0 -0
  64. {cloudsh-0.3.9 → cloudsh-0.3.10}/tests/test_touch.py +0 -0
@@ -0,0 +1,15 @@
1
+ [run]
2
+ branch = True
3
+ parallel = True
4
+ concurrency = multiprocessing
5
+ source = cloudsh
6
+ sigterm = true
7
+
8
+ [report]
9
+ exclude_lines =
10
+ pragma: no cover
11
+ def __repr__
12
+ if TYPE_CHECKING:
13
+ raise NotImplementedError
14
+ pass
15
+ raise AssertionError
@@ -0,0 +1,115 @@
1
+ # Copilot Instructions for cloudsh
2
+
3
+ ## Project Overview
4
+
5
+ `cloudsh` is a Python CLI that provides drop-in replacements for GNU/Linux commands (ls, cp, mv, rm, cat, head, tail, mkdir, touch) with transparent support for cloud storage paths (GCS, S3, Azure). It uses [`cloudpathlib`](https://github.com/drivendataorg/cloudpathlib) and [`yunpath`](https://github.com/pwwang/yunpath) to abstract local and cloud file operations.
6
+
7
+ ## Architecture
8
+
9
+ ### Command Discovery Pattern (Critical)
10
+
11
+ Commands are **not** hardcoded. The system uses dynamic loading:
12
+
13
+ 1. **TOML-driven CLI**: Each command has a `.toml` file in `cloudsh/args/` that defines its argparse configuration
14
+ 2. **Dynamic import**: `main.py` scans `cloudsh/args/` directory, loads each `.toml` file via `simpleconf.Config.load()`, and builds argparse subcommands using `argx.ArgumentParser.from_configs()`
15
+ 3. **Command execution**: After parsing, `importlib.import_module(f".commands.{args.COMMAND}")` dynamically imports the corresponding module from `cloudsh/commands/`
16
+
17
+ **Example**: `cloudsh/args/ls.toml` defines flags like `-l`, `-h`, `-R` → `cloudsh/commands/ls.py` implements the `run(args)` function.
18
+
19
+ ### Path Completion System
20
+
21
+ - **Special field**: TOML files include `path_options` field (e.g., `path_options = ["SOURCE", "DEST"]`) to mark which arguments should use cloud path completion
22
+ - **Completion hook**: In `main.py:create_parser()`, these arguments get `action.completer = path_completer` attached
23
+ - **Caching**: Cloud path completion can use cached bucket listings (`~/.cache/cloudsh/complete.cache`) to avoid latency. See `cloudsh/commands/complete.py:_scan_path()` and `_read_cache()`
24
+
25
+ ### GNU Passthrough Mode (Lines 49-55 in main.py)
26
+
27
+ **Critical feature**: `cloudsh ls -- -l` executes the native GNU `ls -l` command instead of cloudsh's implementation. This allows cloudsh to be aliased as a drop-in replacement while still accessing original commands when needed.
28
+
29
+ ```python
30
+ if len(sys.argv) > 3 and sys.argv[2] == "--":
31
+ command = sys.argv[1]
32
+ if Path(__file__).parent.joinpath("commands", f"{command}.py").exists():
33
+ p = subprocess.run([command, *sys.argv[3:]])
34
+ sys.exit(p.returncode)
35
+ ```
36
+
37
+ ## Adding New Commands
38
+
39
+ 1. Create `cloudsh/args/<command>.toml` with argparse config (see `ls.toml` or `cp.toml` as templates)
40
+ 2. Create `cloudsh/commands/<command>.py` with a `run(args: Namespace) -> None` function
41
+ 3. Use `AnyPath` from `yunpath` for unified local/cloud path handling
42
+ 4. Set `path_options` in TOML for arguments that need path completion
43
+ 5. No registration needed—dynamic discovery handles it
44
+
45
+ **Example minimal command**:
46
+ ```python
47
+ # cloudsh/commands/example.py
48
+ from yunpath import AnyPath
49
+ from argx import Namespace
50
+
51
+ def run(args: Namespace) -> None:
52
+ path = AnyPath(args.file) # Works for both local and cloud paths
53
+ print(path.read_text())
54
+ ```
55
+
56
+ ## Testing Conventions
57
+
58
+ - **Cloud testing**: Tests use real GCS bucket (`gs://handy-buffer-287000.appspot.com`) defined in `conftest.py`
59
+ - **Credentials**: Load from `.env` file via `python-dotenv` (see `tests/conftest.py`)
60
+ - **Module-level setup**: Use `setup_module()`/`teardown_module()` to create/clean test workspaces with `uuid4()` for isolation
61
+ - **Interactive mocking**: Use `monkeypatch.setattr("builtins.input", mock_input)` for testing `-i` (interactive) flags
62
+ - **Run tests**: `pytest` (configured in `pyproject.toml` with coverage)
63
+
64
+ ## Dependencies and Build
65
+
66
+ - **Package manager**: uv (`pyproject.toml`, `uv.lock`)
67
+ - **Optional extras**: `[gcs]`, `[aws]`, `[azure]`, `[all]` for cloud provider SDKs
68
+ - **Key dependencies**:
69
+ - `argx`: Declarative argparse from configs
70
+ - `yunpath`: Unified Path API wrapping `pathlib.Path` and `cloudpathlib.CloudPath`
71
+ - `python-simpleconf[toml]`: TOML config loading
72
+ - `argcomplete`: Shell completion framework
73
+
74
+ ## Common Patterns
75
+
76
+ ### Error Handling
77
+ Print errors to stderr with `{PACKAGE}` prefix (e.g., `f"{PACKAGE} cp: cannot overwrite directory"`) and call `sys.exit(1)`. See `cloudsh/commands/cp.py:34-37`.
78
+
79
+ ### Size Parsing
80
+ Use `utils.parse_number()` for human-readable sizes (e.g., `"1K"` → `1024`, `"1KB"` → `1000`). Supports B/KB/K/KiB/MB/M/MiB/GB/G/GiB etc.
81
+
82
+ ### Cloud Path Checks
83
+ ```python
84
+ from yunpath import CloudPath
85
+ if isinstance(path, CloudPath):
86
+ # Cloud-specific handling (e.g., different copy mechanisms)
87
+ ```
88
+
89
+ ### Long Listing Format (`ls -l`)
90
+ Cloud paths may return `None` for `st_uid`/`st_gid`/`st_mode`. Handle gracefully with `"<unknown>"` or inferred values. See `cloudsh/commands/ls.py:_get_user_group()`.
91
+
92
+ ## Development Workflow
93
+
94
+ ```bash
95
+ # Install with dev dependencies
96
+ uv sync --group dev --all-extras
97
+
98
+ # Run tests (requires .env with cloud credentials)
99
+ pytest
100
+
101
+ # Test a command locally
102
+ python -m cloudsh ls /tmp
103
+ python -m cloudsh ls gs://bucket-name/
104
+
105
+ # Generate completions for testing
106
+ cloudsh complete --shell bash > /tmp/completions.bash
107
+ ```
108
+
109
+ ## Key Files
110
+
111
+ - `cloudsh/main.py`: Dynamic command loading and argparse setup
112
+ - `cloudsh/utils.py`: Shared utilities (version, size parsing)
113
+ - `cloudsh/args/*.toml`: Declarative CLI definitions for each command
114
+ - `cloudsh/commands/*.py`: Command implementations (each exports `run(args)`)
115
+ - `tests/conftest.py`: Test bucket configuration and credentials loading
@@ -0,0 +1,43 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ if: "! contains(github.event.head_commit.message, 'wip') && ! startsWith(github.ref, 'refs/tags')"
10
+ strategy:
11
+ # max-parallel: 1 # Limit to 2 parallel jobs avoid rate limiting to GCP
12
+ matrix:
13
+ python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
14
+
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - name: Setup uv
18
+ uses: astral-sh/setup-uv@v8.0.0
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+ - name: Install dependencies
22
+ run: |
23
+ uv sync --extra gs
24
+ uv tree
25
+ - name: Run flake8
26
+ run: uv run flake8 cloudsh
27
+ - uses: google-github-actions/auth@v3
28
+ with:
29
+ credentials_json: ${{ secrets.GCP_SA_KEY }}
30
+ - name: Test with pytest
31
+ run: uv run pytest tests/ --junitxml=junit/test-results-${{ matrix.python-version }}.xml
32
+ - name: Upload pytest test results
33
+ uses: actions/upload-artifact@v7
34
+ with:
35
+ name: pytest-results-${{ matrix.python-version }}
36
+ path: junit/test-results-${{ matrix.python-version }}.xml
37
+ if: ${{ always() }}
38
+ - name: Run codacy-coverage-reporter
39
+ uses: codacy/codacy-coverage-reporter-action@master
40
+ if: matrix.python-version == 3.12
41
+ with:
42
+ project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
43
+ coverage-reports: .coverage.xml
@@ -0,0 +1,28 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+
9
+ jobs:
10
+ deploy:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.12"]
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - name: Setup uv
18
+ uses: astral-sh/setup-uv@v8.0.0
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+ - name: Install dependencies
22
+ run: |
23
+ uv sync
24
+ - name: Deploy to PyPI
25
+ run: |
26
+ uv build
27
+ uv publish --username ${{ secrets.PYPI_USER }} --password ${{ secrets.PYPI_PASSWORD }} dist/*
28
+ if: success()
@@ -0,0 +1,165 @@
1
+
2
+ # Created by https://www.gitignore.io/api/python
3
+ # Edit at https://www.gitignore.io/?templates=python
4
+
5
+ ### Python ###
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ pip-wheel-metadata/
29
+ share/python-wheels/
30
+ *.egg-info/
31
+ .installed.cfg
32
+ *.egg
33
+ MANIFEST
34
+
35
+ # PyInstaller
36
+ # Usually these files are written by a python script from a template
37
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
38
+ *.manifest
39
+ *.spec
40
+
41
+ # Installer logs
42
+ pip-log.txt
43
+ pip-delete-this-directory.txt
44
+
45
+ # Unit test / coverage reports
46
+ htmlcov/
47
+ .tox/
48
+ .nox/
49
+ .coverage
50
+ .coverage.*
51
+ .cache
52
+ nosetests.xml
53
+ coverage.xml
54
+ *.cover
55
+ .hypothesis/
56
+ .pytest_cache/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don’t work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # celery beat schedule file
98
+ celerybeat-schedule
99
+
100
+ # SageMath parsed files
101
+ *.sage.py
102
+
103
+ # Environments
104
+ .env
105
+ .venv
106
+ env/
107
+ venv/
108
+ ENV/
109
+ env.bak/
110
+ venv.bak/
111
+
112
+ # Spyder project settings
113
+ .spyderproject
114
+ .spyproject
115
+
116
+ # Rope project settings
117
+ .ropeproject
118
+
119
+ # mkdocs documentation
120
+ /site
121
+
122
+ # mypy
123
+ .mypy_cache/
124
+ .dmypy.json
125
+ dmypy.json
126
+
127
+ # Pyre type checker
128
+ .pyre/
129
+
130
+ .vscode/
131
+
132
+ *.bak
133
+
134
+ # data for Examples
135
+ examples/data/
136
+
137
+ # logs
138
+ plkit_logs/
139
+ hparams.yaml
140
+
141
+ workdir/
142
+
143
+ **/t-*.ipynb
144
+ .in.fish
145
+ .out.fish
146
+
147
+ # local history for vscode
148
+ .history/
149
+
150
+ # lightning_logs, plkit_logs
151
+ *_logs/
152
+
153
+ docs/api/
154
+ .xqute/
155
+
156
+ # End of https://www.gitignore.io/api/python
157
+
158
+ test.py
159
+
160
+ /local_tests/
161
+ t.ipynb
162
+
163
+ gac_key.json
164
+ gha-creds-*.json
165
+ /setup.py
@@ -1,33 +1,33 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudsh
3
- Version: 0.3.9
3
+ Version: 0.3.10
4
4
  Summary: A Python CLI wrapping common Linux commands for local/cloud files.
5
5
  Author-email: Your Name <you@example.com>
6
6
  License-Expression: MIT
7
- Requires-Python: >=3.9
8
- Description-Content-Type: text/markdown
9
7
  License-File: LICENSE
10
- Requires-Dist: panpath<0.5,>=0.4.8
11
- Requires-Dist: argx<0.5,>=0.4
12
- Requires-Dist: python-simpleconf[toml]<0.10,>=0.9
8
+ Requires-Python: >=3.9
13
9
  Requires-Dist: aiofiles>=23.0.0
10
+ Requires-Dist: argcomplete<3.7,>=3.5.3; python_version < '3.10'
11
+ Requires-Dist: argcomplete<4,>=3.5.3; python_version >= '3.10'
12
+ Requires-Dist: argx<0.5,>=0.4
13
+ Requires-Dist: panpath<0.5,>=0.4.8
14
14
  Requires-Dist: python-dateutil<3,>=2.9.0.post0
15
- Requires-Dist: argcomplete<4,>=3.5.3
16
- Provides-Extra: azure
17
- Requires-Dist: azure-storage-blob<13,>=12; extra == "azure"
15
+ Requires-Dist: python-simpleconf[toml]<0.10,>=0.9
16
+ Provides-Extra: all
17
+ Requires-Dist: aioboto3>=11.0.0; extra == 'all'
18
+ Requires-Dist: azure-storage-blob<13,>=12; extra == 'all'
19
+ Requires-Dist: gcloud-aio-storage>=9.5; extra == 'all'
18
20
  Provides-Extra: aws
19
- Requires-Dist: aioboto3>=11.0.0; extra == "aws"
20
- Provides-Extra: s3
21
- Requires-Dist: aioboto3>=11.0.0; extra == "s3"
22
- Provides-Extra: gs
23
- Requires-Dist: gcloud-aio-storage>=9.5; extra == "gs"
21
+ Requires-Dist: aioboto3>=11.0.0; extra == 'aws'
22
+ Provides-Extra: azure
23
+ Requires-Dist: azure-storage-blob<13,>=12; extra == 'azure'
24
24
  Provides-Extra: gcs
25
- Requires-Dist: gcloud-aio-storage>=9.5; extra == "gcs"
26
- Provides-Extra: all
27
- Requires-Dist: azure-storage-blob<13,>=12; extra == "all"
28
- Requires-Dist: aioboto3>=11.0.0; extra == "all"
29
- Requires-Dist: gcloud-aio-storage>=9.5; extra == "all"
30
- Dynamic: license-file
25
+ Requires-Dist: gcloud-aio-storage>=9.5; extra == 'gcs'
26
+ Provides-Extra: gs
27
+ Requires-Dist: gcloud-aio-storage>=9.5; extra == 'gs'
28
+ Provides-Extra: s3
29
+ Requires-Dist: aioboto3>=11.0.0; extra == 's3'
30
+ Description-Content-Type: text/markdown
31
31
 
32
32
  # cloudsh
33
33
 
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.9"
1
+ __version__ = "0.3.10"
2
2
 
3
3
  PACKAGE = "cloudsh"
4
4
  MULTIPLIERS = {
@@ -1,6 +1,10 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
1
5
  [project]
2
6
  name = "cloudsh"
3
- version = "0.3.9"
7
+ dynamic = ["version"]
4
8
  description = "A Python CLI wrapping common Linux commands for local/cloud files."
5
9
  readme = "README.md"
6
10
  license = "MIT"
@@ -12,9 +16,13 @@ dependencies = [
12
16
  "python-simpleconf[toml]>=0.9,<0.10",
13
17
  "aiofiles>=23.0.0",
14
18
  "python-dateutil>=2.9.0.post0,<3",
15
- "argcomplete>=3.5.3,<4",
19
+ "argcomplete>=3.5.3,<3.7; python_version < '3.10'",
20
+ "argcomplete>=3.5.3,<4; python_version >= '3.10'",
16
21
  ]
17
22
 
23
+ [tool.hatch.version]
24
+ path = "cloudsh/utils.py"
25
+
18
26
  [project.optional-dependencies]
19
27
  azure = ["azure-storage-blob>=12,<13"]
20
28
  aws = ["aioboto3>=11.0.0"]
@@ -47,10 +55,6 @@ include = ["cloudsh*"]
47
55
  [tool.setuptools.package-data]
48
56
  cloudsh = ["args/*"]
49
57
 
50
- [build-system]
51
- requires = ["setuptools>=68", "wheel"]
52
- build-backend = "setuptools.build_meta"
53
-
54
58
  [tool.pytest.ini_options]
55
59
  asyncio_mode = "auto"
56
60
  addopts = "-vv -n auto --dist loadgroup --cov=cloudsh --cov-report xml:.coverage.xml --cov-report term-missing"
File without changes
@@ -0,0 +1,37 @@
1
+ from dotenv import load_dotenv
2
+ from panpath import PanPath
3
+ import pytest
4
+ import uuid
5
+
6
+ load_dotenv()
7
+
8
+ BUCKET = "gs://handy-buffer-287000.appspot.com"
9
+
10
+
11
+ @pytest.fixture(scope="module")
12
+ def workdir(tmp_path_factory):
13
+ """
14
+ Create a temporary workdir for tests.
15
+ Uses local filesystem instead of cloud storage for faster, isolated tests.
16
+ """
17
+ workdir = tmp_path_factory.mktemp("cloudsh_test")
18
+ return PanPath(workdir)
19
+
20
+
21
+ @pytest.fixture
22
+ async def cloud_workdir(request):
23
+ """
24
+ Create a temporary cloud workdir for tests.
25
+ Uses a cloud bucket specified by BUCKET environment variable.
26
+ """
27
+ parent_workdir = PanPath(BUCKET) / "cloudsh_test"
28
+ # create a unique subdirectory for each test function
29
+ # also add uuid to avoid collisions in parallel test runs
30
+ cloud_workdir = parent_workdir.joinpath(
31
+ f"{request.node.name}_"
32
+ f"{uuid.uuid4().hex}"
33
+ )
34
+ await cloud_workdir.a_mkdir(parents=True, exist_ok=True)
35
+ yield cloud_workdir
36
+ # Cleanup after tests
37
+ await cloud_workdir.a_rmtree()
cloudsh-0.3.10/tox.ini ADDED
@@ -0,0 +1,6 @@
1
+ [flake8]
2
+ ignore = E203, W503, E731
3
+ per-file-ignores =
4
+ # imported but unused
5
+ __init__.py: F401, E402
6
+ max-line-length = 88