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

Setup oauth auth for bunqtoynab #473

Merged
merged 6 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 3 additions & 6 deletions .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,16 @@
"settings": {
"python.formatting.provider": "black",
"python.formatting.blackPath": "/opt/bin/black",
"terminal.integrated.scrollback": 10000,
"files.associations": {
".bazelrc": "plaintext"
},
"editor.formatOnSave": true
"terminal.integrated.scrollback": 10000
}
}
},
"remoteUser": "devcontainer",
"containerUser": "devcontainer",
"mounts": [
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock",
"source=setup-bazel,target=/home/devcontainer/bazel,type=volume"
"source=setup-bazel,target=/home/devcontainer/bazel,type=volume",
"source=${localWorkspaceFolder}/../bunq2ynab,target=/workspaces/bunq2ynab,type=bind,consistency=cached"
],
"shutdownAction": "stopContainer",
"postAttachCommand": "bin/post-setup",
Expand Down
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"bazel.buildifierExecutable": "/opt/bin/buildifier",
"prettier.resolveGlobalModules": false,
"files.associations": {
"WORKSPACE.bzlmod": "starlark"
}
"WORKSPACE.bzlmod": "starlark",
".bazelrc": "plaintext"
},
"editor.formatOnSave": true
}
2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ compile_pip_requirements(
name = "requirements",
extra_args = [
"--allow-unsafe",
],
hidden_args = [
"--verbose",
],
requirements_in = "requirements.in",
Expand Down
10 changes: 8 additions & 2 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ http_archive(
git_repository(
name = "bunq2ynab",
build_file = "//tools/bunq2ynab:BUILD.repositories.bazel.tpl",
commit = "562d63d7d708f7beb18173d4f5c48050fe207aea",
remote = "https://github.com/wesselt/bunq2ynab.git",
commit = "38e62454e86041b604e21db13eafc1d3376de170",
remote = "https://github.com/mvgijssel/bunq2ynab.git",
)

# new_local_repository(
# name = "bunq2ynab",
# build_file = "//tools/bunq2ynab:BUILD.repositories.bazel.tpl",
# path = "/workspaces/bunq2ynab",
# )
1 change: 0 additions & 1 deletion bin/post-setup
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ sudo chown devcontainer:devcontainer /home/devcontainer/bazel

# Ensure the linters are built for local development
bazel run --script_path=/opt/bin/black //tools/black
bazel run --script_path=/opt/bin/python //tools/python
bazel run --script_path=/opt/bin/lefthook //tools/lefthook
bazel run --script_path=/opt/bin/pnpm @pnpm-setup//:pnpm
bazel run --script_path=/opt/bin/prettier //:prettier
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --verbose --generate-hashes requirements.in
# pip-compile --allow-unsafe --generate-hashes requirements.in
#
aiohttp==3.8.4 \
--hash=sha256:03543dcf98a6619254b409be2d22b51f21ec66272be4ebda7b04e6412e4b2e14 \
Expand Down
5 changes: 3 additions & 2 deletions rules/rules_task/tools/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ load("@rules_task//:defs.bzl", "cmd", "task")
load("@pip//:requirements.bzl", "requirement")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")

def compile_pip_requirements(name, requirements_in, requirements_txt, extra_args = []):
def compile_pip_requirements(name, requirements_in, requirements_txt, extra_args = [], hidden_args = []):
pip_compile_name = name
pip_compile_update_name = "{}.update".format(name)
pip_compile_compare_name = "{}_compare".format(name)
pip_compile_test_name = "{}_test".format(name)
pip_compile_hidden_args = hidden_args

pip_compile_shared_args = extra_args + [
"--generate-hashes",
Expand All @@ -16,7 +17,7 @@ def compile_pip_requirements(name, requirements_in, requirements_txt, extra_args
requirements_in,
]

pip_compile_args = pip_compile_shared_args + [
pip_compile_args = pip_compile_shared_args + pip_compile_hidden_args + [
"--output-file",
"$REQUIREMENTS_TXT",
requirements_in,
Expand Down
19 changes: 19 additions & 0 deletions tools/bunq2ynab/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,22 @@ task(
),
],
)

py_binary(
name = "generate_oauth_token_binary",
srcs = ["@bunq2ynab//:generate_oauth_token.py"],
main = "generate_oauth_token.py",
deps = [
"@bunq2ynab//:lib",
requirement("requests"),
requirement("pyopenssl"),
],
)

task(
name = "generate_oauth_token",
cmds = [
cmd.executable("generate_oauth_token_binary"),
],
cwd = "$BUILD_WORKSPACE_DIRECTORY",
)
1 change: 1 addition & 0 deletions tools/bunq2ynab/BUILD.repositories.bazel.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ exports_files([
"list_user.py",
"list_budget.py",
"bunq2ynab.py",
"generate_oauth_token.py",
])