forked from witten/novel-stats
Compare commits
12 Commits
deroshkin_
...
master
Author | SHA1 | Date |
---|---|---|
Dan Helfman | aedc583fe8 | |
Dan Helfman | c53460bef0 | |
Dan Helfman | e4df1240fb | |
Dan Helfman | 3640f94625 | |
Dan Helfman | 6ea2b18d47 | |
Dan Helfman | 70b88e1671 | |
Dan Helfman | ec886a94bb | |
Dan Helfman | 5a0bde193f | |
Dan Helfman | bd875013b2 | |
Dan Helfman | c8651856a0 | |
Dan Helfman | 6d99b896c9 | |
Dan Helfman | 7ee1c7c439 |
31
.drone.yml
31
.drone.yml
|
@ -1,39 +1,12 @@
|
|||
---
|
||||
kind: pipeline
|
||||
name: python-3-6-alpine-3-9
|
||||
name: python-3-11-alpine-3-18
|
||||
|
||||
clone:
|
||||
skip_verify: true
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: alpine:3.9
|
||||
pull: always
|
||||
commands:
|
||||
- tests/run-ci-tests
|
||||
---
|
||||
kind: pipeline
|
||||
name: python-3-7-alpine-3-10
|
||||
|
||||
clone:
|
||||
skip_verify: true
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: alpine:3.10
|
||||
pull: always
|
||||
commands:
|
||||
- tests/run-ci-tests
|
||||
---
|
||||
kind: pipeline
|
||||
name: python-3-8-alpine-3-13
|
||||
|
||||
clone:
|
||||
skip_verify: true
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: alpine:3.13
|
||||
image: alpine:3.18
|
||||
pull: always
|
||||
commands:
|
||||
- tests/run-ci-tests
|
||||
|
|
18
README.md
18
README.md
|
@ -57,11 +57,11 @@ total: 946 words
|
|||
|
||||
## Installation
|
||||
|
||||
Start by cloning the project with git. Then install it with Python's `pip`.
|
||||
Example:
|
||||
Start by cloning the project with git. Then install it with
|
||||
[pipx](https://pypa.github.io/pipx/). Example:
|
||||
|
||||
```bash
|
||||
pip3 install /path/to/novel-stats
|
||||
pipx install /path/to/novel-stats
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -226,17 +226,9 @@ make sure your changes work.
|
|||
|
||||
```bash
|
||||
cd novel-stats/
|
||||
pip3 install --editable --user .
|
||||
pipx install --editable .
|
||||
```
|
||||
|
||||
Note that this will typically install the novel-stats commands into
|
||||
`~/.local/bin`, which may or may not be on your PATH. There are other ways to
|
||||
install novel-stats editable as well, for instance into the system Python
|
||||
install (so without `--user`, as root), or even into a
|
||||
[virtualenv](https://virtualenv.pypa.io/en/stable/). How or where you install
|
||||
novel-stats is up to you, but generally an editable install makes development
|
||||
and testing easier.
|
||||
|
||||
|
||||
### Automated tests
|
||||
|
||||
|
@ -245,7 +237,7 @@ you're in the `novel-stats/` working copy, install tox, which is used for
|
|||
setting up testing environments:
|
||||
|
||||
```bash
|
||||
pip3 install --user tox
|
||||
pipx install tox
|
||||
```
|
||||
|
||||
Finally, to actually run tests, run:
|
||||
|
|
|
@ -72,7 +72,7 @@ def main():
|
|||
word_count_by_chapter = collections.defaultdict(int)
|
||||
word_count_by_status = collections.defaultdict(int)
|
||||
word_count_by_act = collections.defaultdict(int)
|
||||
status_by_chapter = {}
|
||||
status_by_chapter = collections.defaultdict(lambda: collections.defaultdict(int))
|
||||
current_status = None
|
||||
|
||||
for line in mdfile.readlines():
|
||||
|
@ -83,15 +83,17 @@ def main():
|
|||
chapter_heading = line[len(CHAPTER_MARKER) :].strip('()\n')
|
||||
|
||||
# Count the words in chapter heading, because the chapter number and title count as words.
|
||||
word_count_by_chapter[chapter_heading] = count_words(chapter_heading)
|
||||
|
||||
status_by_chapter[chapter_heading] = collections.defaultdict(int)
|
||||
current_status = None
|
||||
if chapter_heading:
|
||||
word_count_by_chapter[chapter_heading] = count_words(chapter_heading)
|
||||
current_status = None
|
||||
# Modified to allow multiple statuses in a single chapter, can swap back and forth.
|
||||
elif line.startswith(STATUS_MARKER):
|
||||
if current_status is None:
|
||||
current_status = line[len(STATUS_MARKER) :].strip('()\n')
|
||||
status_by_chapter[chapter_heading][current_status] = count_words(chapter_heading)
|
||||
if chapter_heading:
|
||||
status_by_chapter[chapter_heading][current_status] = count_words(
|
||||
chapter_heading
|
||||
)
|
||||
else:
|
||||
current_status = line[len(STATUS_MARKER) :].strip('()\n')
|
||||
elif line.startswith(ACT_MARKER):
|
||||
|
|
11
setup.py
11
setup.py
|
@ -20,8 +20,15 @@ setup(
|
|||
"Topic :: Text Processing :: Markup",
|
||||
],
|
||||
packages=find_packages(exclude=["tests*"]),
|
||||
entry_points={"console_scripts": ["novel-stats = novel_stats.novel_stats:main",]},
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"novel-stats = novel_stats.novel_stats:main",
|
||||
]
|
||||
},
|
||||
install_requires=(),
|
||||
extras_require={"multi_file": ["MarkdownPP"],},
|
||||
extras_require={
|
||||
"multi_file": ["MarkdownPP"],
|
||||
},
|
||||
include_package_data=True,
|
||||
python_requires='>3.7.0',
|
||||
)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
appdirs==1.4.4; python_version >= '3.8'
|
||||
attrs==20.3.0; python_version >= '3.8'
|
||||
black==19.10b0; python_version >= '3.8'
|
||||
click==7.1.2; python_version >= '3.8'
|
||||
coverage==5.3
|
||||
flake8==3.8.4
|
||||
flexmock==0.10.4
|
||||
isort==5.9.1
|
||||
mccabe==0.6.1
|
||||
pluggy==0.13.1
|
||||
pathspec==0.8.1; python_version >= '3.8'
|
||||
py==1.10.0
|
||||
pycodestyle==2.6.0
|
||||
pyflakes==2.2.0
|
||||
pytest==6.1.2
|
||||
pytest-cov==2.10.1
|
||||
regex; python_version >= '3.8'
|
||||
typed-ast==1.4.2; python_version >= '3.8'
|
||||
appdirs==1.4.4
|
||||
attrs==23.1.0
|
||||
black==23.10.1
|
||||
click==8.1.7
|
||||
coverage==7.3.2
|
||||
flake8==6.1.0
|
||||
flexmock==0.11.3
|
||||
isort==5.12.0
|
||||
mccabe==0.7.0
|
||||
pluggy==1.3.0
|
||||
pathspec==0.11.2
|
||||
py==1.11.0
|
||||
pycodestyle==2.11.1
|
||||
pyflakes==3.1.0
|
||||
pytest==7.4.2
|
||||
pytest-cov==4.1.0
|
||||
regex
|
||||
typed-ast
|
||||
|
|
|
@ -9,7 +9,6 @@ set -e
|
|||
apk add --no-cache python3 py3-pip
|
||||
# If certain dependencies of black are available in this version of Alpine, install them.
|
||||
apk add --no-cache py3-typed-ast py3-regex || true
|
||||
python3 -m pip install --upgrade pip==21.3.1 setuptools==58.2.0
|
||||
pip3 install tox==3.24.4
|
||||
pip3 install tox==4.11.3
|
||||
export COVERAGE_FILE=/tmp/.coverage
|
||||
tox --workdir /tmp/.tox --sitepackages
|
||||
|
|
17
tox.ini
17
tox.ini
|
@ -1,16 +1,16 @@
|
|||
[tox]
|
||||
envlist = py36,py37,py38,py39
|
||||
env_list = py38,py39,py310,py311
|
||||
skip_missing_interpreters = True
|
||||
skipsdist = True
|
||||
minversion = 3.14.1
|
||||
package = editable
|
||||
minversion = 4.0
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
deps = -rtest_requirements.txt
|
||||
passenv = COVERAGE_FILE
|
||||
deps =
|
||||
-r test_requirements.txt
|
||||
pass_env = COVERAGE_FILE
|
||||
commands =
|
||||
pytest {posargs}
|
||||
py38,py39: black --check .
|
||||
black --check .
|
||||
isort --check-only --settings-path setup.cfg .
|
||||
flake8 novel_stats tests
|
||||
|
||||
|
@ -23,6 +23,7 @@ commands =
|
|||
pytest {posargs}
|
||||
|
||||
[testenv:isort]
|
||||
deps = {[testenv]deps}
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
commands =
|
||||
isort --settings-path setup.cfg .
|
||||
|
|
Loading…
Reference in New Issue