Skip to content
Closed
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
21 changes: 10 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,25 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip packages
- name: Install UV
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0

- name: Cache UV packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-uv-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
run: uv sync --extra dev

- name: Run ruff linter
run: |
ruff check Adyen test
run: uv run ruff check Adyen test

- name: Run ruff formatter check
run: |
ruff format --check Adyen test
run: uv run ruff format --check Adyen test

pre-commit:
runs-on: ubuntu-latest
Expand Down
27 changes: 6 additions & 21 deletions .github/workflows/pypipublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,21 @@ jobs:
name: run tests
uses: ./.github/workflows/python-ci.yml
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
name: Build and publish Python 🐍 distributions 📦 to PyPI
needs: [tests]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python 3.10
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0

- name: Install UV
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.14"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
# with:
# password: ${{ secrets.PYPI_TEST_KEY }}
# repository-url: https://test.pypi.org/legacy/
run: uv build

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install UV
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
uv sync --extra dev
sudo apt-get update
sudo apt install libcurl4-openssl-dev

- name: Test with tox
run: tox
run: uv run tox
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.pypirc
releaseguide.md
venv/
.venv/
.idea/
.coverage
.vagrant/
Expand Down
25 changes: 19 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
# UV_NO_CONFIG bypasses system overrides
# UV_DEFAULT_INDEX enforces the use of PYPI registry
UV=UV_NO_CONFIG=1 UV_DEFAULT_INDEX=https://pypi.org/simple/ uv
Comment on lines +1 to +3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding UV_NO_CONFIG=1 and UV_DEFAULT_INDEX=https://pypi.org/simple/ prevents developers in enterprise environments from using their custom uv configurations, private package registries, or corporate proxies. It is better to allow UV to be overridden or simply default to uv without bypassing user configurations.

UV ?= uv


install:
@pip install requests pycurl mock coveralls ruff
@$(UV) sync --extra dev --extra test --extra requests

lock:
@$(UV) lock

upgrade:
@$(UV) lock --upgrade

lint:
@ruff check Adyen test
@$(UV) run ruff check Adyen test

lint-fix:
@ruff check --fix Adyen test
@$(UV) run ruff check --fix Adyen test

format:
@ruff format Adyen test
@$(UV) run ruff format Adyen test

tests:
@python -m unittest discover -s test -p '*Test.py'
@$(UV) run python -m unittest discover -s test -p '*Test.py'

coverage:
@coverage run -m unittest discover -s test -p '*Test.py'
@$(UV) run coverage run -m unittest discover -s test -p '*Test.py'

clean:
@find . -not -path './.venv/*' -not -path './venv/*' -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
@rm -rf dist/ build/ .tox/ .coverage htmlcov/ Adyen.egg-info
Comment thread
jeandersonbc marked this conversation as resolved.

generator:=python
openapi-generator-version:=6.0.1
Expand Down
68 changes: 66 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ For more information, refer to our [documentation](https://docs.adyen.com/) or t

### For development purpose

Clone this repository and run
Clone this repository and install all dependencies with:

~~~~ bash
~~~~ bash
make install
~~~~

Expand Down Expand Up @@ -212,6 +212,70 @@ except Adyen.exceptions.AdyenError as error:

For a closer look at how our Python library works, clone our [example integration](https://github.com/adyen-examples/adyen-python-online-payments). This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.

## Development

### Prerequisites

Install [uv](https://docs.astral.sh/uv/getting-started/installation/), the package manager used to manage dependencies and run tooling.


### Setup

Clone the repository and install all development and test dependencies:

~~~~ bash
git clone https://github.com/Adyen/adyen-python-api-library.git
cd adyen-python-api-library
make install
~~~~

This creates a `.venv` directory with all dependencies pinned to the versions in `uv.lock`.

### Testing

~~~~ bash
make tests
~~~~

The test suite runs against the `requests` HTTP backend by default. To run with a different backend, install the corresponding extra and set it directly:

~~~~ bash
uv sync --extra test --extra pycurl
uv run python -m unittest discover -s test -p '*Test.py'
~~~~

### Linting and formatting

~~~~ bash
make lint # check for lint errors
make lint-fix # auto-fix lint errors
make format # format code
~~~~

### Managing dependencies

Dependencies are locked in `uv.lock`. This file is committed to the repository and covers all extras and Python versions in a single universal resolution.

To update the lock file after changing `pyproject.toml`:

~~~~ bash
make lock
~~~~

To upgrade all locked dependencies to their latest compatible versions:

~~~~ bash
make upgrade
~~~~

### Building the package

~~~~ bash
uv build
~~~~

This produces a source distribution and wheel under `dist/`.

## Feedback

We value your input! Help us enhance our API Libraries and improve the integration experience by providing your feedback. Please take a moment to fill out [our feedback form](https://forms.gle/A4EERrR6CWgKWe5r9) to share your thoughts, suggestions or ideas.
Expand Down
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@ test = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"mock>=4.0.0",
"requests>=2.25.0",
]
dev = [
"ruff>=0.4.4",
"pre-commit>=3.0.0",
"tox>=4.0.0",
"tox-uv>=1.0.0",
]

[[tool.uv.index]]
url = "https://pypi.org/simple/"
default = true
Comment on lines +49 to +51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Defining [[tool.uv.index]] pointing to PyPI as the default is redundant because uv already defaults to PyPI. Moreover, hardcoding this in pyproject.toml makes it harder for developers or CI environments using private package mirrors to override the index. It is recommended to remove this block.


[tool.setuptools.packages.find]
include = ["Adyen*"]

[tool.ruff]
line-length = 100
target-version = "py38"
Expand Down
13 changes: 0 additions & 13 deletions setup.cfg

This file was deleted.

45 changes: 0 additions & 45 deletions setup.py

This file was deleted.

11 changes: 5 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
[tox]
envlist = py{38,39,310,311,312,313,314}-{pycurl,requests,urllib},lint
skip_missing_interpreters=true
skip_missing_interpreters = true
requires = tox-uv

[testenv]
allowlist_externals = make
setenv = PYTHONHASHSEED = 34237731
deps =
mock
extras =
test
requests: requests
pycurl: pycurl
commands =
make tests

[testenv:lint]
allowlist_externals = make
skip_install = true
deps = ruff>=0.4.4
extras = dev
commands =
ruff check Adyen test
Loading
Loading