Skip to content

Commit 465bfdb

Browse files
committed
Added man pages
* Added initial manpages and adjusted some python cruft to handle adding them when done via a normal pip install. Note that this will probably require sudo or --user to install this now. Need to double-check this once we get a proper pip install on PyPI * Adjusted some of the references to tests in the MANIFEST.in and setup.py * Updated README.md to handle the current dir structure and inform how to dev/test in the project
1 parent 8296661 commit 465bfdb

File tree

4 files changed

+169
-18
lines changed

4 files changed

+169
-18
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ include LICENSE
22
include README.md
33
include TODO.md
44
recursive-include git_py_stats *
5-
recursive-include tests *
5+
recursive-include man *
66
global-exclude *.pyc __pycache__/
77

README.md

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Git Py Stats
23

34
Git Py Stats is a Python-based fork inspired by [git-quick-stats](https://github.com/arzzen/git-quick-stats).
@@ -11,15 +12,15 @@ While `git-quick-stats` is a fantastic tool, it has some limitations due to its
1112
reliance on Bash and external utilities:
1213

1314
- **Cross-Platform Compatibility**: `git-quick-stats` can have issues running
14-
on different platforms. For example, macOS requires GNU versions of certain
15-
utilities for proper functionality.
15+
on different platforms. For example, macOS requires GNU versions of certain
16+
utilities for proper functionality.
1617
- **Dependency on External Tools**: Although it is written in Bash, it depends
17-
heavily on external tools like `awk`, `sed`, and `grep`,
18-
which may not be available or behave subtly different across systems.
18+
heavily on external tools like `awk`, `sed`, and `grep`,
19+
which may not be available or behave subtly different across systems.
1920
- **Robust File Generation**: `git-quick-stats` has the ability to export
20-
stats in JSON and CSV format, but they are home-grown implementations.
21+
stats in JSON and CSV format, but they are home-grown implementations.
2122
- **Difficult to Test and Extend**: Bash scripts are inherently harder to test
22-
and extend compared to a Python-based solution.
23+
and extend compared to a Python-based solution.
2324

2425
Git Py Stats addresses these issues by leveraging Python's standard library,
2526
ensuring that it pulls in code tested by the Python team and works seamlessly
@@ -57,8 +58,8 @@ Git Py Stats is currently in beta format. As such, it is missing the following:
5758

5859
## Requirements
5960

60-
- **Python 3.x**: Git Py Stats requires Python 3.x installed on your system.
61-
You can check your Python version with:
61+
- **Python 3.6+**: Git Py Stats requires Python 3.6 or higher installed on your system.
62+
You can check your Python version with:
6263

6364
```bash
6465
python3 --version
@@ -150,21 +151,55 @@ git-py-stats --help
150151
151152
## Development
152153
153-
- **`src/git_py_stats`**: Core package containing main functionality
154-
- **`tests`**: Contains test cases for the various modules
154+
This section is currently under development and is changing rapidly as we work
155+
on getting features added. The current structure is as follows:
156+
157+
- **`git_py_stats/`**: Core package
158+
- **`git_py_stats/tests/`**: Test cases for the various modules
159+
160+
### Testing
155161
156-
### Running Tests
162+
This project uses Python's built-in `unittest` framework for testing.
157163

158-
1. **Install Testing Dependencies**:
164+
#### Running Tests
165+
166+
1. **Navigate to the Project Directory**:
159167

160168
```bash
161-
pip install -r requirements-dev.txt
169+
cd git-py-stats
162170
```
163171

164-
2. **Run Tests**:
172+
2. **Run All Tests**:
173+
174+
You can run all tests using the `unittest` discovery mode, which will
175+
automatically find and execute all test files named `test_*.py`
176+
within the `git_py_stats/tests/` directory:
177+
178+
```bash
179+
python -m unittest discover -s git_py_stats/tests
180+
```
181+
182+
3. **Run a Specific Test File**:
183+
184+
To run a specific test file, you can use:
165185

166186
```bash
167-
pytest tests/
187+
python -m unittest git_py_stats.tests.test_generate_cmds
188+
```
189+
190+
#### Additional Tips
191+
192+
- Ensure that all test files follow the naming convention `test_*.py`.
193+
- To view more detailed output, use the `-v` (verbose) flag:
194+
195+
```bash
196+
python -m unittest discover -s git_py_stats/tests -v
197+
```
198+
199+
- To run all tests automatically and display a summary of results:
200+
201+
```bash
202+
python -m unittest discover -s git_py_stats/tests
168203
```
169204

170205
## Contribution
@@ -188,4 +223,3 @@ See the [LICENSE](LICENSE) file for more details.
188223
## Author
189224

190225
Tom Ice
191-

man/git-py-stats.1

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
.TH GIT-PY-STATS "1" "September 2024" "git-py-stats 0.1" "User Commands"
2+
.SH NAME
3+
git-py-stats \- A Python implementation of git-quick-stats.
4+
5+
.SH SYNOPSIS
6+
.B git-py-stats
7+
[\fIoptions\fR]
8+
9+
.SH DESCRIPTION
10+
git-py-stats is a command-line tool for generating various statistics and information about a git repository.
11+
12+
.SH OPTIONS
13+
.TP
14+
.B \-T, \--detailed-git-stats
15+
Display a detailed list of git statistics.
16+
17+
.TP
18+
.B \-R, \--git-stats-by-branch BRANCH
19+
Show detailed git statistics by branch.
20+
21+
.TP
22+
.B \-c, \--changelogs
23+
Display the changelogs.
24+
25+
.TP
26+
.B \-L, \--changelogs-by-author "AUTHOR NAME"
27+
Show changelogs filtered by author.
28+
29+
.TP
30+
.B \-S, \--my-daily-stats
31+
Show your daily stats.
32+
33+
.TP
34+
.B \-V, \--csv-output-by-branch
35+
Output daily stats by branch in CSV format.
36+
37+
.TP
38+
.B \-j, \--json-output
39+
Save git log as a JSON formatted file.
40+
41+
.TP
42+
.B \-b, \--branch-tree
43+
Show an ASCII graph of the git repository branch history.
44+
45+
.TP
46+
.B \-D, \--branches-by-date
47+
Display branches sorted by date.
48+
49+
.TP
50+
.B \-C, \--contributors
51+
See a list of all contributors to the repository.
52+
53+
.TP
54+
.B \-n, \--new-contributors
55+
List contributors who made their first contribution since a specified date.
56+
57+
.TP
58+
.B \-a, \--commits-per-author
59+
Display a list of commits per author.
60+
61+
.TP
62+
.B \-d, \--commits-per-day
63+
Display a list of commits per day.
64+
65+
.TP
66+
.B \-Y, \--commits-by-year
67+
Display a list of commits per year.
68+
69+
.TP
70+
.B \-m, \--commits-by-month
71+
Display a list of commits per month.
72+
73+
.TP
74+
.B \-w, \--commits-by-weekday
75+
Display a list of commits per weekday.
76+
77+
.TP
78+
.B \-W, \--commits-by-author-by-weekday "AUTHOR NAME"
79+
Display a list of commits per weekday by author.
80+
81+
.TP
82+
.B \-o, \--commits-by-hour
83+
Display a list of commits per hour.
84+
85+
.TP
86+
.B \-A, \--commits-by-author-by-hour "AUTHOR NAME"
87+
Display a list of commits per hour by author.
88+
89+
.TP
90+
.B \-z, \--commits-by-timezone
91+
Display a list of commits by timezone.
92+
93+
.TP
94+
.B \-Z, \--commits-by-author-by-timezone "AUTHOR NAME"
95+
Display a list of commits by timezone by author.
96+
97+
.TP
98+
.B \-r, \--suggest-reviewers
99+
Suggest code reviewers based on contribution history.
100+
101+
.TP
102+
.B \-h, \--help
103+
Show this help message and exit.
104+
105+
.SH AUTHOR
106+
Written by Tom Ice.
107+
108+
.SH COPYRIGHT
109+
MIT License. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
110+

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
setup(
44
name='git-py-stats',
55
version='0.1',
6-
packages=find_packages(),
6+
packages=find_packages(
7+
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]
8+
), # Exclude test packages
79
entry_points={
810
'console_scripts': [
911
'git-py-stats=git_py_stats.main:main',
@@ -12,11 +14,16 @@
1214
install_requires=[
1315
# Nothing
1416
],
17+
data_files=[
18+
# Manpages
19+
('share/man/man1', ['man/git-py-stats.1']),
20+
],
1521
description='A Python Implementation of git-quick-stats',
1622
long_description=open('README.md').read(),
1723
long_description_content_type='text/markdown',
1824
author='Tom Ice',
1925
license='MIT',
2026
url='https://github.com/tomice/git-py-stats',
27+
python_requires='>=3.6',
2128
)
2229

0 commit comments

Comments
 (0)