-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1da841e
Showing
61 changed files
with
15,382 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# EditorConfig: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{js,json,ts,css,html,svelte}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*cache | ||
/.coverage | ||
/.eggs | ||
/.tox | ||
/build/ | ||
/pip-wheel-metadata/ | ||
/dist/ | ||
/docs/api/ | ||
/frontend/coverage/ | ||
/src/fava/static/* | ||
!/src/fava/static/favicon.ico | ||
/src/fava/translations/messages.pot | ||
/src/fava.egg-info | ||
/htmlcov | ||
/venv | ||
|
||
/.idea/ | ||
/.vscode/ | ||
|
||
node_modules | ||
*.pyc | ||
*.so | ||
*.mo | ||
.DS_Store | ||
.env | ||
TODO | ||
npm-debug.log |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
ci: | ||
skip: ["eslint"] | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 23.12.1 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.9 | ||
hooks: | ||
- id: ruff | ||
- repo: local | ||
hooks: | ||
- id: prettier | ||
name: prettier | ||
language: node | ||
entry: prettier --write --list-different --ignore-unknown | ||
require_serial: true | ||
additional_dependencies: | ||
- "[email protected]" | ||
- "[email protected]" | ||
- "[email protected]" | ||
- id: stylelint | ||
name: stylelint | ||
language: node | ||
entry: stylelint --fix | ||
files: \.(css|svelte)$ | ||
require_serial: true | ||
additional_dependencies: | ||
- "[email protected]" | ||
- "[email protected]" | ||
- "[email protected]" | ||
- "[email protected]" | ||
- id: eslint | ||
name: eslint | ||
language: node | ||
entry: ./frontend/node_modules/eslint/bin/eslint.js --max-warnings 0 | ||
require_serial: true | ||
files: frontend/.*\.(js|ts|svelte)$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src/fava/**/*.html | ||
tests/__snapshots__/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"proseWrap": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
"""Build backend that also compiles translations and frontend.""" | ||
|
||
# pylint: disable=wildcard-import,function-redefined,unused-wildcard-import | ||
|
||
from __future__ import annotations | ||
|
||
import shutil | ||
import subprocess | ||
from itertools import chain | ||
from os import walk | ||
from pathlib import Path | ||
from typing import Iterable | ||
|
||
from babel.messages.mofile import write_mo | ||
from babel.messages.pofile import read_po | ||
from setuptools import build_meta as _build_meta_orig | ||
from setuptools.build_meta import * # noqa: F403 | ||
|
||
|
||
def _frontend_sources() -> Iterable[Path]: | ||
"""List all frontend sources that should trigger a rebuild if changed.""" | ||
yield Path("frontend/package-lock.json") | ||
yield Path("frontend/build.ts") | ||
for directory, _dirnames, files in chain( | ||
walk(Path("frontend/css")), | ||
walk(Path("frontend/src")), | ||
): | ||
dirpath = Path(directory) | ||
for file in files: | ||
yield dirpath / file | ||
|
||
|
||
def _compile_frontend() -> None: | ||
"""Compile the frontend (if changed or missing).""" | ||
source_mtime = max(p.stat().st_mtime_ns for p in _frontend_sources()) | ||
app_js = Path("src/fava/static/app.js") | ||
if app_js.exists() and source_mtime < app_js.stat().st_mtime_ns: | ||
return | ||
|
||
npm = shutil.which("npm") | ||
if npm is None: | ||
raise RuntimeError("npm is missing") | ||
|
||
# Clean outpute directory before building | ||
for p in Path("src/fava/static").iterdir(): | ||
if p.name != "favicon.ico": | ||
p.unlink() | ||
|
||
subprocess.run((npm, "install"), cwd="frontend", check=True) | ||
Path("frontend/node_modules").touch() | ||
subprocess.run((npm, "run", "build"), cwd="frontend", check=True) | ||
|
||
|
||
def _compile_translations() -> None: | ||
"""Compile the translations from .po to .mo (if changed or missing).""" | ||
for source in Path().glob("src/fava/translations/**/messages.po"): | ||
target = source.parent / "messages.mo" | ||
if ( | ||
not target.exists() | ||
or target.stat().st_mtime_ns < source.stat().st_mtime_ns | ||
): | ||
locale = source.parts[-3] | ||
catalog = read_po(source.open("rb"), locale) | ||
write_mo(target.open("wb"), catalog) | ||
|
||
|
||
def build_sdist( # type: ignore[no-redef] | ||
sdist_directory: str, | ||
config_settings: dict[str, str] | None = None, | ||
) -> str: | ||
_compile_frontend() | ||
_compile_translations() | ||
return _build_meta_orig.build_sdist( | ||
sdist_directory, | ||
config_settings=config_settings, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
API Documentation | ||
================= | ||
|
||
.. note:: There's no stability guarantee as this is just for internal purposes currently. | ||
|
||
.. toctree:: | ||
:glob: | ||
|
||
api/fava* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
fava.beans | ||
========== | ||
|
||
.. automodule:: fava.beans | ||
|
||
fava.beans.abc | ||
-------------- | ||
|
||
.. automodule:: fava.beans.abc | ||
|
||
fava.beans.account | ||
------------------ | ||
|
||
.. automodule:: fava.beans.account | ||
|
||
fava.beans.create | ||
----------------- | ||
|
||
.. automodule:: fava.beans.create | ||
|
||
fava.beans.flags | ||
---------------- | ||
|
||
.. automodule:: fava.beans.flags | ||
|
||
fava.beans.funcs | ||
---------------- | ||
|
||
.. automodule:: fava.beans.funcs | ||
|
||
fava.beans.helpers | ||
------------------ | ||
|
||
.. automodule:: fava.beans.helpers | ||
|
||
fava.beans.load | ||
--------------- | ||
|
||
.. automodule:: fava.beans.load | ||
|
||
fava.beans.prices | ||
----------------- | ||
|
||
.. automodule:: fava.beans.prices | ||
|
||
fava.beans.protocols | ||
-------------------- | ||
|
||
.. automodule:: fava.beans.protocols | ||
|
||
fava.beans.str | ||
-------------- | ||
|
||
.. automodule:: fava.beans.str | ||
|
||
fava.beans.types | ||
---------------- | ||
|
||
.. automodule:: fava.beans.types | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
fava.core | ||
========= | ||
|
||
.. automodule:: fava.core | ||
|
||
fava.core.accounts | ||
------------------ | ||
|
||
.. automodule:: fava.core.accounts | ||
|
||
fava.core.attributes | ||
-------------------- | ||
|
||
.. automodule:: fava.core.attributes | ||
|
||
fava.core.budgets | ||
----------------- | ||
|
||
.. automodule:: fava.core.budgets | ||
|
||
fava.core.charts | ||
---------------- | ||
|
||
.. automodule:: fava.core.charts | ||
|
||
fava.core.commodities | ||
--------------------- | ||
|
||
.. automodule:: fava.core.commodities | ||
|
||
fava.core.conversion | ||
-------------------- | ||
|
||
.. automodule:: fava.core.conversion | ||
|
||
fava.core.documents | ||
------------------- | ||
|
||
.. automodule:: fava.core.documents | ||
|
||
fava.core.extensions | ||
-------------------- | ||
|
||
.. automodule:: fava.core.extensions | ||
|
||
fava.core.fava_options | ||
---------------------- | ||
|
||
.. automodule:: fava.core.fava_options | ||
|
||
fava.core.file | ||
-------------- | ||
|
||
.. automodule:: fava.core.file | ||
|
||
fava.core.filters | ||
----------------- | ||
|
||
.. automodule:: fava.core.filters | ||
|
||
fava.core.group_entries | ||
----------------------- | ||
|
||
.. automodule:: fava.core.group_entries | ||
|
||
fava.core.ingest | ||
---------------- | ||
|
||
.. automodule:: fava.core.ingest | ||
|
||
fava.core.inventory | ||
------------------- | ||
|
||
.. automodule:: fava.core.inventory | ||
|
||
fava.core.misc | ||
-------------- | ||
|
||
.. automodule:: fava.core.misc | ||
|
||
fava.core.module_base | ||
--------------------- | ||
|
||
.. automodule:: fava.core.module_base | ||
|
||
fava.core.number | ||
---------------- | ||
|
||
.. automodule:: fava.core.number | ||
|
||
fava.core.query_shell | ||
--------------------- | ||
|
||
.. automodule:: fava.core.query_shell | ||
|
||
fava.core.tree | ||
-------------- | ||
|
||
.. automodule:: fava.core.tree | ||
|
||
fava.core.watcher | ||
----------------- | ||
|
||
.. automodule:: fava.core.watcher | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fava.ext.portfolio_list | ||
======================= | ||
|
||
.. automodule:: fava.ext.portfolio_list | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
fava.ext | ||
======== | ||
|
||
.. automodule:: fava.ext | ||
|
||
fava.ext.auto_commit | ||
-------------------- | ||
|
||
.. automodule:: fava.ext.auto_commit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fava.help | ||
========= | ||
|
||
.. automodule:: fava.help | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
fava.plugins | ||
============ | ||
|
||
.. automodule:: fava.plugins | ||
|
||
fava.plugins.link_documents | ||
--------------------------- | ||
|
||
.. automodule:: fava.plugins.link_documents | ||
|
||
fava.plugins.tag_discovered_documents | ||
------------------------------------- | ||
|
||
.. automodule:: fava.plugins.tag_discovered_documents | ||
|
Oops, something went wrong.