backpocket 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.
@@ -0,0 +1,33 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ publish:
11
+ name: Build and publish to PyPI
12
+ runs-on: ubuntu-latest
13
+ environment:
14
+ name: pypi
15
+ url: https://pypi.org/p/backpocket
16
+ permissions:
17
+ id-token: write
18
+ contents: read
19
+
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Set up uv
25
+ uses: astral-sh/setup-uv@v5
26
+ with:
27
+ enable-cache: true
28
+
29
+ - name: Build distribution packages
30
+ run: uv build
31
+
32
+ - name: Publish to PyPI
33
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,220 @@
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
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
@@ -0,0 +1,23 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+ args: ['--maxkb=1024']
10
+
11
+ - repo: local
12
+ hooks:
13
+ - id: ruff-check
14
+ name: ruff check
15
+ entry: uv run --no-sync ruff check
16
+ language: system
17
+ types: [python]
18
+
19
+ - id: ruff-format
20
+ name: ruff format
21
+ entry: uv run ruff format
22
+ language: system
23
+ types: [python]
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Asif Sayyed
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.
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.5
2
+ Name: backpocket
3
+ Version: 0.1.0
4
+ Summary: Just some utilities kept in my backpocket
5
+ Author: sayyed
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: automation,cleanup,cli,developer-tools,utilities
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+
20
+ <div align="center">
21
+
22
+ <img src="assets/backpocket.png" alt="backpocket logo" width="180" />
23
+
24
+ # backpocket
25
+
26
+ > Some scripts that I'd like to keep in my backpocket
27
+
28
+ </div>
29
+
30
+ ---
31
+
32
+ The big idea behind this repository is to just house some scripts or instructions that could be useful for me in the sense of
33
+ - project development
34
+ - redundant chores
35
+
36
+ or other usecases that I haven't currently thought of.
37
+
38
+ ---
39
+
40
+ ### Script index
41
+
42
+ 1. **[Disk Cleanup](scripts/disk_cleanup.bat)**
43
+ > This script enables me to just clear out the developer caches after a major project or sometimes every so often, helps me clean back some space on my drives.
@@ -0,0 +1,24 @@
1
+ <div align="center">
2
+
3
+ <img src="assets/backpocket.png" alt="backpocket logo" width="180" />
4
+
5
+ # backpocket
6
+
7
+ > Some scripts that I'd like to keep in my backpocket
8
+
9
+ </div>
10
+
11
+ ---
12
+
13
+ The big idea behind this repository is to just house some scripts or instructions that could be useful for me in the sense of
14
+ - project development
15
+ - redundant chores
16
+
17
+ or other usecases that I haven't currently thought of.
18
+
19
+ ---
20
+
21
+ ### Script index
22
+
23
+ 1. **[Disk Cleanup](scripts/disk_cleanup.bat)**
24
+ > This script enables me to just clear out the developer caches after a major project or sometimes every so often, helps me clean back some space on my drives.
Binary file
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "backpocket"
7
+ version = "0.1.0"
8
+ description = "Just some utilities kept in my backpocket"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "sayyed" }
14
+ ]
15
+ keywords = ["developer-tools", "cleanup", "automation", "cli", "utilities"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ ]
26
+ dependencies = []
27
+
28
+ [project.scripts]
29
+ backpocket = "backpocket.cli:main"
30
+
31
+ [tool.hatch.build.targets.wheel]
32
+ packages = ["src/backpocket"]
@@ -0,0 +1,41 @@
1
+ @echo off
2
+ title Disk maintenance and cache cleanup
3
+
4
+ echo ===========================================================
5
+ echo System maintenance: cleaning up the caches and trash
6
+ echo ===========================================================
7
+ echo.
8
+
9
+ echo [1/5] Emptying the recycle bin...
10
+ REM Emptying the recycle bin.
11
+ REM NOTE: I am using SilentlyContinue because we don't need to have a confirmation for this.
12
+ PowerShell -NoProfile -Command "Clear-RecycleBin" -Force -ErrorAction SilentlyContinue
13
+ echo.
14
+
15
+ echo [2/5] Purging all the PIP caches...
16
+ REM Clearing out all the pip caches
17
+ pip cache purge
18
+ echo.
19
+
20
+ echo [3/5] Purging all the UV caches...
21
+ REM Clearing out all the uv caches
22
+ uv cache clean
23
+ echo.
24
+
25
+ echo [4/5] Purging all the Poetry caches...
26
+ REM Clearing out all the poetry caches
27
+ REM I am adding -n which means no-interaction, so that the script doesn't hang asking "Are you sure?"
28
+ poetry cache clear pypi --all -n
29
+ echo.
30
+
31
+ echo [5/5] Purging all the NPM caches...
32
+ REM Clearing out all the npm caches
33
+ npm cache clean --force
34
+ echo.
35
+
36
+ echo ===========================================================
37
+ echo Disk cleanup done.
38
+ echo ===========================================================
39
+ echo.
40
+
41
+ pause
@@ -0,0 +1,42 @@
1
+ """
2
+ Universal project scaffolding for modular python repositories
3
+ """
4
+
5
+ import argparse
6
+ from pathlib import Path
7
+
8
+
9
+ def parse_arguments() -> argparse.Namespace:
10
+ """Parse CLI arguments and setup meaningful defaults
11
+
12
+ :returns: A tuple containing Argparser argument namespace and optionally the name of the project
13
+ """
14
+ parser = argparse.ArgumentParser(description="Scaffolding assistant")
15
+ parser.add_argument("project_name", nargs="?", default=None, help="Project name. Defaults to current directory name")
16
+ parser.add_argument("--lib", action="store_true", help="Scaffold python cli like directories src/ for libraries")
17
+ parser.add_argument("--data", action="store_true", help="Scaffold data like directories data/raw, interim and final")
18
+ parser.add_argument("--notebooks", action="store_true", help="Scaffold notesbooks/")
19
+ parser.add_argument("--web", action="store_true", help="Scaffold web/")
20
+ parser.add_argument("--app", action="store_true", help="Scaffold app/ for streamlit like apps and configs")
21
+
22
+ args = parser.parse_args()
23
+
24
+ # Since all of the options are optional i.e., user can just run the init_repo.py script as is and expect an result
25
+ # to handle that, we need to establish a default, now, since this is for my own usecase the decision of picking
26
+ # the default was on me, hence I went with lib, as that is the most frequent usecase that I have.
27
+ if not any([args.lib, args.data, args.notebooks, args.web, args.app]):
28
+ args.lib = True
29
+
30
+ return args
31
+
32
+
33
+ def main() -> None:
34
+ """Entry point for repository init"""
35
+ args = parse_arguments()
36
+ # If the project_name arguement is not populated, we need to impute it with current directory name.
37
+ current_directory_name = Path.cwd().resolve().name
38
+ _ = args.project_name if args.project_name else current_directory_name
39
+
40
+
41
+ if __name__ == "__main__":
42
+ main()
@@ -0,0 +1,3 @@
1
+ """backpocket - Essential developer utilities and automation kept in your backpocket."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,48 @@
1
+ """
2
+ backpocket CLI entrypoint.
3
+ Dispatches subcommands to modular command handlers in backpocket.commands.
4
+ """
5
+
6
+ import argparse
7
+ import sys
8
+
9
+ from backpocket import __version__
10
+ from backpocket.commands import cleanup
11
+
12
+
13
+ def build_parser() -> argparse.ArgumentParser:
14
+ parser = argparse.ArgumentParser(
15
+ prog="backpocket",
16
+ description="Essential developer utilities and automation kept in your backpocket.",
17
+ formatter_class=argparse.RawDescriptionHelpFormatter,
18
+ )
19
+
20
+ parser.add_argument(
21
+ "-v", "--version",
22
+ action="version",
23
+ version=f"%(prog)s {__version__}",
24
+ )
25
+
26
+ subparsers = parser.add_subparsers(
27
+ dest="command",
28
+ title="available commands",
29
+ metavar="<command>",
30
+ )
31
+
32
+ # Register active commands
33
+ cleanup.register_subparser(subparsers)
34
+
35
+ return parser
36
+
37
+ def main(argv: list[str] | None = None) -> int:
38
+ parser = build_parser()
39
+ args = parser.parse_args(argv)
40
+
41
+ if not hasattr(args, "func"):
42
+ parser.print_help()
43
+ return 0
44
+
45
+ return args.func(args)
46
+
47
+ if __name__ == "__main__":
48
+ sys.exit(main())
@@ -0,0 +1 @@
1
+ """CLI command modules for backpocket."""
@@ -0,0 +1,109 @@
1
+ """
2
+ Cleanup command module.
3
+ Purges developer caches (pip, uv, poetry, npm, pnpm) and empties trash.
4
+ """
5
+
6
+ import argparse
7
+ import platform
8
+ import shutil
9
+ import subprocess
10
+
11
+ CLEANUP_TARGETS = [
12
+ {
13
+ "name": "Recycle Bin / Trash",
14
+ "check": lambda: platform.system() == "Windows",
15
+ "cmd": ["powershell", "-NoProfile", "-Command", "Clear-RecycleBin -Force -ErrorAction SilentlyContinue"],
16
+ "desc": "Windows Recycle Bin",
17
+ },
18
+ {
19
+ "name": "PIP Cache",
20
+ "check": lambda: shutil.which("pip") is not None or shutil.which("python") is not None,
21
+ "cmd": ["pip", "cache", "purge"],
22
+ "desc": "Python PIP package download cache",
23
+ },
24
+ {
25
+ "name": "UV Cache",
26
+ "check": lambda: shutil.which("uv") is not None,
27
+ "cmd": ["uv", "cache", "clean"],
28
+ "desc": "Astral UV wheel and source cache",
29
+ },
30
+ {
31
+ "name": "Poetry Cache",
32
+ "check": lambda: shutil.which("poetry") is not None,
33
+ "cmd": ["poetry", "cache", "clear", "pypi", "--all", "-n"],
34
+ "desc": "Poetry dependency resolution cache",
35
+ },
36
+ {
37
+ "name": "NPM Cache",
38
+ "check": lambda: shutil.which("npm") is not None,
39
+ "cmd": ["npm", "cache", "clean", "--force"],
40
+ "desc": "Node NPM tarball and metadata cache",
41
+ },
42
+ {
43
+ "name": "PNPM Store",
44
+ "check": lambda: shutil.which("pnpm") is not None,
45
+ "cmd": ["pnpm", "store", "prune"],
46
+ "desc": "PNPM unreferenced store packages",
47
+ },
48
+ ]
49
+
50
+ def run_cleanup(args: argparse.Namespace) -> int:
51
+ dry_run = getattr(args, "dry_run", False)
52
+
53
+ print("=" * 60)
54
+ print(" backpocket: Developer Disk & Cache Cleanup")
55
+ if dry_run:
56
+ print(" [MODE: DRY RUN - no files will be deleted]")
57
+ print("=" * 60)
58
+
59
+ total = len(CLEANUP_TARGETS)
60
+ executed = 0
61
+ skipped = 0
62
+
63
+ for idx, target in enumerate(CLEANUP_TARGETS, start=1):
64
+ name = target["name"]
65
+ cmd = target["cmd"]
66
+ available = target["check"]()
67
+
68
+ print(f"\n[{idx}/{total}] Checking {name}...")
69
+
70
+ if not available:
71
+ print(" [-] Tool not found on PATH. Skipped.")
72
+ skipped += 1
73
+ continue
74
+
75
+ if dry_run:
76
+ print(f" [*] Would execute: {' '.join(cmd)}")
77
+ executed += 1
78
+ continue
79
+
80
+ print(f" [*] Executing: {' '.join(cmd)}")
81
+ try:
82
+ res = subprocess.run(cmd, capture_output=True, text=True, check=False)
83
+ if res.returncode == 0:
84
+ print(" [+] Success.")
85
+ else:
86
+ err_msg = res.stderr.strip() or res.stdout.strip() or f"exit code {res.returncode}"
87
+ print(f" [!] Note: {err_msg}")
88
+ executed += 1
89
+ except (subprocess.SubprocessError, OSError) as e:
90
+ print(f" [!] Error running {name}: {e}")
91
+
92
+ print("\n" + "=" * 60)
93
+ print(f" Cleanup complete. {executed} executed, {skipped} skipped.")
94
+ print("=" * 60 + "\n")
95
+ return 0
96
+
97
+ def register_subparser(subparsers: argparse._SubParsersAction):
98
+ parser = subparsers.add_parser(
99
+ "cleanup",
100
+ aliases=["clean"],
101
+ help="Purge package manager caches (pip, uv, npm, poetry) and trash.",
102
+ description="Purge developer package caches and empty trash to reclaim disk space.",
103
+ )
104
+ parser.add_argument(
105
+ "--dry-run",
106
+ action="store_true",
107
+ help="Inspect cleanup targets without deleting files.",
108
+ )
109
+ parser.set_defaults(func=run_cleanup)
@@ -0,0 +1,8 @@
1
+ version = 1
2
+ revision = 3
3
+ requires-python = ">=3.10"
4
+
5
+ [[package]]
6
+ name = "backpocket"
7
+ version = "0.1.0"
8
+ source = { editable = "." }