Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use typed-settings to parse configuration files and build the CLI. #582

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ repos:
rev: v2.0.0
hooks:
- id: refurb
additional_dependencies: [typed-settings]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
Expand Down
1 change: 1 addition & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
- {pull}`579` fixes an interaction with `--pdb` and `--trace` and task that return. The
debugging modes swallowed the return and `None` was returned. Closes {issue}`574`.
- {pull}`581` simplifies the code for tracebacks and unpublishes some utility functions.
- {pull}`582` use typed-settings to parse configuration files and create the CLI.
- {pull}`586` improves linting.
- {pull}`587` improves typing of `capture.py`.
- {pull}`588` resets class variables of `ExecutionReport` and `Traceback`.
Expand Down
1 change: 0 additions & 1 deletion docs/source/reference_guides/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pytask offers the following functionalities.
```{eval-rst}
.. autoclass:: pytask.ColoredCommand
.. autoclass:: pytask.ColoredGroup
.. autoclass:: pytask.EnumChoice
```

## Compatibility
Expand Down
17 changes: 0 additions & 17 deletions docs/source/reference_guides/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ are welcome to also support macOS.

````

````{confval} database_url

pytask uses a database to keep track of tasks, products, and dependencies over runs. By
default, it will create an SQLite database in the project's root directory called
`.pytask/pytask.sqlite3`. If you want to use a different name or a different dialect
[supported by sqlalchemy](https://docs.sqlalchemy.org/en/latest/core/engines.html#backend-specific-urls),
use either {option}`pytask build --database-url` or `database_url` in the config.

```toml
database_url = "sqlite:///.pytask/pytask.sqlite3"
```

Relative paths for SQLite databases are interpreted as either relative to the
configuration file or the root directory.

````

````{confval} editor_url_scheme

Depending on your terminal, pytask is able to turn task ids into clickable links to the
Expand Down
6 changes: 3 additions & 3 deletions docs/source/tutorials/visualizing_the_dag.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To visualize the {term}`DAG` of the project, first, install
[graphviz](https://graphviz.org/). For example, you can both install with conda

```console
$ conda install -c conda-forge pygraphviz
conda install -c conda-forge pygraphviz
```

After that, pytask offers two interfaces to visualize your project's {term}`DAG`.
Expand All @@ -15,7 +15,7 @@ After that, pytask offers two interfaces to visualize your project's {term}`DAG`
You can quickly create a visualization with this command.

```console
$ pytask dag
pytask dag
```

It generates a `dag.pdf` in the current working directory.
Expand All @@ -26,7 +26,7 @@ file-ending. Select any format supported by
[graphviz](https://graphviz.org/docs/outputs/).

```console
$ pytask dag -o dag.png
pytask dag -o dag.png
```

You can change the graph's layout by using the {option}`pytask dag --layout` option. Its
Expand Down
20 changes: 16 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies = [
"sqlalchemy>=2",
'tomli>=1; python_version < "3.11"',
'typing-extensions; python_version < "3.9"',
"typed-settings[option-groups]",
"universal-pathlib>=0.2.2",
]

Expand Down Expand Up @@ -113,6 +114,9 @@ source = "vcs"
[tool.hatch.metadata]
allow-direct-references = true

[tool.setuptools_scm]
version_file = "src/_pytask/_version.py"

[tool.ruff]
target-version = "py38"
fix = true
Expand Down Expand Up @@ -184,6 +188,7 @@ disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
plugins = ["typed_settings.mypy"]

[[tool.mypy.overrides]]
module = "tests.*"
Expand All @@ -194,14 +199,14 @@ ignore_errors = true
module = ["click_default_group", "networkx"]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = ["_pytask.coiled_utils"]
disable_error_code = ["import-not-found"]

[[tool.mypy.overrides]]
module = ["_pytask.hookspecs"]
disable_error_code = ["empty-body"]

[[tool.mypy.overrides]]
module = ["_pytask.coiled_utils"]
disable_error_code = ["import-untyped", "import-not-found"]

[tool.codespell]
skip = "*.js,*/termynal.css"

Expand All @@ -219,3 +224,10 @@ exclude_also = [
[tool.mdformat]
wrap = 88
end_of_line = "keep"


[tool.pytask]
debug_pytask = 1

[tool.pytask.ini_options]
capture = "all"
Loading
Loading