5bb-micro 2.0.15rc1__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.
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
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
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.4
2
+ Name: 5bb-micro
3
+ Version: 2.0.15rc1
4
+ Summary: micro – a modern and intuitive terminal-based text editor, packaged for easy installation via pip/uv
5
+ Project-URL: Homepage, https://micro-editor.github.io
6
+ Project-URL: Source, https://github.com/micro-editor/micro
7
+ Project-URL: Wrapper, https://github.com/5-bare-bones/toolbox__monorepo
8
+ Project-URL: Changelog, https://github.com/micro-editor/micro/releases
9
+ Project-URL: Documentation, https://github.com/micro-editor/micro/tree/master/runtime/help
10
+ Author-email: Zachary Yedidia <zyedidia@gmail.com>
11
+ Maintainer-email: 5 Bare Bones <info@5bb.dev>
12
+ License: MIT
13
+ Keywords: cli,editor,micro,terminal
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Topic :: Text Editors
21
+ Classifier: Topic :: Utilities
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+
25
+ # 5bb-micro
26
+
27
+ > **micro** – a modern and intuitive terminal-based text editor, distributed via PyPI/uv.
28
+
29
+ This package downloads and installs the [`micro`](https://github.com/zyedidia/micro) editor binary for your platform on first use. No compilation required.
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ uv tool install 5bb-micro
35
+ # or
36
+ pip install 5bb-micro
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ```bash
42
+ micro [file]
43
+ ```
44
+
45
+ The binary is downloaded from the official GitHub releases on first run and cached in `~/.cache/5bb-micro/`.
46
+
47
+ ## Configuration
48
+
49
+ Set `BB_CACHE_DIR` to override the cache location:
50
+
51
+ ```bash
52
+ BB_CACHE_DIR=/opt/tools micro myfile.txt
53
+ ```
54
+
55
+ ## License
56
+
57
+ MIT – see the [LICENSE](../../LICENSE) file for details.
@@ -0,0 +1,33 @@
1
+ # 5bb-micro
2
+
3
+ > **micro** – a modern and intuitive terminal-based text editor, distributed via PyPI/uv.
4
+
5
+ This package downloads and installs the [`micro`](https://github.com/zyedidia/micro) editor binary for your platform on first use. No compilation required.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ uv tool install 5bb-micro
11
+ # or
12
+ pip install 5bb-micro
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ micro [file]
19
+ ```
20
+
21
+ The binary is downloaded from the official GitHub releases on first run and cached in `~/.cache/5bb-micro/`.
22
+
23
+ ## Configuration
24
+
25
+ Set `BB_CACHE_DIR` to override the cache location:
26
+
27
+ ```bash
28
+ BB_CACHE_DIR=/opt/tools micro myfile.txt
29
+ ```
30
+
31
+ ## License
32
+
33
+ MIT – see the [LICENSE](../../LICENSE) file for details.
@@ -0,0 +1,44 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "5bb-micro"
7
+ version = "2.0.15-rc1"
8
+ description = "micro – a modern and intuitive terminal-based text editor, packaged for easy installation via pip/uv"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Zachary Yedidia", email = "zyedidia@gmail.com" },
14
+ ]
15
+ maintainers = [
16
+ { name = "5 Bare Bones", email = "info@5bb.dev" },
17
+ ]
18
+ keywords = ["micro", "editor", "terminal", "cli"]
19
+ classifiers = [
20
+ "Development Status :: 4 - Beta",
21
+ "Environment :: Console",
22
+ "Intended Audience :: Developers",
23
+ "License :: OSI Approved :: MIT License",
24
+ "Operating System :: OS Independent",
25
+ "Programming Language :: Python :: 3",
26
+ "Topic :: Text Editors",
27
+ "Topic :: Utilities",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://micro-editor.github.io"
32
+ Source = "https://github.com/micro-editor/micro"
33
+ Wrapper = "https://github.com/5-bare-bones/toolbox__monorepo"
34
+ Changelog = "https://github.com/micro-editor/micro/releases"
35
+ Documentation = "https://github.com/micro-editor/micro/tree/master/runtime/help"
36
+
37
+ [project.scripts]
38
+ micro = "bb_micro:run"
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/bb_micro"]
42
+
43
+ [tool.hatch.build.targets.sdist]
44
+ include = ["src/", "README.md"]
@@ -0,0 +1,116 @@
1
+ """
2
+ bb_micro – thin Python wrapper around the `micro` terminal editor.
3
+
4
+ On first use the appropriate pre-built binary is downloaded from the
5
+ official GitHub release page and cached in ``~/.cache/5bb-micro/``.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import os
11
+ import platform
12
+ import stat
13
+ import subprocess
14
+ import sys
15
+ import tarfile
16
+ import urllib.request
17
+ from pathlib import Path
18
+
19
+ __version__ = "2.0.14"
20
+ _MICRO_VERSION = __version__
21
+
22
+ # ---------------------------------------------------------------------------
23
+ # Platform detection helpers
24
+ # ---------------------------------------------------------------------------
25
+
26
+ def _arch() -> str:
27
+ machine = platform.machine().lower()
28
+ if machine in ("x86_64", "amd64"):
29
+ return "64"
30
+ if machine in ("i386", "i686"):
31
+ return "32"
32
+ if machine.startswith("arm") and "64" in machine:
33
+ return "arm64"
34
+ if machine.startswith("arm"):
35
+ return "arm"
36
+ return machine
37
+
38
+
39
+ def _os_name() -> str:
40
+ system = platform.system().lower()
41
+ if system == "darwin":
42
+ return "osx"
43
+ return system # "linux" or "windows"
44
+
45
+
46
+ def _binary_name() -> str:
47
+ return "micro.exe" if platform.system().lower() == "windows" else "micro"
48
+
49
+
50
+ def _release_tarball_name() -> str:
51
+ return f"micro-{_MICRO_VERSION}-{_os_name()}{_arch()}.tar.gz"
52
+
53
+
54
+ def _download_url() -> str:
55
+ return (
56
+ f"https://github.com/zyedidia/micro/releases/download"
57
+ f"/v{_MICRO_VERSION}/{_release_tarball_name()}"
58
+ )
59
+
60
+
61
+ # ---------------------------------------------------------------------------
62
+ # Binary management
63
+ # ---------------------------------------------------------------------------
64
+
65
+ def _cache_dir() -> Path:
66
+ return Path(os.environ.get("BB_CACHE_DIR", Path.home() / ".cache")) / "5bb-micro"
67
+
68
+
69
+ def _binary_path() -> Path:
70
+ return _cache_dir() / _binary_name()
71
+
72
+
73
+ def ensure_binary() -> Path:
74
+ """Return the path to the micro binary, downloading it if necessary."""
75
+ binary = _binary_path()
76
+ if binary.exists():
77
+ return binary
78
+
79
+ binary.parent.mkdir(parents=True, exist_ok=True)
80
+ tarball_name = _release_tarball_name()
81
+ url = _download_url()
82
+ tmp_archive = binary.parent / tarball_name
83
+
84
+ print(f"[5bb-micro] Downloading micro v{_MICRO_VERSION} …", file=sys.stderr)
85
+ try:
86
+ urllib.request.urlretrieve(url, tmp_archive) # noqa: S310
87
+ except Exception as exc: # pragma: no cover
88
+ raise SystemExit(
89
+ f"[5bb-micro] Failed to download {url}: {exc}"
90
+ ) from exc
91
+
92
+ with tarfile.open(tmp_archive, "r:gz") as tar:
93
+ for member in tar.getmembers():
94
+ if member.name.endswith(_binary_name()):
95
+ member.name = _binary_name()
96
+ tar.extract(member, binary.parent) # noqa: S202
97
+ break
98
+
99
+ tmp_archive.unlink(missing_ok=True)
100
+
101
+ # Ensure the binary is executable.
102
+ binary.chmod(binary.stat().st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
103
+ return binary
104
+
105
+
106
+ # ---------------------------------------------------------------------------
107
+ # Entry point
108
+ # ---------------------------------------------------------------------------
109
+
110
+ def run() -> None:
111
+ """CLI entry point – delegates all arguments to the micro binary."""
112
+ binary = ensure_binary()
113
+ args = [str(binary)] + sys.argv[1:]
114
+ if platform.system().lower() == "windows":
115
+ sys.exit(subprocess.call(args))
116
+ os.execv(str(binary), args)