tinyleaf 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.
- tinyleaf-0.1.0/LICENSE +21 -0
- tinyleaf-0.1.0/PKG-INFO +106 -0
- tinyleaf-0.1.0/README.md +87 -0
- tinyleaf-0.1.0/pyproject.toml +54 -0
- tinyleaf-0.1.0/setup.cfg +4 -0
- tinyleaf-0.1.0/src/tinyleaf/__init__.py +1 -0
- tinyleaf-0.1.0/src/tinyleaf/cli.py +165 -0
- tinyleaf-0.1.0/src/tinyleaf/compiler.py +451 -0
- tinyleaf-0.1.0/src/tinyleaf/git_ops.py +185 -0
- tinyleaf-0.1.0/src/tinyleaf/handlers.py +982 -0
- tinyleaf-0.1.0/src/tinyleaf/registry.py +158 -0
- tinyleaf-0.1.0/src/tinyleaf/server.py +329 -0
- tinyleaf-0.1.0/src/tinyleaf/static/index.html +3253 -0
- tinyleaf-0.1.0/src/tinyleaf/vendor.py +288 -0
- tinyleaf-0.1.0/src/tinyleaf.egg-info/PKG-INFO +106 -0
- tinyleaf-0.1.0/src/tinyleaf.egg-info/SOURCES.txt +18 -0
- tinyleaf-0.1.0/src/tinyleaf.egg-info/dependency_links.txt +1 -0
- tinyleaf-0.1.0/src/tinyleaf.egg-info/entry_points.txt +2 -0
- tinyleaf-0.1.0/src/tinyleaf.egg-info/requires.txt +7 -0
- tinyleaf-0.1.0/src/tinyleaf.egg-info/top_level.txt +1 -0
tinyleaf-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Oaklight
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tinyleaf-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tinyleaf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lightweight web-based LaTeX editor powered by TeX Live
|
|
5
|
+
Author-email: Oaklight <oaklight@users.noreply.github.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/Oaklight/tinyleaf
|
|
8
|
+
Project-URL: Issues, https://github.com/Oaklight/tinyleaf/issues
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: complexipy>=5.2.0; extra == "dev"
|
|
14
|
+
Requires-Dist: ruff>=0.15.0; extra == "dev"
|
|
15
|
+
Requires-Dist: ty>=0.0.31; extra == "dev"
|
|
16
|
+
Requires-Dist: build>=1.2.2.post1; extra == "dev"
|
|
17
|
+
Requires-Dist: twine>=6.1.0; extra == "dev"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# tinyleaf
|
|
21
|
+
|
|
22
|
+
[中文版](./README_zh.md)
|
|
23
|
+
|
|
24
|
+
Lightweight, zero-dependency web-based LaTeX editor. Powered by [TeX Live Docker images](https://github.com/Oaklight/texlive).
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
* **CLI-first** — `pip install tinyleaf && tinyleaf /path` to start editing
|
|
29
|
+
* **Two modes** — Single project or multi-project with registry (`~/.config/tinyleaf/projects.json`)
|
|
30
|
+
* **Two compilation backends** — Local `latexmk` (default) or Docker
|
|
31
|
+
* **CodeMirror 6** editor with LaTeX syntax highlighting
|
|
32
|
+
* **PDF.js** preview with live reload after compilation
|
|
33
|
+
* **SSE** real-time compilation log streaming
|
|
34
|
+
* **Git integration** — auto-detect `.git`, commit/push from UI
|
|
35
|
+
* **Zero Python dependencies** — stdlib only (`http.server` + `threading` + `subprocess`)
|
|
36
|
+
* **7 themes** with dark/light toggle
|
|
37
|
+
* **i18n** — English and Chinese
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install tinyleaf
|
|
43
|
+
|
|
44
|
+
# Single project mode (local compilation)
|
|
45
|
+
tinyleaf /path/to/my-thesis
|
|
46
|
+
|
|
47
|
+
# Single project mode (Docker compilation)
|
|
48
|
+
tinyleaf /path/to/my-thesis --docker
|
|
49
|
+
|
|
50
|
+
# Multi-project mode (registry)
|
|
51
|
+
tinyleaf
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
usage: tinyleaf [-h] [--projects-dir DIR] [--config-dir DIR] [--docker]
|
|
58
|
+
[--image IMAGE] [--port PORT] [--host HOST] [--no-browser]
|
|
59
|
+
[project_path]
|
|
60
|
+
|
|
61
|
+
positional arguments:
|
|
62
|
+
project_path Single project directory to open
|
|
63
|
+
|
|
64
|
+
options:
|
|
65
|
+
--config-dir DIR Config directory for project registry
|
|
66
|
+
(default: ~/.config/tinyleaf)
|
|
67
|
+
--projects-dir DIR Legacy: migrate subdirs into registry
|
|
68
|
+
--docker Use Docker for compilation (default: local latexmk)
|
|
69
|
+
--image IMAGE Docker image to use (default: oaklight/texlive:latest)
|
|
70
|
+
--port PORT Server port (default: 8080)
|
|
71
|
+
--host HOST Server host (default: 127.0.0.1)
|
|
72
|
+
--no-browser Don't auto-open browser on start
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Multi-Project Registry
|
|
76
|
+
|
|
77
|
+
When launched without a `project_path`, tinyleaf enters **multi-project mode**. Projects are tracked in `~/.config/tinyleaf/projects.json` — each entry maps a name to an absolute path anywhere on the filesystem.
|
|
78
|
+
|
|
79
|
+
From the project page you can:
|
|
80
|
+
|
|
81
|
+
- **Open Folder** — browse the server filesystem and register an existing directory
|
|
82
|
+
- **New Project** — create a new project at a chosen location
|
|
83
|
+
- **Remove** — unregister a project (optionally delete files)
|
|
84
|
+
|
|
85
|
+
## Keyboard Shortcuts
|
|
86
|
+
|
|
87
|
+
| Shortcut | Action |
|
|
88
|
+
|----------|--------|
|
|
89
|
+
| `Ctrl+S` | Save current file |
|
|
90
|
+
| `Ctrl+Enter` | Compile |
|
|
91
|
+
| `Ctrl+Shift+C` | Git commit |
|
|
92
|
+
| `Ctrl+Shift+P` | Git push |
|
|
93
|
+
|
|
94
|
+
## Docker Compose
|
|
95
|
+
|
|
96
|
+
For a self-contained setup with Docker compilation:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
docker compose up
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
This starts the web editor on `http://localhost:8080` with a persistent TeX Live container for compilation.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT
|
tinyleaf-0.1.0/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# tinyleaf
|
|
2
|
+
|
|
3
|
+
[中文版](./README_zh.md)
|
|
4
|
+
|
|
5
|
+
Lightweight, zero-dependency web-based LaTeX editor. Powered by [TeX Live Docker images](https://github.com/Oaklight/texlive).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
* **CLI-first** — `pip install tinyleaf && tinyleaf /path` to start editing
|
|
10
|
+
* **Two modes** — Single project or multi-project with registry (`~/.config/tinyleaf/projects.json`)
|
|
11
|
+
* **Two compilation backends** — Local `latexmk` (default) or Docker
|
|
12
|
+
* **CodeMirror 6** editor with LaTeX syntax highlighting
|
|
13
|
+
* **PDF.js** preview with live reload after compilation
|
|
14
|
+
* **SSE** real-time compilation log streaming
|
|
15
|
+
* **Git integration** — auto-detect `.git`, commit/push from UI
|
|
16
|
+
* **Zero Python dependencies** — stdlib only (`http.server` + `threading` + `subprocess`)
|
|
17
|
+
* **7 themes** with dark/light toggle
|
|
18
|
+
* **i18n** — English and Chinese
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install tinyleaf
|
|
24
|
+
|
|
25
|
+
# Single project mode (local compilation)
|
|
26
|
+
tinyleaf /path/to/my-thesis
|
|
27
|
+
|
|
28
|
+
# Single project mode (Docker compilation)
|
|
29
|
+
tinyleaf /path/to/my-thesis --docker
|
|
30
|
+
|
|
31
|
+
# Multi-project mode (registry)
|
|
32
|
+
tinyleaf
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
usage: tinyleaf [-h] [--projects-dir DIR] [--config-dir DIR] [--docker]
|
|
39
|
+
[--image IMAGE] [--port PORT] [--host HOST] [--no-browser]
|
|
40
|
+
[project_path]
|
|
41
|
+
|
|
42
|
+
positional arguments:
|
|
43
|
+
project_path Single project directory to open
|
|
44
|
+
|
|
45
|
+
options:
|
|
46
|
+
--config-dir DIR Config directory for project registry
|
|
47
|
+
(default: ~/.config/tinyleaf)
|
|
48
|
+
--projects-dir DIR Legacy: migrate subdirs into registry
|
|
49
|
+
--docker Use Docker for compilation (default: local latexmk)
|
|
50
|
+
--image IMAGE Docker image to use (default: oaklight/texlive:latest)
|
|
51
|
+
--port PORT Server port (default: 8080)
|
|
52
|
+
--host HOST Server host (default: 127.0.0.1)
|
|
53
|
+
--no-browser Don't auto-open browser on start
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Multi-Project Registry
|
|
57
|
+
|
|
58
|
+
When launched without a `project_path`, tinyleaf enters **multi-project mode**. Projects are tracked in `~/.config/tinyleaf/projects.json` — each entry maps a name to an absolute path anywhere on the filesystem.
|
|
59
|
+
|
|
60
|
+
From the project page you can:
|
|
61
|
+
|
|
62
|
+
- **Open Folder** — browse the server filesystem and register an existing directory
|
|
63
|
+
- **New Project** — create a new project at a chosen location
|
|
64
|
+
- **Remove** — unregister a project (optionally delete files)
|
|
65
|
+
|
|
66
|
+
## Keyboard Shortcuts
|
|
67
|
+
|
|
68
|
+
| Shortcut | Action |
|
|
69
|
+
|----------|--------|
|
|
70
|
+
| `Ctrl+S` | Save current file |
|
|
71
|
+
| `Ctrl+Enter` | Compile |
|
|
72
|
+
| `Ctrl+Shift+C` | Git commit |
|
|
73
|
+
| `Ctrl+Shift+P` | Git push |
|
|
74
|
+
|
|
75
|
+
## Docker Compose
|
|
76
|
+
|
|
77
|
+
For a self-contained setup with Docker compilation:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
docker compose up
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This starts the web editor on `http://localhost:8080` with a persistent TeX Live container for compilation.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tinyleaf"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
authors = [{ name = "Oaklight", email = "oaklight@users.noreply.github.com" }]
|
|
9
|
+
description = "Lightweight web-based LaTeX editor powered by TeX Live"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = "MIT"
|
|
13
|
+
|
|
14
|
+
[project.urls]
|
|
15
|
+
Repository = "https://github.com/Oaklight/tinyleaf"
|
|
16
|
+
Issues = "https://github.com/Oaklight/tinyleaf/issues"
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
tinyleaf = "tinyleaf.cli:main"
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
dev = [
|
|
23
|
+
"complexipy>=5.2.0",
|
|
24
|
+
"ruff>=0.15.0",
|
|
25
|
+
"ty>=0.0.31",
|
|
26
|
+
"build>=1.2.2.post1",
|
|
27
|
+
"twine>=6.1.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.dynamic]
|
|
31
|
+
version = { attr = "tinyleaf.__version__" }
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.package-data]
|
|
37
|
+
"tinyleaf" = ["static/*.html"]
|
|
38
|
+
|
|
39
|
+
[tool.ruff]
|
|
40
|
+
line-length = 100
|
|
41
|
+
target-version = "py310"
|
|
42
|
+
|
|
43
|
+
[tool.ruff.lint]
|
|
44
|
+
select = ["E", "F", "UP"]
|
|
45
|
+
ignore = ["UP007", "E501"]
|
|
46
|
+
|
|
47
|
+
[tool.ty.environment]
|
|
48
|
+
python-version = "3.10"
|
|
49
|
+
|
|
50
|
+
[tool.ty.src]
|
|
51
|
+
include = ["src"]
|
|
52
|
+
|
|
53
|
+
[tool.ty.rules]
|
|
54
|
+
unresolved-import = "ignore"
|
tinyleaf-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""CLI entry point for tinyleaf."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import os
|
|
5
|
+
import shutil
|
|
6
|
+
import sys
|
|
7
|
+
import webbrowser
|
|
8
|
+
|
|
9
|
+
from tinyleaf import registry
|
|
10
|
+
from tinyleaf.server import run_server
|
|
11
|
+
|
|
12
|
+
DEFAULT_CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".config", "tinyleaf")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
parser = argparse.ArgumentParser(
|
|
17
|
+
prog="tinyleaf",
|
|
18
|
+
description="Lightweight web-based LaTeX editor",
|
|
19
|
+
)
|
|
20
|
+
parser.add_argument(
|
|
21
|
+
"project_path",
|
|
22
|
+
nargs="?",
|
|
23
|
+
help="Single project directory to open",
|
|
24
|
+
)
|
|
25
|
+
parser.add_argument(
|
|
26
|
+
"--projects-dir",
|
|
27
|
+
metavar="DIR",
|
|
28
|
+
help="Legacy: migrate subdirs into registry, then use registry mode",
|
|
29
|
+
)
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"--config-dir",
|
|
32
|
+
metavar="DIR",
|
|
33
|
+
default=DEFAULT_CONFIG_DIR,
|
|
34
|
+
help=f"Config directory for project registry (default: {DEFAULT_CONFIG_DIR})",
|
|
35
|
+
)
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"--docker",
|
|
38
|
+
action=argparse.BooleanOptionalAction,
|
|
39
|
+
default=True,
|
|
40
|
+
help="Use Docker for compilation (default: enabled)",
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
"--image",
|
|
44
|
+
default="oaklight/texlive:alpine-science-cn",
|
|
45
|
+
help="Docker image to use (default: oaklight/texlive:alpine-science-cn)",
|
|
46
|
+
)
|
|
47
|
+
parser.add_argument(
|
|
48
|
+
"--port",
|
|
49
|
+
type=int,
|
|
50
|
+
default=8080,
|
|
51
|
+
help="Server port (default: 8080)",
|
|
52
|
+
)
|
|
53
|
+
parser.add_argument(
|
|
54
|
+
"--host",
|
|
55
|
+
default="127.0.0.1",
|
|
56
|
+
help="Server host (default: 127.0.0.1)",
|
|
57
|
+
)
|
|
58
|
+
parser.add_argument(
|
|
59
|
+
"--no-browser",
|
|
60
|
+
action="store_true",
|
|
61
|
+
help="Don't auto-open browser on start",
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
args = parser.parse_args()
|
|
65
|
+
|
|
66
|
+
# Validate
|
|
67
|
+
if args.project_path and args.projects_dir:
|
|
68
|
+
parser.error("Cannot specify both project_path and --projects-dir")
|
|
69
|
+
|
|
70
|
+
# Determine mode
|
|
71
|
+
if args.project_path:
|
|
72
|
+
mode = "single"
|
|
73
|
+
project_path = os.path.abspath(args.project_path)
|
|
74
|
+
if not os.path.isdir(project_path):
|
|
75
|
+
print(f"Error: '{project_path}' is not a directory", file=sys.stderr)
|
|
76
|
+
sys.exit(1)
|
|
77
|
+
config_dir = None
|
|
78
|
+
else:
|
|
79
|
+
mode = "multi"
|
|
80
|
+
config_dir = os.path.abspath(args.config_dir)
|
|
81
|
+
registry.ensure_config_dir(config_dir)
|
|
82
|
+
project_path = None
|
|
83
|
+
|
|
84
|
+
# Backward compat: migrate --projects-dir subdirs into registry
|
|
85
|
+
if args.projects_dir:
|
|
86
|
+
projects_dir = os.path.abspath(args.projects_dir)
|
|
87
|
+
if os.path.isdir(projects_dir):
|
|
88
|
+
count = _migrate_projects_dir(config_dir, projects_dir)
|
|
89
|
+
if count:
|
|
90
|
+
print(f" Migrated {count} project(s) from {projects_dir}")
|
|
91
|
+
|
|
92
|
+
# Auto-download vendor JS modules on first start
|
|
93
|
+
from tinyleaf import vendor
|
|
94
|
+
|
|
95
|
+
vendor_dir = os.path.join(config_dir, "vendor")
|
|
96
|
+
if not vendor.is_vendor_ready(vendor_dir):
|
|
97
|
+
proxy = vendor.load_proxy(config_dir)
|
|
98
|
+
print(" Downloading JS modules...")
|
|
99
|
+
if proxy:
|
|
100
|
+
print(f" Using proxy: {proxy}")
|
|
101
|
+
try:
|
|
102
|
+
vendor.download_vendor(vendor_dir, proxy=proxy)
|
|
103
|
+
print(" JS modules ready")
|
|
104
|
+
except Exception as e:
|
|
105
|
+
print(f" Warning: failed to download JS modules: {e}", file=sys.stderr)
|
|
106
|
+
print(" Editor will try CDN as fallback", file=sys.stderr)
|
|
107
|
+
|
|
108
|
+
# Check compilation backend
|
|
109
|
+
use_docker = args.docker
|
|
110
|
+
if not use_docker and not shutil.which("latexmk"):
|
|
111
|
+
print(
|
|
112
|
+
"Warning: 'latexmk' not found in PATH. Add --docker to use Docker for compilation.",
|
|
113
|
+
file=sys.stderr,
|
|
114
|
+
)
|
|
115
|
+
print("Continuing anyway — compilation will fail without latexmk.", file=sys.stderr)
|
|
116
|
+
|
|
117
|
+
if use_docker and not shutil.which("docker"):
|
|
118
|
+
print("Error: --docker specified but 'docker' not found in PATH", file=sys.stderr)
|
|
119
|
+
sys.exit(1)
|
|
120
|
+
|
|
121
|
+
config = {
|
|
122
|
+
"mode": mode,
|
|
123
|
+
"project_path": project_path,
|
|
124
|
+
"config_dir": config_dir,
|
|
125
|
+
"use_docker": use_docker,
|
|
126
|
+
"docker_image": args.image,
|
|
127
|
+
"host": args.host,
|
|
128
|
+
"port": args.port,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
url = f"http://{args.host}:{args.port}"
|
|
132
|
+
print(f"Starting tinyleaf ({mode} mode)")
|
|
133
|
+
if use_docker:
|
|
134
|
+
print(f" Compiler: Docker ({args.image})")
|
|
135
|
+
else:
|
|
136
|
+
print(" Compiler: local latexmk")
|
|
137
|
+
if mode == "single":
|
|
138
|
+
print(f" Project: {project_path}")
|
|
139
|
+
else:
|
|
140
|
+
print(f" Config: {config_dir}")
|
|
141
|
+
print(f" URL: {url}")
|
|
142
|
+
|
|
143
|
+
if not args.no_browser:
|
|
144
|
+
webbrowser.open(url)
|
|
145
|
+
|
|
146
|
+
run_server(config)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _migrate_projects_dir(config_dir, projects_dir):
|
|
150
|
+
"""Migrate subdirectories of a projects dir into the registry."""
|
|
151
|
+
count = 0
|
|
152
|
+
for entry in sorted(os.listdir(projects_dir)):
|
|
153
|
+
full = os.path.join(projects_dir, entry)
|
|
154
|
+
if not os.path.isdir(full) or entry.startswith("."):
|
|
155
|
+
continue
|
|
156
|
+
try:
|
|
157
|
+
registry.register_project(config_dir, entry, full)
|
|
158
|
+
count += 1
|
|
159
|
+
except ValueError:
|
|
160
|
+
pass # name collision, skip
|
|
161
|
+
return count
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
main()
|