scripthut 0.1.0__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 (41) hide show
  1. scripthut-0.1.0/.claude/settings.local.json +8 -0
  2. scripthut-0.1.0/.env.example +19 -0
  3. scripthut-0.1.0/.github/workflows/publish.yml +60 -0
  4. scripthut-0.1.0/.github/workflows/tests.yml +36 -0
  5. scripthut-0.1.0/.gitignore +52 -0
  6. scripthut-0.1.0/Makefile +171 -0
  7. scripthut-0.1.0/PKG-INFO +428 -0
  8. scripthut-0.1.0/README.md +407 -0
  9. scripthut-0.1.0/examples/task_source/README.md +102 -0
  10. scripthut-0.1.0/examples/task_source/generate_tasks.py +76 -0
  11. scripthut-0.1.0/examples/task_source/simple_task.sh +36 -0
  12. scripthut-0.1.0/pyproject.toml +56 -0
  13. scripthut-0.1.0/scripthut/__init__.py +3 -0
  14. scripthut-0.1.0/scripthut/backends/__init__.py +6 -0
  15. scripthut-0.1.0/scripthut/backends/base.py +32 -0
  16. scripthut-0.1.0/scripthut/backends/slurm.py +104 -0
  17. scripthut-0.1.0/scripthut/config.py +213 -0
  18. scripthut-0.1.0/scripthut/config_schema.py +195 -0
  19. scripthut-0.1.0/scripthut/history/__init__.py +12 -0
  20. scripthut-0.1.0/scripthut/history/manager.py +435 -0
  21. scripthut-0.1.0/scripthut/history/models.py +178 -0
  22. scripthut-0.1.0/scripthut/main.py +794 -0
  23. scripthut-0.1.0/scripthut/models.py +93 -0
  24. scripthut-0.1.0/scripthut/py.typed +0 -0
  25. scripthut-0.1.0/scripthut/queues/__init__.py +17 -0
  26. scripthut-0.1.0/scripthut/queues/manager.py +527 -0
  27. scripthut-0.1.0/scripthut/queues/models.py +246 -0
  28. scripthut-0.1.0/scripthut/sources/__init__.py +5 -0
  29. scripthut-0.1.0/scripthut/sources/git.py +234 -0
  30. scripthut-0.1.0/scripthut/ssh/__init__.py +5 -0
  31. scripthut-0.1.0/scripthut/ssh/client.py +146 -0
  32. scripthut-0.1.0/scripthut.example.yaml +103 -0
  33. scripthut-0.1.0/templates/base.html +204 -0
  34. scripthut-0.1.0/templates/dry_run.html +183 -0
  35. scripthut-0.1.0/templates/jobs.html +133 -0
  36. scripthut-0.1.0/templates/log_viewer.html +151 -0
  37. scripthut-0.1.0/templates/queue_detail.html +117 -0
  38. scripthut-0.1.0/templates/queue_items.html +119 -0
  39. scripthut-0.1.0/templates/queues.html +153 -0
  40. scripthut-0.1.0/tests/__init__.py +0 -0
  41. scripthut-0.1.0/tests/test_basic.py +5 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(python -m build:*)",
