adding latest

This commit is contained in:
2021-11-09 23:16:10 +00:00
parent c62d395df2
commit 6efec7fbc4
3 changed files with 81 additions and 90 deletions

116
TODO.todo
View File

@@ -1,76 +1,24 @@
Priority:
✔ Write the tests @done(21-11-07 15:36)
☐ test logs: <https://stackoverflow.com/questions/53125305/testing-logging-output-with-pytest>
document this
☐ Version duty
☐ Docstrings
☐ Update trilium with latest docstrings (documenting __init__ at class level etc)
Make sure the gist is updated for prospector with the right ignores
☐ Document duties in Trilium and create a gist for common duties
Documentation:
☐ documented poetry with extras (panaetius `pyproject.toml`)
Docstrings:
☐ Use Duty to write module docstrings
☐ Use Duty to add Class docstrings
☐ Document these in Trilium and rewrite the docstrings notes
☐ Add the comment on Reddit (artie buco?) about imports in a module
✔ Document using `__main__.py` and `cli.py` @done(21-11-07 15:21)
Use Duty as an example
☐ Document regex usage
☐ Write documentation using `mkdocs`
☐ Create a boilerplate `duties.py` for common tasks for future projects. Put in a gist.
☐ Look at how to use github actions
Use <https://github.com/pdm-project/pdm/tree/main/.github/workflows> for an example
☐ Build the docs using a github action.
☐ Document how to use pytest to read a logging message
<https://stackoverflow.com/questions/53125305/testing-logging-output-with-pytest>
- caplog as fixture
- reading `caplog.records[0].message`
see `_old_test_pages.py`
☐ Document testing value of an exception raised
When you use `with pytest.raises` you can use `.value` to access the attributes
reading `.value.code`
reading `str(.value)`
✔ Document working with exceptions @done(21-11-09 22:17)
✔ General pattern - raise exceptions in codebase, catch them in the CLI. @done(21-11-09 22:16)
Allows people to use via an API and handle the exceptions themselves.
You can use python builtins but custom exceptions are better for internal control
✔ Capturing exceptions in the CLI. @done(21-11-09 22:16)
Access the message of the exception with `.args[0]`.
use `raise SystemExit(1) from exception` in order to gracefully exit
✔ Adding custom args to an exception @done(21-11-09 22:17)
Overwrite `__init__`, access them in pytest with `.value.$args`
Access them in a try,except with `raise $excpetion as $name; $name.$arg`
☐ Document capturing stdout
Use `capsys`
`assert capsys.readouterr().out`
A new line may be inserted if using `click.echo()`
<https://docs.pytest.org/en/6.2.x/capture.html>
☐ Document using datadir with a module rather than a shared one. Link to tembo as an example.
☐ Can prospector ignore tests dir? document this in the gist if so
☐ Redo the documentation on a CLI, reorganise and inocropoate all the new tembo layouts
Testing:
☐ Document importing in inidivudal tests using `importlib.reload`
Globally import the module
Use `importlib.reload(module)` in each test instead of explicitly importing the module.
This is because the import is cached.
<https://stackoverflow.com/questions/32234156/how-to-unimport-a-python-module-which-is-already-imported>
Functionality:
✔ Replace loggers with `click.echo` for command outputs. Keep logging messages for actual logging messages? @done(21-11-09 22:17)
Define a format: [TEMBO:$datetime] $message 🐘 - document this in general python for CLI
✔ Refactor the tembo new command so the cli is split out into manageable methods @done(21-11-07 15:35)
✘ Use the complicated CLI example so the tembo new has its own module to define functions in @cancelled(21-11-07 15:35)
✔ Replace all logger errors with exceptions, move logger messages to the cli. @done(21-11-07 15:35)
✔ How to pass a successful save notification back to the CLI? Return a bool? Or is there some other way? @done(21-11-07 15:35)
✘ Replace pendulum with datetime @cancelled(21-11-07 15:35)
✔ Make options a property on the class, add to abstract @done(21-10-30 19:31)
☐ Use the python runner Duty
<https://github.com/pawamoy/duty>
☐ Run tests
@@ -80,10 +28,6 @@ Functionality:
☐ Duty for auto insert version from `poetry version`.
Need to decide what file to place `__version__` in.
Logging:
✘ Make all internal tembo logs be debug @cancelled(21-11-09 22:20)
✘ User can enable them with the config @cancelled(21-11-09 22:20)
VSCode:
PyInstaller:
☐ Document build error: <https://github.com/pyenv/pyenv/issues/1095>
@@ -94,15 +38,10 @@ VSCode:
dict.update -> |=
walrus :=
Tests:
✔ Write tests! @2d @done(21-11-07 15:36)
Use coverage as going along to make sure all bases are covered in the testing
VSCode:
☐ Look at <https://github.com/CodeWithSwastik/vscode-ext>
Logging:
Documentation:
Tembo:
☐ Document creating new Tembo config
@@ -115,6 +54,57 @@ Logging:
clone the repo, delete .git, git init, configure and add git origin
Archive:
✘ test logs: <https://stackoverflow.com/questions/53125305/testing-logging-output-with-pytest> @cancelled(21-11-09 23:15) @project(Priority)
document this
✔ Write the tests @done(21-11-07 15:36) @project(Priority)
✔ documented poetry with extras (panaetius `pyproject.toml`) @done(21-11-09 22:29) @project(Documentation)
✔ Document using `__main__.py` and `cli.py` @done(21-11-07 15:21) @project(Documentation.Docstrings)
Use Duty as an example
✔ Document regex usage @done(21-11-09 22:39) @project(Documentation)
✔ Document how to use pytest to read a logging message @done(21-11-09 22:57) @project(Documentation)
<https://stackoverflow.com/questions/53125305/testing-logging-output-with-pytest>
caplog as fixture
reading `caplog.records[0].message`
see `_old_test_pages.py`
✔ Document testing value of an exception raised @done(21-11-09 22:50) @project(Documentation)
When you use `with pytest.raises` you can use `.value` to access the attributes
reading `.value.code`
reading `str(.value)`
✔ Document working with exceptions @done(21-11-09 22:17) @project(Documentation)
✔ General pattern - raise exceptions in codebase, catch them in the CLI. @done(21-11-09 22:16) @project(Documentation)
Allows people to use via an API and handle the exceptions themselves.
You can use python builtins but custom exceptions are better for internal control
✔ Capturing exceptions in the CLI. @done(21-11-09 22:16) @project(Documentation)
Access the message of the exception with `.args[0]`.
use `raise SystemExit(1) from exception` in order to gracefully exit
✔ Adding custom args to an exception @done(21-11-09 22:17) @project(Documentation)
Overwrite `__init__`, access them in pytest with `.value.$args`
Access them in a try,except with `raise $excpetion as $name; $name.$arg`
✔ Document capturing stdout @done(21-11-09 22:59) @project(Documentation)
Use `capsys`
`assert capsys.readouterr().out`
A new line may be inserted if using `click.echo()`
<https://docs.pytest.org/en/6.2.x/capture.html>
✔ Document using datadir with a module rather than a shared one. Link to tembo as an example. @done(21-11-09 22:59) @project(Documentation)
✘ Can prospector ignore tests dir? document this in the gist if so @cancelled(21-11-09 23:08) @project(Documentation)
✔ Redo the documentation on a CLI, reorganise and inocropoate all the new tembo layouts @done(21-11-09 23:08) @project(Documentation)
✔ Document importing in inidivudal tests using `importlib.reload` @done(21-11-09 23:13) @project(Documentation.Testing)
Globally import the module
Use `importlib.reload(module)` in each test instead of explicitly importing the module.
This is because the import is cached.
<https://stackoverflow.com/questions/32234156/how-to-unimport-a-python-module-which-is-already-imported>
✔ Replace loggers with `click.echo` for command outputs. Keep logging messages for actual logging messages? @done(21-11-09 22:17) @project(Functionality)
Define a format: [TEMBO:$datetime] $message 🐘 - document this in general python for CLI
✔ Refactor the tembo new command so the cli is split out into manageable methods @done(21-11-07 15:35) @project(Functionality)
✘ Use the complicated CLI example so the tembo new has its own module to define functions in @cancelled(21-11-07 15:35) @project(Functionality)
✔ Replace all logger errors with exceptions, move logger messages to the cli. @done(21-11-07 15:35) @project(Functionality)
✔ How to pass a successful save notification back to the CLI? Return a bool? Or is there some other way? @done(21-11-07 15:35) @project(Functionality)
✘ Replace pendulum with datetime @cancelled(21-11-07 15:35) @project(Functionality)
✔ Make options a property on the class, add to abstract @done(21-10-30 19:31) @project(Functionality)
✘ Make all internal tembo logs be debug @cancelled(21-11-09 22:20) @project(Logging)
✘ User can enable them with the config @cancelled(21-11-09 22:20) @project(Logging)
✔ Write tests! @2d @done(21-11-07 15:36) @project(Tests)
Use coverage as going along to make sure all bases are covered in the testing
✔ Document the python/logging/typing in Trilium @done(21-10-25 14:33) @project(Priority)
✔ Update typing annotations to include generics instead @done(21-10-25 22:38) @project(Priority)
https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes

