Repository line-count reports with cloc support and a Python fallback.
Project description
slopscope
Colorful repository line-count reports by language, source, tests, and directory, with cloc support and a
pure-Python fallback.
This project is prepared for its first pre-release but is not published yet. The repository contains the installable
Python package, cloc-backed language summaries and file summaries, internal report data models, a pure-Python
fallback for physical-line reports, default path classification, rendered reports for language, source/test, area,
and directory summaries, [tool.slopscope] configuration loading from pyproject.toml, configured profile
execution for YAML totals and grouped top-N reports, and configured multi-project workspace reports.
slopscope is intended to replace small, repeated just loc and just yaml-lines implementations with one
reusable Python CLI that can be added as a development dependency.
Current Features
- Language summaries using
clocwhen available. - Pure-Python fallback for environments without
cloc. - Plain text output without optional dependencies.
- Optional Rich colored terminal tables with plain text fallback.
- Source-vs-tests summaries for
src/+tests/projects. - Directory buckets sorted by line count.
- Repository area summaries for source, tests, docs, scripts, examples, specs, and tooling.
- Configuration from
[tool.slopscope]inpyproject.toml, or from--config PATH. - Configured excludes, included fallback globs, language filters, source/test dirs, named areas, and nested buckets for the default single-repository report.
- Named profile execution from
[tool.slopscope.profiles]. - YAML-only total profiles with
--total-onlyinteger output. - Physical-line profile totals for compatibility with
wc -l-style recipes. - Grouped top-N profile reports for path patterns such as
roles/*. - Multi-project workspace reports from
[tool.slopscope.projects]. - Optional project skipping for missing configured projects.
- JSON output for future CI or badge integrations.
Planned Features
- Persistent metrics and trend storage.
Installation
Until the first package release is published, use a source checkout:
git clone https://github.com/ephes/slopscope.git
cd slopscope
uv run slopscope --help
uv run slopscope --engine python .
To use the checkout as a development dependency in another repository before publication:
uv add --dev --editable ../slopscope
uv run slopscope
After a pre-release is published to a package index, install it like any other development dependency. Pre-release resolution must be enabled when the latest available version is pre-release-only:
uv add --dev --prerelease allow slopscope
uv run slopscope
For pip-based environments:
python -m pip install --pre slopscope
slopscope --help
cloc is optional. With --engine auto, slopscope uses cloc when the binary is available on PATH and falls
back to the pure-Python engine otherwise. Install cloc separately if you want cloc code-line semantics.
Rich is also optional. Human-readable output defaults to --format rich, but if Rich is not installed the command
falls back to plain text. Install Rich separately in projects that want colored tables; no runtime dependency is
required for plain text or JSON output.
Usage
uv run slopscope
uv run slopscope path/to/repository
uv run slopscope --engine cloc
uv run slopscope --engine python
uv run slopscope --format plain
uv run slopscope --format json
uv run slopscope --no-color
uv run slopscope --config path/to/pyproject.toml
uv run slopscope --project frontend
uv run slopscope --project frontend --project backend
uv run slopscope --project all
uv run slopscope --profile yaml --total-only
uv run slopscope --profile roles --top 20
For migration compatibility, the package also exposes:
uv run count-lines-of-code
The current implementation supports --engine auto|cloc|python. auto uses cloc when it is available and falls
back to the Python engine when cloc is not on PATH. --engine cloc keeps failing clearly when cloc is
unavailable.
The Python engine discovers files with git ls-files when possible and otherwise walks the filesystem. It applies
default excludes for common caches, virtual environments, dependency directories, and build output, then counts
physical lines in mapped text-like files using UTF-8 with ignored decode errors. Python fallback reports are marked
with Engine: python (physical lines).
Human-readable output defaults to --format rich. Rich is optional: when it is not importable, slopscope falls
back to the plain renderer. Use --format plain for deterministic dependency-free text, --format json for
structured output, or --no-color to force colorless human-readable output.
By default, slopscope looks for [tool.slopscope] in pyproject.toml under the inspected path. Missing
configuration keeps the built-in defaults. Use --config PATH to load a specific TOML file; missing files, invalid
TOML, and invalid field types fail with a clear slopscope: error and exit code 2.
Current single-repository configuration supports:
exclude_languagesandinclude_languagesexclude_dirsinclude_globsfor the Python fallbacksource_dirsandtest_dirsareasnested_bucket_dirs
Configured profiles can be selected with --profile NAME. Configured projects can be selected with
--project NAME, repeated as needed, or --project all.
Project execution supports:
- paths resolved relative to the configuration file
- top-level filters and classification settings applied to each project
- multi-project plain, Rich, and JSON output
- optional missing projects skipped with a concise stderr notice
- required missing projects failing clearly with a non-zero exit
--project and --profile cannot be combined in the current implementation.
Profile execution supports:
include_languages,exclude_languages, andinclude_globsphysical_lines = truefor Python fallback physical-line totals, even when--engine clocis selectedphysical_lines = falsefor normal engine semantics:cloccode lines whenclocis selected or available, and Python physical lines when the Python fallback is selectedgroup_by = "roles/*"style grouped reports, displayed asroles/<name>top = Nin config, with--top Nas a CLI override--total-onlyfor one integer plus a newline; without--profile,--total-onlyis a usage error
When a profile sets its own language filters or include globs, those profile values are used for that profile.
Top-level values are used only when the profile field is empty. Top-level exclude_dirs always apply.
Default rendered sections are:
- Language Summary
- Source vs Tests
- Repository Areas
- Directory Buckets
Development
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mypy
The same commands are available through the justfile as just test, just lint, just format-check,
just typecheck, and just check. Use just loc to dogfood the local slopscope package with the Python engine
and Rich output from the development environment.
Build the local package without publishing:
uv build
uv run python -m zipfile -l dist/slopscope-*.whl
uv run python -m tarfile -l dist/slopscope-*.tar.gz
rm -rf dist
Publishing is intentionally not part of the normal development check. Confirm the target registry, credentials, and final version before running a publish command.
Project Status
This repository is in pre-release readiness. The completed slices are intentionally narrow: package metadata,
console scripts, cloc availability detection, language-summary and file-summary CSV parsing, fallback file
discovery, fallback language mapping, physical-line counting, internal aggregation for source/test, area, and
directory summaries, plain/Rich/JSON rendering for the default single-repository report, configuration loading for
that report, named profile execution for YAML totals and grouped top-N reports, configured multi-project workspace
reports, synthetic migration fixture coverage, and release workflow documentation. See:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slopscope-0.1.0a1.tar.gz.
File metadata
- Download URL: slopscope-0.1.0a1.tar.gz
- Upload date:
- Size: 70.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b05a39fc76ac2f8098c10aaa7681253c2bad6258dfd99e6879654784e8e13eb3
|
|
| MD5 |
361ccfff0b7822902801d31d83ea6d77
|
|
| BLAKE2b-256 |
b6e26558c40e7ea5aefd0579869ea4c3ae2ff816a97226231cf456dea5c1ab89
|
File details
Details for the file slopscope-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: slopscope-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4778fba20226b8bc132bbb6ec9a51e8a4ff7f32eec38f8fcb5fbc3e6b5906dd2
|
|
| MD5 |
177c1faadfcf60d9f16518d4111c74b9
|
|
| BLAKE2b-256 |
c1dfdb5273ec4d79ebefca60f9c0031073fd5a323c1ab39251b11e489d96e3b4
|