sigma2 0.0.1__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.
- sigma2-0.0.1/.github/workflows/publish.yml +28 -0
- sigma2-0.0.1/.gitignore +8 -0
- sigma2-0.0.1/LICENSE +3 -0
- sigma2-0.0.1/PKG-INFO +16 -0
- sigma2-0.0.1/README.md +3 -0
- sigma2-0.0.1/environment.yml +10 -0
- sigma2-0.0.1/export.py +180 -0
- sigma2-0.0.1/pyproject.toml +21 -0
- sigma2-0.0.1/sigma2/__init__.py +3 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment: pypi
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.10"
|
|
21
|
+
|
|
22
|
+
- name: Build
|
|
23
|
+
run: |
|
|
24
|
+
pip install build
|
|
25
|
+
python -m build
|
|
26
|
+
|
|
27
|
+
- name: Publish to PyPI
|
|
28
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
sigma2-0.0.1/.gitignore
ADDED
sigma2-0.0.1/LICENSE
ADDED
sigma2-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sigma2
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Mutational signature analysis — package name reservation.
|
|
5
|
+
Project-URL: Homepage, https://github.com/sigscape/sigma2
|
|
6
|
+
Author: Jan Philipp Hummel
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Development Status :: 1 - Planning
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# sigma2
|
|
15
|
+
|
|
16
|
+
*Placeholder — package name reservation only.*
|
sigma2-0.0.1/README.md
ADDED
sigma2-0.0.1/export.py
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Export a Python/Rust(maturin)/R library repository into a single text file for LLM context."""
|
|
3
|
+
import os
|
|
4
|
+
import argparse
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
INCLUDE_EXTENSIONS = {
|
|
8
|
+
# Python
|
|
9
|
+
".py", ".pyi", ".pyx", ".pxd",
|
|
10
|
+
# Rust
|
|
11
|
+
".rs", ".toml",
|
|
12
|
+
# R
|
|
13
|
+
".R", ".r", ".Rmd", ".Rd", ".Rproj",
|
|
14
|
+
# Config / build
|
|
15
|
+
".cfg", ".ini", ".inf", ".yaml", ".yml", ".json",
|
|
16
|
+
".sh", ".bash", ".zsh",
|
|
17
|
+
".sql", ".graphql",
|
|
18
|
+
# Docs / text
|
|
19
|
+
".md", ".mdx", ".rst", ".txt",
|
|
20
|
+
# C/C++ (common in extensions)
|
|
21
|
+
".c", ".h", ".cpp", ".hpp",
|
|
22
|
+
# Data schemas / fixtures
|
|
23
|
+
#".csv", ".tsv",
|
|
24
|
+
# Nix / Docker
|
|
25
|
+
".nix", ".dockerfile",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
INCLUDE_ROOT_FILES = {
|
|
29
|
+
# Python
|
|
30
|
+
"pyproject.toml", "setup.py", "setup.cfg",
|
|
31
|
+
"MANIFEST.in", "requirements.txt", "requirements-dev.txt",
|
|
32
|
+
"tox.ini", "noxfile.py", ".flake8",
|
|
33
|
+
"ruff.toml", ".ruff.toml", "mypy.ini", ".mypy.ini",
|
|
34
|
+
"pytest.ini", "conftest.py",
|
|
35
|
+
# Rust / maturin
|
|
36
|
+
"Cargo.toml", "Cargo.lock", "build.rs", "rust-toolchain.toml",
|
|
37
|
+
# R
|
|
38
|
+
"DESCRIPTION", "NAMESPACE", ".Rbuildignore", ".Rinstignore",
|
|
39
|
+
# General
|
|
40
|
+
"Makefile", "justfile", "Dockerfile", "docker-compose.yml",
|
|
41
|
+
".env.example", ".gitignore", ".editorconfig",
|
|
42
|
+
"LICENSE", "LICENSE.md", "LICENSE.txt",
|
|
43
|
+
"README.md", "README.rst", "CHANGELOG.md", "CONTRIBUTING.md",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
SKIP_DIRS = {
|
|
47
|
+
# Python
|
|
48
|
+
"__pycache__", ".mypy_cache", ".pytest_cache", ".ruff_cache",
|
|
49
|
+
".tox", ".nox", ".eggs", "*.egg-info",
|
|
50
|
+
".venv", "venv", "env", ".env",
|
|
51
|
+
"dist", "build", "sdist", "wheelhouse",
|
|
52
|
+
# Rust
|
|
53
|
+
"target",
|
|
54
|
+
# R
|
|
55
|
+
"renv", "packrat", "revdep",
|
|
56
|
+
# General
|
|
57
|
+
"node_modules", ".git", ".hg", ".svn",
|
|
58
|
+
".cache", "coverage", "htmlcov",
|
|
59
|
+
".ipynb_checkpoints", ".DS_Store",
|
|
60
|
+
"site", "_build", "docs/_build",
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
SKIP_FILES = {
|
|
64
|
+
"Cargo.lock", "package-lock.json", "yarn.lock",
|
|
65
|
+
"pnpm-lock.yaml", "bun.lockb",
|
|
66
|
+
".DS_Store", "Thumbs.db",
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
MAX_FILE_SIZE = 900_000 # bytes
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _matches_skip_dir(name: str) -> bool:
|
|
73
|
+
"""Check against SKIP_DIRS, supporting glob-style wildcard entries like '*.egg-info'."""
|
|
74
|
+
if name in SKIP_DIRS:
|
|
75
|
+
return True
|
|
76
|
+
for pattern in SKIP_DIRS:
|
|
77
|
+
if pattern.startswith("*") and name.endswith(pattern[1:]):
|
|
78
|
+
return True
|
|
79
|
+
return False
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def should_include(path: Path, root: Path) -> bool:
|
|
83
|
+
if path.name in SKIP_FILES:
|
|
84
|
+
return False
|
|
85
|
+
try:
|
|
86
|
+
if path.stat().st_size > MAX_FILE_SIZE:
|
|
87
|
+
return False
|
|
88
|
+
except OSError:
|
|
89
|
+
return False
|
|
90
|
+
# Always include recognised root-level config files
|
|
91
|
+
if path.parent == root and path.name in INCLUDE_ROOT_FILES:
|
|
92
|
+
return True
|
|
93
|
+
# Include by extension
|
|
94
|
+
if path.suffix in INCLUDE_EXTENSIONS:
|
|
95
|
+
return True
|
|
96
|
+
# Include extensionless root files that are in the allow-list (e.g. DESCRIPTION, NAMESPACE, Makefile)
|
|
97
|
+
if path.parent == root and path.suffix == "" and path.name in INCLUDE_ROOT_FILES:
|
|
98
|
+
return True
|
|
99
|
+
return False
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def collect_files(root: Path) -> list[Path]:
|
|
103
|
+
files: list[Path] = []
|
|
104
|
+
for dirpath, dirnames, filenames in os.walk(root):
|
|
105
|
+
dirnames[:] = sorted(d for d in dirnames if not _matches_skip_dir(d))
|
|
106
|
+
for fname in sorted(filenames):
|
|
107
|
+
fpath = Path(dirpath) / fname
|
|
108
|
+
if should_include(fpath, root):
|
|
109
|
+
files.append(fpath)
|
|
110
|
+
return files
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def lang_hint(path: Path) -> str:
|
|
114
|
+
"""Return a Markdown code-fence language hint."""
|
|
115
|
+
mapping = {
|
|
116
|
+
".py": "python", ".pyi": "python", ".pyx": "cython", ".pxd": "cython",
|
|
117
|
+
".rs": "rust", ".toml": "toml",
|
|
118
|
+
".R": "r", ".r": "r", ".Rmd": "rmd", ".Rd": "rd",
|
|
119
|
+
".c": "c", ".h": "c", ".cpp": "cpp", ".hpp": "cpp",
|
|
120
|
+
".sh": "bash", ".bash": "bash", ".zsh": "zsh",
|
|
121
|
+
".yaml": "yaml", ".yml": "yaml",
|
|
122
|
+
".json": "json", ".md": "markdown", ".rst": "rst",
|
|
123
|
+
".sql": "sql", ".cfg": "ini", ".ini": "ini", ".inf": "ini",
|
|
124
|
+
#".csv": "csv", ".tsv": "tsv",
|
|
125
|
+
".nix": "nix", ".dockerfile": "dockerfile",
|
|
126
|
+
}
|
|
127
|
+
if path.name == "Makefile" or path.name == "justfile":
|
|
128
|
+
return "makefile"
|
|
129
|
+
if path.name == "Dockerfile":
|
|
130
|
+
return "dockerfile"
|
|
131
|
+
return mapping.get(path.suffix, path.suffix.lstrip("."))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def export(root: Path, output: Path, tree_only: bool = False) -> None:
|
|
135
|
+
files = collect_files(root)
|
|
136
|
+
|
|
137
|
+
with open(output, "w", encoding="utf-8") as out:
|
|
138
|
+
out.write("# Project Structure\n\n```\n")
|
|
139
|
+
for f in files:
|
|
140
|
+
out.write(f"{f.relative_to(root)}\n")
|
|
141
|
+
out.write("```\n\n")
|
|
142
|
+
|
|
143
|
+
if tree_only:
|
|
144
|
+
print(f"Tree written to {output} ({len(files)} files)")
|
|
145
|
+
return
|
|
146
|
+
|
|
147
|
+
out.write("# File Contents\n\n")
|
|
148
|
+
for f in files:
|
|
149
|
+
rel = f.relative_to(root)
|
|
150
|
+
try:
|
|
151
|
+
content = f.read_text(encoding="utf-8")
|
|
152
|
+
except (UnicodeDecodeError, PermissionError):
|
|
153
|
+
continue
|
|
154
|
+
out.write(f"## {rel}\n\n```{lang_hint(f)}\n{content}\n```\n\n")
|
|
155
|
+
|
|
156
|
+
size_kb = output.stat().st_size / 1024
|
|
157
|
+
print(f"Exported {len(files)} files to {output} ({size_kb:.0f} KB)")
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def main() -> None:
|
|
161
|
+
parser = argparse.ArgumentParser(
|
|
162
|
+
description="Export a Python/Rust/R library repo into a single text file for LLM context."
|
|
163
|
+
)
|
|
164
|
+
parser.add_argument("repo", nargs="?", default=".", help="Path to repo root (default: .)")
|
|
165
|
+
parser.add_argument("-o", "--output", default="repo_export.txt", help="Output file (default: repo_export.txt)")
|
|
166
|
+
parser.add_argument("--tree-only", action="store_true", help="Export only the file tree, no contents")
|
|
167
|
+
args = parser.parse_args()
|
|
168
|
+
|
|
169
|
+
root = Path(args.repo).resolve()
|
|
170
|
+
|
|
171
|
+
# Heuristic: warn if nothing recognisable is found
|
|
172
|
+
markers = ("pyproject.toml", "setup.py", "Cargo.toml", "DESCRIPTION")
|
|
173
|
+
if not any((root / m).exists() for m in markers):
|
|
174
|
+
print(f"Warning: no pyproject.toml, setup.py, Cargo.toml, or DESCRIPTION found in {root}")
|
|
175
|
+
|
|
176
|
+
export(root, Path(args.output), args.tree_only)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
if __name__ == "__main__":
|
|
180
|
+
main()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sigma2"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Mutational signature analysis — package name reservation."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Jan Philipp Hummel" },
|
|
13
|
+
]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 1 - Planning",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.urls]
|
|
21
|
+
Homepage = "https://github.com/sigscape/sigma2"
|