Skip to content

Commit 5098fbe

Browse files
authored
Refactor command line interface to subcommands, add -c/--config option and clean command. (#17)
1 parent 694777f commit 5098fbe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+999
-282
lines changed

.conda/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ requirements:
2626
- setuptools
2727
- attrs >=17.4.0
2828
- click
29+
- click-default-group
2930
- networkx
3031
- pluggy
3132
- pony >=0.7.13

.pre-commit-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
- id: check-yaml
99
exclude: meta.yaml
1010
- id: debug-statements
11-
exclude: (debugging\.py|main\.py)
11+
exclude: (debugging\.py|build\.py)
1212
- id: end-of-file-fixer
1313
- repo: https://github.com/asottile/pyupgrade
1414
rev: v2.7.2
@@ -51,6 +51,11 @@ repos:
5151
rev: 0.8.1rc3
5252
hooks:
5353
- id: doc8
54+
- repo: https://github.com/econchick/interrogate
55+
rev: 1.2.0
56+
hooks:
57+
- id: interrogate
58+
args: [-v, --fail-under=40, src, tests]
5459
- repo: https://github.com/codespell-project/codespell
5560
rev: v1.17.1
5661
hooks:

README.rst

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.. raw:: html
22

3-
<img src="docs/_static/images/pytask_w_text.png" alt="pytask"
4-
width="50%">
3+
<img src="docs/_static/images/pytask_w_text.png" alt="pytask" width="50%">
54

65
------
76

@@ -30,17 +29,27 @@ Features
3029
In its highest aspirations, pytask tries to be pytest as a build system. Its features
3130
include:
3231

33-
- Automatic discovery of tasks.
32+
- **Automatic discovery of tasks.**
3433

35-
- It tracks dependencies and products as well as the source file of a task to evaluate
36-
whether it needs to be re-executed.
34+
- **Lazy evaluation.** If a task or its dependencies have not changed, do not
35+
execute it.
3736

38-
- pytask does not stop if one task fails, but continues execution for all collected
39-
tasks. Tasks which depend on failed tasks are automatically skipped.
37+
- **Debug mode.** Jump into the debugger if a task fails and get quick feedback.
4038

41-
- Easily extensible since its architecture is based on `pluggy
39+
- **Select tasks via expressions.** Run only a subset of tasks with expressions and
40+
marker expressions known from pytest.
41+
42+
- **Easily extensible with plugins**. pytask's architecture is based on `pluggy
4243
<https://pluggy.readthedocs.io/en/latest/>`_, a plugin management and hook calling
43-
framework.
44+
framework which enables you to adjust pytask to your needs.
45+
46+
47+
Why do I need a build system?
48+
-----------------------------
49+
50+
Read the `section in the documentation <https://pytask-dev.readthedocs.io/en/latest/
51+
explanations/why_do_i_need_a_build_system.html>`_ if you do not know or are not
52+
convinced that you need a build system.
4453

4554

4655
Installation
@@ -87,13 +96,13 @@ To execute the task, type the following command on the command-line
8796
.. code-block::
8897
8998
$ pytask
90-
=============================== Start pytask session ===============================
99+
========================= Start pytask session =========================
91100
Platform: linux -- Python 3.x.y, pytask 0.x.y, pluggy 0.x.y
92101
Root: xxx
93102
Collected 1 task(s).
94103
95104
.
96-
============================ 1 succeeded in 1 second(s) ============================
105+
====================== 1 succeeded in 1 second(s) ======================
97106
98107
99108
Demo

docs/_static/images/pytask_w_text.png

-101 KB
Loading

docs/_static/images/pytask_w_text.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/changes.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ chronological order. Releases follow `semantic versioning <https://semver.org/>`
66
all releases are available on `Anaconda.org <https://anaconda.org/pytask/pytask>`_.
77

88

9-
0.0.6 - 2020-08-22
9+
0.0.6 - 2020-xx-xx
1010
------------------
1111

1212
- :gh:`16` reduces the traceback generated from tasks, failure section in report, fix
1313
error passing a file path to pytask, add demo to README.
14+
- :gh:`17` changes the interface to subcommands, adds ``"-c/--config"`` option to pass a
15+
path to a configuration file and adds ``pytask clean``, a command to clean your
16+
project.
1417

1518

1619
0.0.5 - 2020-08-12

docs/explanations/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ systems in general as well as its design.
77
.. toctree::
88
:maxdepth: 1
99

10+
why_do_i_need_a_build_system
1011
why_another_build_system
1112
design
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Why do I need a build system?
2+
=============================
3+
4+
A common problem people face when analyzing data (or building software, etc.) is that
5+
their workflows involve multiple tasks. The tasks might have a order in which they need
6+
to be executed because they build upon each other.
7+
8+
For example, a workflow of an empirical research project consists of tasks doing the
9+
data preparation, the analysis, reporting results with tables and figures and, finally,
10+
tasks which compile the reports.
11+
12+
Often, people keep all files in the workflow up-to-date by
13+
14+
- executing all tasks by hand.
15+
16+
It is problematic because communicating the build process to collaborators is hard and
17+
the process itself is error-prone since one might messes up the order or forgets to
18+
run a task.
19+
20+
- having a main file which runs all tasks.
21+
22+
The setup usually cannot infer which tasks need to be run. Thus, the build time is
23+
unnecessarily high. Often times, the main file introduces side-effects into the tasks
24+
via global variables or other mechanisms which makes it impossible to run tasks
25+
independent from the main file. This is a nightmare if you need to debug your project.
26+
27+
A build system is a framework to manage tasks and dependencies and, at best, the user
28+
does not even feel the layer between her and the tasks.
29+
30+
From the research perspective, a build system is especially useful because it enables or
31+
facilitates the reproducibility of projects. For users who are not programmers by
32+
nature, it is necessary that the interface of the build system is intuitive and has a
33+
steep learning curve which are both goals pytask tries to accomplish.
34+
35+
From a software engineering perspective, a build system helps to modularize your code.
36+
Modularization means to structure code into logical chunks and to reuse code. It reduces
37+
maintenance costs and facilitates testing. Without a build system, users might opt for
38+
larger chunks because a more granular structure is harder to keep in sync.

docs/index.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,29 @@ This is the documentation of pytask. You can install the package from `Anaconda.
3030
$ conda config --add channels conda-forge --add channels pytask
3131
$ conda install pytask
3232
33-
The documentation has currently one of four planned parts.
33+
The documentation has four parts.
3434

3535
.. raw:: html
3636

3737
<div class="row">
3838
<div class="column">
3939
<a href="tutorials/index.html" id="index-link">
4040
<div class="card">
41-
<img src="_static/images/light-bulb.svg" class="card-img-top"
41+
<img src="_static/images/light-bulb.svg"
4242
alt="tutorials-icon" height="52"
4343
>
4444
<h5>Tutorials</h5>
4545
<p>
46-
Tutorials help you to get started. If you do not know
47-
what a build system or pytask is, start here.
46+
Tutorials help you to get started with pytask, explain the
47+
interface and basic capabilities.
4848
</p>
4949
</div>
5050
</a>
5151
</div>
5252
<div class="column">
5353
<a href="how_to_guides/index.html" id="index-link">
5454
<div class="card">
55-
<img src="_static/images/book.svg" class="card-img-top"
55+
<img src="_static/images/book.svg"
5656
alt="how-to guides icon" height="52"
5757
>
5858
<h5>How-to Guides</h5>
@@ -66,12 +66,12 @@ The documentation has currently one of four planned parts.
6666
<div class="column">
6767
<a href="explanations/index.html" id="index-link">
6868
<div class="card">
69-
<img src="_static/images/books.svg" class="card-img-top"
69+
<img src="_static/images/books.svg"
7070
alt="explanations icon" height="52"
7171
>
7272
<h5>Explanations</h5>
7373
<p>
74-
Explanations give detailed information to key topics and
74+
Explanations give detailed information on key topics and
7575
concepts which underlie the package.
7676
</p>
7777
</div>
@@ -80,12 +80,12 @@ The documentation has currently one of four planned parts.
8080
<div class="column">
8181
<a href="reference_guides/index.html" id="index-link">
8282
<div class="card">
83-
<img src="_static/images/coding.svg" class="card-img-top"
83+
<img src="_static/images/coding.svg"
8484
alt="reference guides icon" height="52"
8585
>
8686
<h5>Reference Guides</h5>
8787
<p>
88-
Reference Guides explain the implementation and provide an
88+
Reference guides explain the implementation and provide an
8989
entry-point for developers.
9090
</p>
9191
</div>

docs/reference_guides/hookspecs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ General
3131
Command Line Interface
3232
----------------------
3333

34-
.. autofunction:: pytask_add_parameters_to_cli
34+
.. autofunction:: pytask_extend_command_line_interface
3535
:noindex:
3636

3737

0 commit comments

Comments
 (0)