diff --git a/.gitignore b/.gitignore index cf1c229..64ee588 100644 --- a/.gitignore +++ b/.gitignore @@ -1,138 +1,5 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# MAc -.DS_Store - -.vscode -*.picklecache - +.pre-commit-config.yaml .direnv -.pdm-python +src/fava_envelope/__pycache__ +src/fava_envelope/cli/__pycache__/__main__.cpython-311.pyc +.venv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 56ec6a4..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,51 +0,0 @@ -ci: - autofix_commit_msg: "ci(pre-commit): autofix" - autoupdate_commit_msg: "ci(pre-commit): autoupdate" - skip: [ - pip-compile - ] - -repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: debug-statements - - id: name-tests-test - -- repo: https://github.com/jazzband/pip-tools - rev: 7.4.1 - hooks: - - id: pip-compile - name: pip-compile pyproject.toml - files: ^(pyproject\.toml|requirements\.txt)$ - args: [pyproject.toml] - - id: pip-compile - name: pip-compile dev - files: ^(pyproject\.toml|requirements\.txt)$ - args: [--extra=dev, --output-file=requirements-dev.txt, pyproject.toml] - -- repo: https://github.com/asottile/reorder-python-imports - rev: v3.14.0 - hooks: - - id: reorder-python-imports - args: [--py37-plus, --add-import, 'from __future__ import annotations'] - -- repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 - hooks: - - id: pyupgrade - args: [--py37-plus] - -- repo: https://github.com/PyCQA/flake8 - rev: 7.1.1 - hooks: - - id: flake8 - -- repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.1 - hooks: - - id: mypy - additional_dependencies: [types-all] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 120000 index 0000000..17f2c99 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1 @@ +/nix/store/c7n1j4a2mz376lvbvr94583vnrcdfphh-pre-commit-config.json \ No newline at end of file diff --git a/flake.lock b/flake.lock index 8d9f27e..ca93d54 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -20,6 +36,49 @@ "type": "github" } }, + "git-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1735882644, + "narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "a5a961387e75ae44cc20f0a57ae463da5e959656", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1736523798, @@ -85,6 +144,7 @@ "root": { "inputs": { "flake-parts": "flake-parts", + "git-hooks-nix": "git-hooks-nix", "nixpkgs": "nixpkgs", "pyproject-build-systems": "pyproject-build-systems", "pyproject-nix": "pyproject-nix", diff --git a/flake.nix b/flake.nix index 530f82b..a6355e3 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,11 @@ inputs.uv2nix.follows = "uv2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + + git-hooks-nix = { + url = "github:cachix/git-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { @@ -33,6 +38,7 @@ uv2nix, pyproject-nix, pyproject-build-systems, + git-hooks-nix, ... } @ inputs: flake-parts.lib.mkFlake @@ -45,7 +51,15 @@ "aarch64-darwin" ]; - perSystem = {system, ...}: let + imports = [ + git-hooks-nix.flakeModule + ]; + + perSystem = { + config, + system, + ... + }: let inherit (nixpkgs) lib; pkgs = import nixpkgs { inherit system; @@ -110,6 +124,14 @@ ] ); in { + pre-commit.settings.hooks = { + # ruff.enable = true; + }; + + # isort.enable = true; + # pyupgrade.enable = true; + # flake8.enable = true; + devShells.default = let pkgs = nixpkgs.legacyPackages.${system}; editablePythonSet = pythonSets.overrideScope editableOverlay; @@ -130,6 +152,7 @@ shellHook = '' unset PYTHONPATH export REPO_ROOT=$(git rev-parse --show-toplevel) + ${config.pre-commit.installationScript} ''; }; packages = {