A tool for analyzing research software repositories with focus on workflow languages
Project description
Mudag
A CLI tool for analyzing research software repositories with a focus on workflow languages. Mudag helps researchers and developers count code, comments, and blank lines in various workflow language files to understand code complexity and documentation levels.
Features
- Count code lines, comment lines, and blank lines in files
- Focus on workflow languages used in scientific research:
- Common Workflow Language (CWL)
- Snakemake
- Nextflow
- Galaxy
- KNIME
- Support for scanning individual files or entire directories
- Multiple output formats (table, JSON, CSV)
- Automatic file and directory exclusion using
.mudagignorepatterns (similar to.gitignore)
Installation
From GitHub
# Clone the repository
git clone https://github.com/aaronstrachardt/mudag.git
cd mudag
# Create and activate Virtual Environment (recommended)
python3 -m venv venv
source venv/bin/activate
# Install the package in development mode
pip install -e .
Requirements
- Python 3.7+
- No external dependencies required
Usage
Analyze a File or Directory
# Analyze workflow files in a directory
mudag analyze path/to/directory
# Analyze a specific file
mudag analyze path/to/file.cwl
# Choose output format
mudag analyze path/to/directory --format json
# Save output to a file
mudag analyze path/to/directory --output results.json
List Workflow Files
# List all workflow files in a directory
mudag list-workflows path/to/directory
Supported Workflow Languages
| Language | Extensions |
|---|---|
| Common Workflow Language | .cwl |
| Snakemake | Snakefile, .smk, .snake, .snakefile, .snakemake, .rules, .rule |
| Nextflow | .nf, .nextflow, .config |
| Galaxy | .ga, .galaxy, .gxwf |
| KNIME | .knwf, .workflow.knime, .knar |
Output Formats
Table (default)
File Path | Code | Comment | Blank | Total
------------------------------------------------
path/to/file1.cwl | 10 | 5 | 2 | 17
path/to/file2.smk | 20 | 10 | 5 | 35
------------------------------------------------
TOTAL | 30 | 15 | 7 | 52
JSON
{
"summary": {
"total_files": 2,
"total_code": 30,
"total_comment": 15,
"total_blank": 7,
"total_lines": 52
},
"files": {
"path/to/file1.cwl": {
"code": 10,
"comment": 5,
"blank": 2,
"total": 17
},
"path/to/file2.smk": {
"code": 20,
"comment": 10,
"blank": 5,
"total": 35
}
}
}
CSV
File Path,Code Lines,Comment Lines,Blank Lines,Total Lines
path/to/file1.cwl,10,5,2,17
path/to/file2.smk,20,10,5,35
TOTAL,30,15,7,52
Configuration Options
Using .mudagignore Files
Mudag automatically uses .mudagignore files to exclude files and directories from analysis. This allows you to specify patterns of files and directories to exclude, similar to how .gitignore works.
Creating a .mudagignore File
You can create a .mudagignore file in the following locations:
- Project-specific: In the root directory of your project
- Global: In your home directory (
~/.mudagignore)
Example .mudagignore file:
# Default directories to ignore
.git/
__pycache__/
node_modules/
venv/
env/
# Ignore all .log files
*.log
# Ignore specific directories
temp/
old_workflows/
# Ignore specific files
broken_workflow.cwl
test_data.fa
The ignore patterns support glob patterns similar to .gitignore:
*matches any number of characters?matches a single character[abc]matches any character in the set- Lines starting with
#are treated as comments
Development
Testing
To run the tests for Mudag:
# Run all tests
python3 -m pytest tests -v
# Run specific tests
python3 -m pytest tests/unit/test_analyzer.py -v
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 mudag-0.1.0.tar.gz.
File metadata
- Download URL: mudag-0.1.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92e4b78e7d325c070ffad943fe4e5c9bc235de7867fc07faac44396dd320585e
|
|
| MD5 |
0ec0e700e4573cca31bc2e480376e070
|
|
| BLAKE2b-256 |
b28717127fea1e71c047ef661aab12e6fa9b080ffd44b8c0a422aabbbaf6d0ea
|
File details
Details for the file mudag-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mudag-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9399fb381fa06b86e01ba696486268aff889ff620eada6497a00db28d8a93d8b
|
|
| MD5 |
e8f685a36b70bf17dd516c572a37a79a
|
|
| BLAKE2b-256 |
683f4381fbfc08c1f524ce6653434f4bbca404072a383eac0ea73aaa36b4ec1c
|