git-lines-graph 2.1.0__tar.gz → 2.2.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-lines-graph
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Git commit lines graph
5
5
  Project-URL: Repository, https://github.com/danielfleischer/git-commits-lines-graph
6
6
  Project-URL: Issues, https://github.com/danielfleischer/git-commits-lines-graph/issues
@@ -27,13 +27,18 @@ Requires-Dist: pandas>=2.2.2
27
27
  Description-Content-Type: text/markdown
28
28
 
29
29
  # Git Commit Lines Graph
30
- [![PyPI](https://img.shields.io/pypi/v/git-lines-graph)](https://pypi.org/project/git-lines-graph/)
31
30
 
32
- A small python script to visualize the number of lines in a project, as a function of time.
31
+ [![PyPI](https://img.shields.io/pypi/v/git-lines-graph?color=brightgreen)](https://pypi.org/project/git-lines-graph/)
32
+ [![Python Version](https://img.shields.io/pypi/pyversions/git-lines-graph?color=orange)](https://pypi.org/project/git-lines-graph/)
33
+ [![License: GPL v3+](https://img.shields.io/badge/License-GPLv3+-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
34
+ [![Downloads](https://img.shields.io/pypi/dm/git-lines-graph?color=red)](https://pypi.org/project/git-lines-graph/)
35
+
36
+ A small python script to visualize the number of lines in a project, as a function of time.
33
37
 
34
38
  <img src="https://raw.githubusercontent.com/danielfleischer/git-commits-lines-graph/master/example.png" width="400" align="center">
35
39
 
36
40
  ## Install
41
+
37
42
  ```sh
38
43
  uv tool install git-lines-graph
39
44
  # OR
@@ -42,17 +47,18 @@ python3 -m pip install git-lines-graph
42
47
 
43
48
  ## Usage
44
49
 
45
- Run: `git-lines-graph [-b BRANCH] [GIT-DIR]`
50
+ Run: `git-lines-graph [-b BRANCH] [GIT-DIR]`
46
51
 
47
- Call with an optional git project directory. You can also specify a branch to scan; other wise the branch currently checked in is used.
52
+ Call with an optional git project directory. You can also specify a branch to scan; other wise the branch currently checked in is used.
48
53
 
49
54
  ## Dependencies
50
55
 
51
56
  - `GitPython` to interact with `git`.
52
57
  - `matplotlib` for plotting.
53
- - `pandas` for data manipulation.
58
+ - `pandas` for data manipulation.
54
59
 
55
60
  ----
56
61
 
57
62
  ### How Does It Work
58
- The code goes over all commits messages and looks for the number of lines added/removed and keeps an updated count. **Caveat**: the lines reported in git commit messages are only a proxy for the true number of lines of code. It could be way off in projects in which there are data artifacts such as big data files. One solution is to loop over all commits, checkout the commit and do a `wc` over all files that are considered to be code files. But that's slower and could be dangerous in dirty projects.
63
+
64
+ The code goes over all commits messages and looks for the number of lines added/removed and keeps an updated count. **Caveat**: the lines reported in git commit messages are only a proxy for the true number of lines of code. It could be way off in projects in which there are data artifacts such as big data files. One solution is to loop over all commits, checkout the commit and do a `wc` over all files that are considered to be code files. But that's slower and could be dangerous in dirty projects.
@@ -1,11 +1,16 @@
1
1
  # Git Commit Lines Graph
2
- [![PyPI](https://img.shields.io/pypi/v/git-lines-graph)](https://pypi.org/project/git-lines-graph/)
3
2
 
4
- A small python script to visualize the number of lines in a project, as a function of time.
3
+ [![PyPI](https://img.shields.io/pypi/v/git-lines-graph?color=brightgreen)](https://pypi.org/project/git-lines-graph/)
4
+ [![Python Version](https://img.shields.io/pypi/pyversions/git-lines-graph?color=orange)](https://pypi.org/project/git-lines-graph/)
5
+ [![License: GPL v3+](https://img.shields.io/badge/License-GPLv3+-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
6
+ [![Downloads](https://img.shields.io/pypi/dm/git-lines-graph?color=red)](https://pypi.org/project/git-lines-graph/)
7
+
8
+ A small python script to visualize the number of lines in a project, as a function of time.
5
9
 
6
10
  <img src="https://raw.githubusercontent.com/danielfleischer/git-commits-lines-graph/master/example.png" width="400" align="center">
7
11
 
8
12
  ## Install
13
+
9
14
  ```sh
10
15
  uv tool install git-lines-graph
11
16
  # OR
@@ -14,17 +19,18 @@ python3 -m pip install git-lines-graph
14
19
 
15
20
  ## Usage
16
21
 
17
- Run: `git-lines-graph [-b BRANCH] [GIT-DIR]`
22
+ Run: `git-lines-graph [-b BRANCH] [GIT-DIR]`
18
23
 
19
- Call with an optional git project directory. You can also specify a branch to scan; other wise the branch currently checked in is used.
24
+ Call with an optional git project directory. You can also specify a branch to scan; other wise the branch currently checked in is used.
20
25
 
21
26
  ## Dependencies
22
27
 
23
28
  - `GitPython` to interact with `git`.
24
29
  - `matplotlib` for plotting.
25
- - `pandas` for data manipulation.
30
+ - `pandas` for data manipulation.
26
31
 
27
32
  ----
28
33
 
29
34
  ### How Does It Work
30
- The code goes over all commits messages and looks for the number of lines added/removed and keeps an updated count. **Caveat**: the lines reported in git commit messages are only a proxy for the true number of lines of code. It could be way off in projects in which there are data artifacts such as big data files. One solution is to loop over all commits, checkout the commit and do a `wc` over all files that are considered to be code files. But that's slower and could be dangerous in dirty projects.
35
+
36
+ The code goes over all commits messages and looks for the number of lines added/removed and keeps an updated count. **Caveat**: the lines reported in git commit messages are only a proxy for the true number of lines of code. It could be way off in projects in which there are data artifacts such as big data files. One solution is to loop over all commits, checkout the commit and do a `wc` over all files that are considered to be code files. But that's slower and could be dangerous in dirty projects.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "git-lines-graph"
3
- version = "2.1.0"
3
+ version = "2.2.0"
4
4
  description = "Git commit lines graph"
5
5
  readme = "README.md"
6
6
  license = "GPL-3.0-or-later"
@@ -40,3 +40,6 @@ Homepage = "https://github.com/danielfleischer/git-commits-lines-graph"
40
40
  [build-system]
41
41
  requires = ["hatchling"]
42
42
  build-backend = "hatchling.build"
43
+
44
+ [tool.ruff]
45
+ line-length = 120
@@ -9,21 +9,25 @@ import pandas as pd
9
9
 
10
10
  def main():
11
11
  parser = argparse.ArgumentParser()
12
- parser.add_argument("git_dir", type=str, nargs="?", default=os.getcwd(), help="Git directory (default: current directory)")
12
+ parser.add_argument(
13
+ "git_dir",
14
+ type=str,
15
+ nargs="?",
16
+ default=os.getcwd(),
17
+ help="Git directory (default: git root of current directory)",
18
+ )
13
19
  parser.add_argument("-b", "--branch", type=str, default=None, help="Branch to browse")
14
20
 
15
21
  args = parser.parse_args()
16
- git_dir = args.git_dir
17
- branch = args.branch
18
22
 
19
23
  try:
20
- repo = git.repo.Repo(git_dir)
24
+ repo = git.Repo(args.git_dir, search_parent_directories=True)
21
25
  except git.exc.InvalidGitRepositoryError as e:
22
- print("Not a valid git project: {}".format(git_dir))
26
+ print("Not part of a valid git project: {}".format(args.git_dir))
23
27
  exit()
24
28
 
25
29
  data = []
26
- for i in reversed(list(repo.iter_commits(rev=branch))):
30
+ for i in reversed(list(repo.iter_commits(rev=args.branch))):
27
31
  diff = i.stats.total
28
32
  data.append([i.committed_datetime.isoformat(), diff["insertions"], diff["deletions"]])
29
33
 
@@ -34,7 +38,7 @@ def main():
34
38
  data.set_index(["date"], inplace=True)
35
39
 
36
40
  with plt.xkcd():
37
- plt.figure("Code Lines Progress in project {}".format(os.path.basename(git_dir)))
41
+ plt.figure("Code Lines Progress in project {}".format(os.path.basename(repo.working_tree_dir)))
38
42
  plt.ylabel("# of lines")
39
43
  ax = data["total"].plot()
40
44
  ax.yaxis.set_major_formatter(mpl.ticker.StrMethodFormatter("{x:,.0f}"))
File without changes
File without changes