Skip to content

Commit e5e3275

Browse files
committed
⬆️ Add optional dependencies
Add some scripts to update optional dependencies Add docs/resources/requirements.md
1 parent aa53054 commit e5e3275

File tree

10 files changed

+66
-13
lines changed

10 files changed

+66
-13
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ authors:
66
- family-names: Wu
77
given-names: Zhenyu
88
orcid: https://orcid.org/0000-0001-6478-9993
9-
title: "repl-python-wakatime: Python REPL plugin for automatic time tracking and metrics generated from your programming activity."
9+
title: "repl-python-wakatime: Python REPL plugin for automatic time tracking and metrics generated from your programming activity"
1010
date-released: 2023-01-12
1111
url: https://github.com/wakatime/repl-python-wakatime

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env -S make -f
2+
pyproject.toml: scripts/generate-pyproject.toml.pl requirements/*.txt
3+
$^ $@
4+
CITATION.cff: scripts/generate-CITATION.cff.pl pyproject.toml
5+
$^ $@
6+
7+
.PHONY: build-docs
8+
build-docs:
9+
cd docs && sphinx-build . _build/html
10+
11+
.PHONY: clean
12+
clean:
13+
rm -rf docs/_build $(IGNORE_PY) src/*.egg-info dist build

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ install_hook(c)
8686
- [ ] [mypython](https://github.com/asmeurer/mypython): Won't fix.
8787
- configure file: non-exist.
8888

89-
`install_hook()` must be after customization of prompt string, best at the end
90-
of file.
89+
`install_hook()` must be after the customization of the prompt string and best
90+
at the end of file.
9191

9292
## Similar projects
9393

94-
- <https://wakatime.com/terminal> lists wakatime plugins for many shells.
94+
- [wakatime plugins for python and many shells](https://wakatime.com/terminal)
95+
- [codestats plugins](https://codestats.net/plugins)

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ search
2929
```
3030

3131
```{include} ../README.md
32+
---
33+
relative-docs: docs
34+
---
3235
```

docs/resources/requirements.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Requirements
2+
3+
```{eval-sh}
4+
cd ..
5+
scripts/generate-requirements.md.pl requirements/*.txt
6+
```

pyproject.toml

100644100755
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
#!/usr/bin/env -S make -B
12
[build-system]
23
requires = ["setuptools >= 45", "setuptools_scm[toml] >= 6.2", "setuptools-generate"]
34
build-backend = "setuptools.build_meta"
45

56
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
67
[project]
78
name = "repl-python-wakatime"
8-
description = "Python REPL plugin for automatic time tracking and metrics generated from your programming activity."
9+
description = "Python REPL plugin for automatic time tracking and metrics generated from your programming activity"
910
authors = [{ name = "Wu Zhenyu", email = "[email protected]" }]
1011
readme = "README.md"
11-
requires-python = ">= 3.9"
12+
requires-python = ">= 3.7"
1213
keywords = ["wakatime", "plugin", "python", "ipython", "ptpython"]
1314
license = { text = "GPL v3" }
1415
classifiers = [
@@ -41,8 +42,19 @@ Source = "https://github.com/wakatime/repl-python-wakatime"
4142
[tool.setuptools.package-data]
4243
repl_python_wakatime = ["py.typed", "assets/*"]
4344

44-
[tool.setuptools.dynamic.optional-dependencies]
45-
dev = { file = "requirements/dev.txt" }
45+
# begin: scripts/generate-pyproject.toml.pl
46+
[tool.setuptools.dynamic.optional-dependencies.dev]
47+
file = "requirements/dev.txt"
48+
49+
[tool.setuptools.dynamic.optional-dependencies.ipython]
50+
file = "requirements/ipython.txt"
51+
52+
[tool.setuptools.dynamic.optional-dependencies.ptipython]
53+
file = "requirements/ptipython.txt"
54+
55+
[tool.setuptools.dynamic.optional-dependencies.ptpython]
56+
file = "requirements/ptpython.txt"
57+
# end: scripts/generate-pyproject.toml.pl
4658

4759
[tool.setuptools_scm]
4860
write_to = "src/repl_python_wakatime/_version.py"

scripts/generate-pyproject.toml.pl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env -S perl -0777pi
2+
BEGIN {
3+
$template = << 'EOF';
4+
[tool.setuptools.dynamic.optional-dependencies.dev]
5+
file = "requirements/dev.txt"
6+
EOF
7+
while ($#ARGV > 0) {
8+
$name = shift;
9+
$name =~ s=.*requirements/(.+?)\.txt=$1=;
10+
$temp = $template;
11+
$temp =~ s/dev/$name/g;
12+
push @temps, $temp;
13+
}
14+
}
15+
$dependencies = join "\n", @temps;
16+
s=(# begin: scripts/generate-pyproject\.toml\.pl\n).*?(# end: scripts/generate-pyproject\.toml\.pl)=$1$dependencies$2=s;

scripts/generate-requirements.md.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env -S perl -p
2+
$title = $ARGV;
3+
$title =~ s=.*?requirements/(.*?)\.txt=$1=;
4+
s`^([^#\n][^\s[>=<^!^]*)`- [$1](https://pypi.org/project/$1)`;
5+
s/^#\s*//;
6+
s/^!.*/## $title/;

src/repl_python_wakatime/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
"""Wakatime
2-
===========
3-
4-
Refer `create-plugin <https://wakatime.com/help/creating-plugin>`_.
5-
"""
1+
"""Refer `create-plugin <https://wakatime.com/help/creating-plugin>`_."""
62
import logging
73
import os
84
from shutil import which
File renamed without changes.

0 commit comments

Comments
 (0)