inventory¶
Retrieve and parse a GitHub user's repositories/files.
Inventory ¶
Inventory(
username: str,
lazy: bool = False,
token: str | None = None,
use_cache: bool = True,
force_refresh: bool = False,
filter_exprs: tuple[str, ...] | tuple[Expr, ...] = None,
select_exprs: tuple[str, ...] | tuple[Expr, ...] = None,
addcols_exprs: tuple[str, ...] | tuple[Expr, ...] = None,
show_tbl_cols: int | None = None,
show_tbl_rows: int | None = None,
)
Retrieve and parse a GitHub user's public repositories into a Polars DataFrame.
Results are cached locally to avoid repeated API calls.
username: The GitHub username to fetch repositories for.
lazy: Whether to allow lazy Polars operations (not all transformations may be supported).
token: An optional GitHub personal access token for higher rate limits.
use_cache: Whether to use cached results if available.
force_refresh: If True, always refetch from GitHub and overwrite the cache.
filter_exprs: One or more Polars schema (column) names to filter (where True),
or an Expr to filter the repository listing or file walk tree.
select_exprs: One or more Polars schema (column) names to select, or an
Expr to evaluate for the repository listing or file walk tree.
addcols_exprs: One or more Polars schema (column) names to with_columns, or an
Expr to evaluate for the repository listing or file walk tree.
show_tbl_cols: Configure Polars to print N columns if `int` (default: None).
show_tbl_rows: Configure Polars to print N rows if `int` (default: None).
Source code in src/octopols/inventory.py
list_repos ¶
Fetch and parse the public repositories for the specified GitHub user.
Checks the local cache first (unless force_refresh=True). Returns a Polars DataFrame with the columns 'name', 'html_url', and 'description'.
Source code in src/octopols/inventory.py
review_version_changes ¶
Compare repository metadata across two versions (placeholder).
Currently returns a trivial DataFrame.
Source code in src/octopols/inventory.py
walk_file_trees ¶
walk_file_trees(
pattern: str = "**",
no_recurse: bool = False,
skip_larger_than_mb: int | None = None,
) -> pl.DataFrame
Walk (recursively enumerate) files in each repository via UPath.
Discovers (but does not read) file paths that match a given glob pattern.
pattern: Glob pattern for file listing. By default "**" (recursive).
no_recurse: If True, uses "*" (non-recursive) instead of the default "**".
skip_larger_than_mb: If set, skip listing files larger than this many MB.
By default, None (don't skip based on size).
A Polars DataFrame with columns:
- "repository_name": str
- "file_path": str
- "is_directory": bool
- "file_size_bytes": int
Source code in src/octopols/inventory.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
read_files ¶
read_files(
pattern: str = "**",
no_recurse: bool = False,
skip_larger_than_mb: int | None = None,
) -> pl.DataFrame
Read all file contents in each matched repository path.
This enumerates all files (via walk_file_trees) that match pattern,
then reads their text content if they are not directories.
pattern: Glob pattern for file listing. Default "**" means recursive.
no_recurse: If True, uses "*" instead of "**".
skip_larger_than_mb: Optional size limit in MB. If set, skip any file above it.
A Polars DataFrame with columns:
- "repository_name": str
- "file_path": str
- "file_size_bytes": int
- "content": str (file content, or empty if directory/failed)
Source code in src/octopols/inventory.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |