Skip to content

Commit

Permalink
Merge pull request #4 from Trevypants/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Trevypants authored May 19, 2024
2 parents 73cf3e4 + b53be66 commit 7deaee9
Show file tree
Hide file tree
Showing 90 changed files with 1,989 additions and 834 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Upload Python Package to PyPI

on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
publish:
strategy:
max-parallel: 1
matrix:
python-version: [3.11]
defaults:
run:
shell: bash
environment: ${{ github.base_ref }}
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# ----------- check-out repo ------------
#----------------------------------------------
- uses: actions/checkout@v4

#----------------------------------------------
# ------------ setup python -----------
#----------------------------------------------
- name: 🔧 Setup Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: 📜 Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------
# ----- load cached venv -----
#----------------------------------
- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v3
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# ------------ install deps ------------
#----------------------------------------------
- name: Install dependencies
run: |
poetry install --no-interaction
#------------------------------------------------
# ------------ build and publish ------------
#------------------------------------------------
- name: Build and publish
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: make publish
14 changes: 7 additions & 7 deletions .github/workflows/test_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
strategy:
max-parallel: 1
matrix:
os: [
ubuntu-latest,
# windows-latest,
macos-latest
os: [
ubuntu-latest,
# windows-latest,
macos-latest,
]
python-version: [3.11]
python-version: [3.11]
defaults:
run:
shell: bash
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
installer-parallel: true

#----------------------------------
# ----- load cached venv -----
# ----- load cached venv -----
#----------------------------------
- name: Load cached venv
id: cached-pip-wheels
Expand All @@ -82,4 +82,4 @@ jobs:
run: |
source $VENV
echo $CREDENTIALS_JSON | base64 -d > ./tests/test_creds.json
poetry run pytest
make test
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ test_init.py
.vscode
credentials/**
test_init.py
**.json
**.json
.mypy_cache
.pytest_cache
.ruff_cache
.coverage
coverage.xml
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ If working on MacOs or Linux, make sure to have `curl` capabilities to run the `
When pushing changes to the repository, make sure to follow the steps below:

1. Create a new branch with a descriptive name that reflects the changes you are making. For example, if you are adding a new feature, the branch name could be `feature/new-feature`. If you are fixing a bug, the branch name could be `bugfix/fix-bug`.
2. Make the necessary changes in the codebase.
2. Make the necessary changes in the codebase. Make sure to format the code using

```bash
make format
```

3. Run the tests to ensure that the changes do not break the existing functionality. This can be done by running the following command:

```bash
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Trevor Visser

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 17 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,32 @@ setup:
$(MAKE) setup-deps
$(MAKE) setup-dev

### Commands to format the code ###
format:
@echo "Formatting code..."
@poetry run ruff format pyrevolut tests
@poetry run black pyrevolut tests
@echo "Code formatted!"

### Commands to run the tests ###
# base64 encode the credentials: base64 -i tests/test_creds.json
test-gen-creds:
@poetry run pyrevolut auth-manual --credentials-json tests/test_creds.json

test-lint:
@echo "Running lint tests..."
@poetry run ruff check
@poetry run black pyrevolut tests
@poetry run ruff check pyrevolut/ tests/ --fix
@echo "Lint tests complete!"

test-type:
@echo "Running type tests..."
@poetry run pyright --warnings --stats
@echo "Type tests complete!"

test-integration:
@echo "Running integration tests..."
@poetry run pytest -n 1
@poetry run pytest -n 1 --dist=loadfile --cov-report term-missing --cov-report=xml:coverage.xml --cov=pyrevolut tests
@echo "Integration tests complete!"

test:
@echo "Running tests..."
$(MAKE) test-lint
# $(MAKE) test-type
$(MAKE) test-integration
@echo "Tests complete!"

Expand All @@ -60,4 +62,10 @@ commit:
push:
@echo "Pushing changes..."
@git push
@echo "Changes pushed!"
@echo "Changes pushed!"

### Commands to publish the package ###
publish:
@echo "Publishing package..."
@/bin/bash -c "scripts/publish.sh"
@echo "Package published!"
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Revolut Python SDK
# Pyrevolut: A Revolut Business API Wrapper

This is an un-official Python SDK for the [Revolut Business API](https://developer.revolut.com/docs/business/business-api).
`pyrevolut` is an un-official wrapper around the [Revolut Business API](https://developer.revolut.com/docs/business/business-api).

## Installation

Expand Down Expand Up @@ -130,8 +130,8 @@ The SDK currently supports the following APIs:
- [x] Retrieve a payout link
- [x] Create a payout link
- [x] Cancel a payout link
- [ ] Simulations (Sandbox only)
- [ ] Simulate a transfer state update
- [x] Simulations (Sandbox only)
- [x] Simulate a transfer state update
- [x] Simulate an account top-up
- [ ] Team members (Live only)
- [ ] Retrieve a list of team members
Expand All @@ -156,3 +156,9 @@ The SDK currently supports the following APIs:
## **Contributing**

In order to facilitate a streamlined development process, we have a few guidelines that we would like to follow. Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.

## **License**

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

**Disclaimer:** `pyrevolut` is an un-official API wrapper. It is in no way endorsed by or affiliated with Revolut or any associated organization. Make sure to read and understand the terms of service of the underlying API before using this package. The authors accept no responsiblity for any damage that might stem from use of this package.
86 changes: 67 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7deaee9

Please sign in to comment.