Skip to content

Commit 7f54a98

Browse files
committed
remove dependency on doitpy.
1 parent 0b0c957 commit 7f54a98

File tree

5 files changed

+79
-35
lines changed

5 files changed

+79
-35
lines changed

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Changes
1010
=======
1111

1212

13-
0.37.0 (2026-02-09)
13+
0.37.0 (*2026-02-09*)
1414
======================
1515

1616
- Ref #409: make cloudpickle optional, and not installed by default on PyPy.

dev_requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
# $ pip install --requirement dev_requirements.txt
33

44
setuptools>=68.0 # for plugins
5+
build
6+
twine
57
pyflakes>=3.0
68
pycodestyle>=2.10
79
pytest>=8.0
810
coverage>=7.0
9-
doit-py>=0.5.0
11+
1012
tomli; python_version<"3.11"

doc/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ <h5>lelele</h5>
364364
<h2>Status</h2>
365365
</div>
366366
<p class="lead"><code>doit</code> is a mature project actively maintained since <a href="http://schettino72.wordpress.com/2008/04/14/doit-a-build-tool-tale">2008</a>. Current version: 0.37.0.</p>
367-
<p><em>doit</em> runs on Python 3.10+. 100% unit-test code coverage.</p>
367+
<p><em>doit</em> runs on Python 3.10+. 99% unit-test code coverage.</p>
368368
<p>Contributions are welcome. Development is driven by real-world use cases.</p>
369369
</div>
370370
</section>

doc/task-creation.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ modules just by importing them into your *dodo* file.
3434
your task definitions in different modules.
3535

3636
The best way to create re-usable tasks that can be used in several projects
37-
is to call functions that return task dict's.
38-
For example take a look at a reusable *pyflakes*
39-
`task generator <https://github.com/pydoit/doit-py/blob/master/doitpy/pyflakes.py>`_.
40-
Check the project `doit-py <https://github.com/pydoit/doit-py>`_
41-
for more examples.
37+
is to write functions that return task dict's or generators that yield them.
4238

4339

4440
.. _delayed-task-creation:

dodo.py

Lines changed: 73 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
import glob
44
import os
5+
import subprocess
56

67
import pytest
7-
from doitpy.pyflakes import Pyflakes
8-
from doitpy.coverage import Config, Coverage, PythonPackage
9-
from doitpy import docs
10-
from doitpy.package import Package
8+
from pyflakes.api import checkPath
119

1210

1311
DOIT_CONFIG = {
@@ -23,15 +21,20 @@
2321
PY_FILES = CODE_FILES + TESTING_FILES
2422

2523

24+
def _check_pyflakes(py_file):
25+
return not bool(checkPath(py_file))
26+
2627
def task_pyflakes():
27-
flaker = Pyflakes()
28-
yield flaker('dodo.py')
29-
yield flaker.tasks('doit/*.py')
30-
yield flaker.tasks('tests/*.py')
28+
for pattern in ['dodo.py', 'doit/*.py', 'tests/*.py']:
29+
for py_file in sorted(glob.glob(pattern)):
30+
yield {
31+
'name': py_file,
32+
'actions': [(_check_pyflakes, [py_file])],
33+
'file_dep': [py_file],
34+
}
3135

3236
def run_test(test):
3337
return not bool(pytest.main([test]))
34-
#return not bool(pytest.main("-v " + test))
3538
def task_ut():
3639
"""run unit-tests"""
3740
for test in TEST_FILES:
@@ -41,14 +44,42 @@ def task_ut():
4144
'verbosity': 0}
4245

4346

47+
def _coverage_actions(modules, test=None):
48+
"""build coverage run/combine/report commands"""
49+
omit = ['tests/myecho.py', 'tests/sample_process.py']
50+
actions = [
51+
'coverage run --parallel-mode --concurrency multiprocessing'
52+
' `which py.test`' + (' ' + test if test else ''),
53+
'coverage combine',
54+
'coverage report --show-missing --omit {} {}'.format(
55+
','.join(omit), ' '.join(modules)),
56+
]
57+
return actions
58+
4459
def task_coverage():
4560
"""show coverage for all modules including tests"""
46-
config = Config(branch=False, parallel=True, concurrency='multiprocessing',
47-
omit=['tests/myecho.py', 'tests/sample_process.py'])
48-
cov = Coverage([PythonPackage('doit', 'tests')], config=config)
49-
yield cov.all()
50-
yield cov.src()
51-
yield cov.by_module()
61+
src = glob.glob('doit/*.py')
62+
tests = glob.glob('tests/*.py')
63+
all_modules = src + tests
64+
65+
yield {
66+
'basename': 'coverage',
67+
'actions': _coverage_actions(all_modules),
68+
'verbosity': 2,
69+
}
70+
yield {
71+
'basename': 'coverage_src',
72+
'actions': _coverage_actions(src),
73+
'verbosity': 2,
74+
}
75+
for test in glob.glob('tests/test_*.py'):
76+
source = 'doit/' + test[len('tests/test_'):]
77+
yield {
78+
'basename': 'coverage_module',
79+
'name': test,
80+
'actions': _coverage_actions([source, test], test),
81+
'verbosity': 2,
82+
}
5283

5384

5485

@@ -66,14 +97,38 @@ def task_rm_index():
6697
'file_dep': ['doc/index.html'],
6798
}
6899

100+
def _check_spelling(doc_file, dictionary):
101+
"""run spell checker, return False if misspelled words found"""
102+
cmd = 'hunspell -l -d en_US -p {} {}'.format(dictionary, doc_file)
103+
output = subprocess.check_output(cmd, shell=True,
104+
universal_newlines=True)
105+
if output:
106+
print(output)
107+
return False
108+
69109
def task_docs():
70110
doc_files = glob.glob('doc/*.rst')
71111
doc_files += ['README.rst', 'CONTRIBUTING.md',
72112
'doc/open_collective.md']
73-
yield docs.spell(doc_files, 'doc/dictionary.txt')
113+
dictionary = 'doc/dictionary.txt'
114+
for doc_file in doc_files:
115+
yield {
116+
'basename': 'spell',
117+
'name': doc_file,
118+
'actions': [(_check_spelling, (doc_file, dictionary))],
119+
'file_dep': [dictionary, doc_file],
120+
'verbosity': 2,
121+
}
74122
sphinx_opts = "-A include_analytics=1 -A include_donate=1"
75-
yield docs.sphinx(DOC_ROOT, DOC_BUILD_PATH, sphinx_opts=sphinx_opts,
76-
task_dep=['spell', 'rm_index'])
123+
yield {
124+
'basename': 'sphinx',
125+
'actions': [
126+
'sphinx-build -b html {} -d {}doctrees {} {}'.format(
127+
sphinx_opts, DOC_ROOT + '_build/', DOC_ROOT, DOC_BUILD_PATH),
128+
],
129+
'task_dep': ['spell', 'rm_index'],
130+
'verbosity': 2,
131+
}
77132

78133
def task_samples_check():
79134
"""check samples are at least runnuable without error"""
@@ -125,15 +180,6 @@ def task_website_update():
125180

126181

127182

128-
def task_package():
129-
"""create/upload package to pypi"""
130-
pkg = Package()
131-
yield pkg.revision_git()
132-
yield pkg.manifest_git()
133-
yield pkg.sdist()
134-
# yield pkg.sdist_upload()
135-
136-
137183
def task_codestyle():
138184
return {
139185
'actions': ['pycodestyle doit'],

0 commit comments

Comments
 (0)