View File

@@ -25,7 +25,7 @@ pylint:
# Used when an expression that is not a function call is assigned to nothing. Probably something else was intended.
# - expression-not-assigned
# Used when a line is longer than a given number of characters.
- line-too-long
# - line-too-long
enable:
options:
max-locals: 15
@@ -37,7 +37,7 @@ pylint:
min-public-methods: 0
max-public-methods: 25
max-module-lines: 1000
max-line-length: 88
max-line-length: 99
max-args: 8
mccabe:
@@ -49,7 +49,7 @@ mccabe:
pep8:
run: true
options:
max-line-length: 88
max-line-length: 99
single-line-if-stmt: n
disable:
# line too long
@@ -66,28 +66,28 @@ pyroma:
pep257:
disable:
# !doc docstrings
# Missing docstring in public package
- D104
# Missing docstring in __init__
- D107
# Missing docstring in public module
- D100
# Missing docstring in public class
- D101
# Missing docstring in public method
- D102
# Missing docstring in public function
- D103
# Missing docstring in magic method
- D105
# One-line docstring should fit on one line with quotes
- D200
# No blank lines allowed after function docstring
- D202
# Multi-line docstring summary should start at the second line
- D213
# First word of the docstring should not be This
- D404
# # Missing docstring in public package
# - D104
# # Missing docstring in __init__
# - D107
# # Missing docstring in public module
# - D100
# # Missing docstring in public class
# - D101
# # Missing docstring in public method
# - D102
# # Missing docstring in public function
# - D103
# # Missing docstring in magic method
# - D105
# # One-line docstring should fit on one line with quotes
# - D200
# # No blank lines allowed after function docstring
# - D202
# # Multi-line docstring summary should start at the second line
# - D213
# # First word of the docstring should not be This
# - D404
# DEFAULT IGNORES
# 1 blank line required before class docstring
- D203
@@ -105,7 +105,7 @@ pep257:
pyflakes:
disable:
# module imported but unused
- F401
# - F401
dodgy:
run: true

View File

@@ -106,7 +106,8 @@ class PageCreator:
class ScopedPageCreator(PageCreator):
"""Factory to create a scoped page.
"""
Factory to create a scoped page.
Attributes:
base_path (str): base path of tembo.