Skip to content
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
20 changes: 0 additions & 20 deletions .github/workflows/build.yml

This file was deleted.

26 changes: 11 additions & 15 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches:
- main
push:
branches:
- main
schedule:
- cron: '21 1 * * 2'

Expand All @@ -17,24 +18,19 @@ jobs:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]

language:
- 'python'
steps:
- name: Checkout repository
uses: actions/checkout@v5

# Initializes the CodeQL tools for scanning.
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@16df4fbc19aea13d921737861d6c622bf3cefe23
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v3

uses: github/codeql-action/autobuild@192325c86100d080feab897ff886c34abd4c83a3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@192325c86100d080feab897ff886c34abd4c83a3
19 changes: 0 additions & 19 deletions .github/workflows/pre-commit.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish to PyPI

on:
push:
branches:
- main

jobs:
pypi-publish:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10"
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41
with:
python-version: ${{ matrix.python-version }}
- name: UV Build
run: uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
23 changes: 0 additions & 23 deletions .github/workflows/pypi.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/pytest.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/uv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: UV

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
uv:
name: python
runs-on: ubuntu-latest
permissions: read-all
strategy:
matrix:
python-version:
- "3.11"
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python
run: uv python install
- name: pyTest
run: uv run pytest tests
- name: Ruff (check)
run: uv run ruff check
- name: Ruff (format)
run: uv run ruff format --diff --check
- name: Ty
run: uv run ty check
#- name: Troml
# run: uv run troml check
- name: Run SonarQube
uses: sonarsource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
34 changes: 0 additions & 34 deletions .pre-commit-config.yaml

This file was deleted.

24 changes: 12 additions & 12 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@

# -- Path setup --------------------------------------------------------------

sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath("../"))
config = ConfigParser()
config.read('../../setup.cfg')
config.read("../../setup.cfg")

# -- Project information -----------------------------------------------------

copyright_year = datetime.datetime.now().year
author = config['metadata']['author']
project = config['metadata']['name']
copyright = f'{copyright_year}, {author}'
author = config["metadata"]["author"]
project = config["metadata"]["name"]
copyright = f"{copyright_year}, {author}"

# The full version, including alpha/beta/rc tags

release = config['metadata']['version']
release = config["metadata"]["version"]


# -- General configuration ---------------------------------------------------
Expand All @@ -36,13 +36,13 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions: List[str] = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
]

# Add any paths that contain templates here, relative to this directory.
templates_path: List[str] = ['_templates']
templates_path: List[str] = ["_templates"]

# List of patterns, relative to the source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -55,9 +55,9 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
7 changes: 4 additions & 3 deletions examples/auth_step_01.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Example code to authenticate against the Monzo API."""

from monzo.authentication import Authentication

client_id = '' # Client ID obtained when creating a Monzo client
client_secret = '' # Client secret obtained when creating a Monzo client
redirect_uri = 'http://127.0.0.1/monzo' # URL requests via Monzo will be redirected in a browser
client_id = "" # Client ID obtained when creating a Monzo client
client_secret = "" # Client secret obtained when creating a Monzo client
redirect_uri = "http://127.0.0.1/monzo" # URL requests via Monzo will be redirected in a browser

monzo = Authentication(client_id=client_id, client_secret=client_secret, redirect_url=redirect_uri)

Expand Down
17 changes: 9 additions & 8 deletions examples/auth_step_02.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
"""Code to handle the second stage of authentication."""

import sys

from monzo.authentication import Authentication
from monzo.exceptions import MonzoAuthenticationError, MonzoServerError

client_id = '' # Client ID obtained when creating a Monzo client
client_secret = '' # Client secret obtained when creating a Monzo client
redirect_uri = 'http://127.0.0.1/monzo' # URL requests via Monzo will be redirected in a browser
state = '' # State random string created when creating the Monzo URL (generated in step 1 and appended to the URL)
code = '' # Authorization code from Monzo (this will be in the redirected URL after clicking the link from step 1)
client_id = "" # Client ID obtained when creating a Monzo client
client_secret = "" # Client secret obtained when creating a Monzo client
redirect_uri = "http://127.0.0.1/monzo" # URL requests via Monzo will be redirected in a browser
state = "" # State random string created when creating the Monzo URL (generated in step 1 and appended to the URL)
code = "" # Authorization code from Monzo (this will be in the redirected URL after clicking the link from step 1)

monzo = Authentication(client_id=client_id, client_secret=client_secret, redirect_url=redirect_uri)
try:
monzo.authenticate(authorization_token=code, state_token=state)
except MonzoAuthenticationError:
print('State code does not match')
print("State code does not match")
sys.exit(1)
except MonzoServerError:
print('Monzo Server Error')
print("Monzo Server Error")
sys.exit(1)

# The following 3 items should be stored for future requests
print(f"access_token = '{monzo.access_token}'")
print(f'expiry = {monzo.access_token_expiry}')
print(f"expiry = {monzo.access_token_expiry}")
print(f"refresh_token = '{monzo.refresh_token}'")

# Now authorize access from the alert in the Monzo app
Loading