5
+ "Bash(pip install:*)"
6
+ ]
7
+ }
8
+ }
@@ -0,0 +1,19 @@
1
+ # ScriptRun Configuration
2
+ # Copy this file to .env and update with your settings
3
+
4
+ # SSH Connection Settings
5
+ SSH_HOST=slurm-login.cluster.edu
6
+ SSH_PORT=22
7
+ SSH_USER=your_username
8
+ SSH_KEY_PATH=~/.ssh/id_rsa
9
+
10
+ # Optional: Path to known_hosts file (leave empty to disable host key checking)
11
+ # SSH_KNOWN_HOSTS=~/.ssh/known_hosts
12
+
13
+ # Polling Configuration
14
+ # How often to check for job updates (in seconds, minimum 5)
15
+ POLL_INTERVAL=60
16
+
17
+ # Server Configuration
18
+ SERVER_HOST=127.0.0.1
19
+ SERVER_PORT=8000
@@ -0,0 +1,60 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ id-token: write # Required for trusted publishing to PyPI
14
+
15
+ steps:
16
+ - name: Checkout code
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Extract version from tag
20
+ id: get_version
21
+ run: |
22
+ # Remove 'v' prefix from tag to get version
23
+ VERSION=${GITHUB_REF#refs/tags/v}
24
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
25
+ echo "Publishing version: $VERSION"
26
+
27
+ - name: Update version in pyproject.toml
28
+ run: |
29
+ VERSION=${{ steps.get_version.outputs.version }}
30
+ sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
31
+ echo "Updated pyproject.toml with version $VERSION"
32
+ grep "^version" pyproject.toml
33
+
34
+ - name: Set up Python
35
+ uses: actions/setup-python@v5
36
+ with:
37
+ python-version: '3.11'
38
+
39
+ - name: Install dependencies
40
+ run: |
41
+ python -m pip install --upgrade pip
42
+ pip install build twine
43
+ pip install -e ".[dev]"
44
+
45
+ - name: Run tests
46
+ run: |
47
+ pytest tests/ -v --cov=scripthut --cov-report=term-missing
48
+
49
+ - name: Build package
50
+ run: python -m build
51
+
52
+ - name: Check package
53
+ run: twine check dist/*
54
+
55
+ - name: Publish to PyPI
56
+ uses: pypa/gh-action-pypi-publish@release/v1
57
+ with:
58
+ # This uses trusted publishing (no API token needed)
59
+ # Configure at: https://pypi.org/manage/account/publishing/
60
+ print-hash: true
@@ -0,0 +1,36 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main, develop ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ python-version: ['3.11', '3.12', '3.13']
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install -e ".[dev]"
29
+
30
+ - name: Run tests
31
+ run: |
32
+ pytest --tb=short -v
33
+
34
+ - name: Test installation
35
+ run: |
36
+ scripthut --help
@@ -0,0 +1,52 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # IDE
29
+ .idea/
30
+ .vscode/
31
+ *.swp
32
+ *.swo
33
+
34
+ # Environment
35
+ .env
36
+ .env.local
37
+
38
+ # Local config (may contain sensitive info)
39
+ scripthut.yaml
40
+
41
+ # Type checking
42
+ .mypy_cache/
43
+ .pytype/
44
+
45
+ # Testing
46
+ .pytest_cache/
47
+ .coverage
48
+ htmlcov/
49
+
50
+ # OS
51
+ .DS_Store
52
+ Thumbs.db
@@ -0,0 +1,171 @@
1
+ .PHONY: help release-minor release-patch release-major test clean install docs
2
+
3
+ # Python executable (use venv if available)
4
+ PYTHON := $(shell if [ -f .venv/bin/python ]; then echo .venv/bin/python; else echo python3; fi)
5
+ PYTEST := $(shell if [ -f .venv/bin/pytest ]; then echo .venv/bin/pytest; else echo pytest; fi)
6
+
7
+ # Colors for output
8
+ BLUE := \033[0;34m
9
+ GREEN := \033[0;32m
10
+ YELLOW := \033[0;33m
11
+ NC := \033[0m # No Color
12
+
13
+ help: ## Show this help message
14
+ @echo '$(BLUE)Available targets:$(NC)'
15
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
16
+
17
+ # Get the latest tag, or default to v0.0.0 if no tags exist
18
+ get-version:
19
+ @git fetch --tags 2>/dev/null || true
20
+ @git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"
21
+
22
+ # Extract current version components
23
+ current-version: ## Show current version
24
+ $(eval CURRENT_TAG := $(shell git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"))
25
+ $(eval VERSION := $(shell echo $(CURRENT_TAG) | sed 's/^v//'))
26
+ @echo "Current version: $(YELLOW)$(CURRENT_TAG)$(NC)"
27
+
28
+ # Bump minor version (e.g., v0.4.4 -> v0.5.0)
29
+ release-minor: ## Create a new minor release (v0.4.4 -> v0.5.0)
30
+ @echo "$(BLUE)Creating minor release...$(NC)"
31
+ $(eval CURRENT_TAG := $(shell git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"))
32
+ $(eval VERSION := $(shell echo $(CURRENT_TAG) | sed 's/^v//'))
33
+ $(eval MAJOR := $(shell echo $(VERSION) | cut -d. -f1))
34
+ $(eval MINOR := $(shell echo $(VERSION) | cut -d. -f2))
35
+ $(eval NEW_MINOR := $(shell echo $$(($(MINOR) + 1))))
36
+ $(eval NEW_VERSION := $(MAJOR).$(NEW_MINOR).0)
37
+ $(eval NEW_TAG := v$(NEW_VERSION))
38
+ @echo "Bumping from $(YELLOW)$(CURRENT_TAG)$(NC) to $(GREEN)$(NEW_TAG)$(NC)"
39
+ @echo ""
40
+ @echo "$(BLUE)Step 1:$(NC) Updating pyproject.toml..."
41
+ @sed -i '' 's/^version = ".*"/version = "$(NEW_VERSION)"/' pyproject.toml
42
+ @echo "$(GREEN)✓$(NC) Updated pyproject.toml to version $(NEW_VERSION)"
43
+ @echo ""
44
+ @echo "$(BLUE)Step 2:$(NC) Running tests..."
45
+ @$(PYTEST) tests/ -q || (echo "$(YELLOW)⚠$(NC) Tests failed! Fix them before releasing." && exit 1)
46
+ @echo "$(GREEN)✓$(NC) Tests passed"
47
+ @echo ""
48
+ @echo "$(BLUE)Step 3:$(NC) Committing changes..."
49
+ @git add pyproject.toml
50
+ @git commit -m "Bump version to $(NEW_VERSION)" || echo "Nothing to commit"
51
+ @echo ""
52
+ @echo "$(BLUE)Step 4:$(NC) Creating tag $(NEW_TAG)..."
53
+ @git tag -a $(NEW_TAG) -m "Release $(NEW_TAG)"
54
+ @echo "$(GREEN)✓$(NC) Created tag $(NEW_TAG)"
55
+ @echo ""
56
+ @echo "$(BLUE)Step 5:$(NC) Pushing to remote..."
57
+ @git push origin main
58
+ @git push origin $(NEW_TAG)
59
+ @echo ""
60
+ @echo "$(GREEN)✓ Release complete!$(NC)"
61
+ @echo " Tag $(GREEN)$(NEW_TAG)$(NC) has been pushed."
62
+ @echo " GitHub Actions will now build and publish to PyPI."
63
+ @echo " Monitor at: https://github.com/$$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/')/actions"
64
+
65
+ # Bump patch version (e.g., v0.4.4 -> v0.4.5)
66
+ release-patch: ## Create a new patch release (v0.4.4 -> v0.4.5)
67
+ @echo "$(BLUE)Creating patch release...$(NC)"
68
+ $(eval CURRENT_TAG := $(shell git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"))
69
+ $(eval VERSION := $(shell echo $(CURRENT_TAG) | sed 's/^v//'))
70
+ $(eval MAJOR := $(shell echo $(VERSION) | cut -d. -f1))
71
+ $(eval MINOR := $(shell echo $(VERSION) | cut -d. -f2))
72
+ $(eval PATCH := $(shell echo $(VERSION) | cut -d. -f3))
73
+ $(eval NEW_PATCH := $(shell echo $$(($(PATCH) + 1))))
74
+ $(eval NEW_VERSION := $(MAJOR).$(MINOR).$(NEW_PATCH))
75
+ $(eval NEW_TAG := v$(NEW_VERSION))
76
+ @echo "Bumping from $(YELLOW)$(CURRENT_TAG)$(NC) to $(GREEN)$(NEW_TAG)$(NC)"
77
+ @echo ""
78
+ @echo "$(BLUE)Step 1:$(NC) Updating pyproject.toml..."
79
+ @sed -i '' 's/^version = ".*"/version = "$(NEW_VERSION)"/' pyproject.toml
80
+ @echo "$(GREEN)✓$(NC) Updated pyproject.toml to version $(NEW_VERSION)"
81
+ @echo ""
82
+ @echo "$(BLUE)Step 2:$(NC) Running tests..."
83
+ @$(PYTEST) tests/ -q || (echo "$(YELLOW)⚠$(NC) Tests failed! Fix them before releasing." && exit 1)
84
+ @echo "$(GREEN)✓$(NC) Tests passed"
85
+ @echo ""
86
+ @echo "$(BLUE)Step 3:$(NC) Committing changes..."
87
+ @git add pyproject.toml
88
+ @git commit -m "Bump version to $(NEW_VERSION)" || echo "Nothing to commit"
89
+ @echo ""
90
+ @echo "$(BLUE)Step 4:$(NC) Creating tag $(NEW_TAG)..."
91
+ @git tag -a $(NEW_TAG) -m "Release $(NEW_TAG)"
92
+ @echo "$(GREEN)✓$(NC) Created tag $(NEW_TAG)"
93
+ @echo ""
94
+ @echo "$(BLUE)Step 5:$(NC) Pushing to remote..."
95
+ @git push origin main
96
+ @git push origin $(NEW_TAG)
97
+ @echo ""
98
+ @echo "$(GREEN)✓ Release complete!$(NC)"
99
+ @echo " Tag $(GREEN)$(NEW_TAG)$(NC) has been pushed."
100
+ @echo " GitHub Actions will now build and publish to PyPI."
101
+
102
+ # Bump major version (e.g., v0.4.4 -> v1.0.0)
103
+ release-major: ## Create a new major release (v0.4.4 -> v1.0.0)
104
+ @echo "$(BLUE)Creating major release...$(NC)"
105
+ $(eval CURRENT_TAG := $(shell git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"))
106
+ $(eval VERSION := $(shell echo $(CURRENT_TAG) | sed 's/^v//'))
107
+ $(eval MAJOR := $(shell echo $(VERSION) | cut -d. -f1))
108
+ $(eval NEW_MAJOR := $(shell echo $$(($(MAJOR) + 1))))
109
+ $(eval NEW_VERSION := $(NEW_MAJOR).0.0)
110
+ $(eval NEW_TAG := v$(NEW_VERSION))
111
+ @echo "$(YELLOW)⚠ WARNING:$(NC) This is a major version bump (breaking changes)"
112
+ @echo "Bumping from $(YELLOW)$(CURRENT_TAG)$(NC) to $(GREEN)$(NEW_TAG)$(NC)"
113
+ @echo ""
114
+ @read -p "Are you sure? [y/N] " -n 1 -r; \
115
+ echo; \
116
+ if [[ ! $$REPLY =~ ^[Yy]$$ ]]; then \
117
+ echo "Aborted."; \
118
+ exit 1; \
119
+ fi
120
+ @echo ""
121
+ @echo "$(BLUE)Step 1:$(NC) Updating pyproject.toml..."
122
+ @sed -i '' 's/^version = ".*"/version = "$(NEW_VERSION)"/' pyproject.toml
123
+ @echo "$(GREEN)✓$(NC) Updated pyproject.toml to version $(NEW_VERSION)"
124
+ @echo ""
125
+ @echo "$(BLUE)Step 2:$(NC) Running tests..."
126
+ @$(PYTEST) tests/ -q || (echo "$(YELLOW)⚠$(NC) Tests failed! Fix them before releasing." && exit 1)
127
+ @echo "$(GREEN)✓$(NC) Tests passed"
128
+ @echo ""
129
+ @echo "$(BLUE)Step 3:$(NC) Committing changes..."
130
+ @git add pyproject.toml
131
+ @git commit -m "Bump version to $(NEW_VERSION)" || echo "Nothing to commit"
132
+ @echo ""
133
+ @echo "$(BLUE)Step 4:$(NC) Creating tag $(NEW_TAG)..."
134
+ @git tag -a $(NEW_TAG) -m "Release $(NEW_TAG)"
135
+ @echo "$(GREEN)✓$(NC) Created tag $(NEW_TAG)"
136
+ @echo ""
137
+ @echo "$(BLUE)Step 5:$(NC) Pushing to remote..."
138
+ @git push origin main
139
+ @git push origin $(NEW_TAG)
140
+ @echo ""
141
+ @echo "$(GREEN)✓ Release complete!$(NC)"
142
+ @echo " Tag $(GREEN)$(NEW_TAG)$(NC) has been pushed."
143
+ @echo " GitHub Actions will now build and publish to PyPI."
144
+
145
+ test: ## Run tests
146
+ @$(PYTEST) tests/ -v
147
+
148
+ test-cov: ## Run tests with coverage
149
+ @$(PYTEST) tests/ -v --cov=scripthut --cov-report=term-missing
150
+
151
+ test-fast: ## Run tests quickly (no output)
152
+ @$(PYTEST) tests/ -q
153
+
154
+
155
+ lint: ## Run linting
156
+ @ruff check src/scripthut/ tests/
157
+
158
+ format: ## Format code
159
+ @ruff format src/scripthut/ tests/
160
+
161
+ clean: ## Clean build artifacts
162
+ @rm -rf build/ dist/ *.egg-info
163
+ @find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
164
+ @find . -type f -name "*.pyc" -delete
165
+
166
+ install: ## Install package in development mode
167
+ @pip install -e ".[dev]"
168
+
169
+ # Pre-release checks (can be run manually before releasing)
170
+ check: test ## Run all checks
171
+ @echo "$(GREEN)✓ All checks passed!$(NC)"