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
14 changes: 4 additions & 10 deletions .github/workflows/e2e-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

# Check out merge commit
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}
fetch-depth: 0
Expand Down Expand Up @@ -63,22 +63,16 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update system packages
run: sudo apt-get update -y

- name: Install system deps
run: sudo apt-get install -y build-essential

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Python deps
run: pip install -r requirements.txt -r requirements-dev.txt wheel boto3
run: pip install -U setuptools wheel boto3 certifi

- name: Install Python SDK
run: make install
run: make dev-install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: setup python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: install dependencies
run: make requirements
run: make dev-install

- name: run linter
run: make lint
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8','3.9','3.10','3.11']
python-version: ['3.8','3.9','3.10','3.11', '3.12']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run tests
run: |
pip install .[test]
pip install ".[test]"
tox
8 changes: 4 additions & 4 deletions .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: dev

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Python deps
run: pip install -r requirements.txt -r requirements-dev.txt wheel boto3
run: pip install -U setuptools wheel boto3 certifi

- name: Install Python SDK
run: make install
run: make dev-install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/publish-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Update system packages
run: sudo apt-get update -y

- name: Install make
run: sudo apt-get install -y build-essential
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand All @@ -30,6 +24,6 @@ jobs:
LINODE_SDK_VERSION: ${{ github.event.release.tag_name }}

- name: Publish the release artifacts to PyPI
uses: pypa/gh-action-pypi-publish@a56da0b891b3dc519c7ee3284aff1fad93cc8598 # pin@release/v1.8.6
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # pin@release/v1.8.11
with:
password: ${{ secrets.PYPI_API_TOKEN }}
43 changes: 25 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ INTEGRATION_TEST_PATH :=
TEST_CASE_COMMAND :=
MODEL_COMMAND :=

LINODE_SDK_VERSION ?= "0.0.0.dev"
VERSION_MODULE_DOCSTRING ?= \"\"\"\nThe version of this linode_api4 package.\n\"\"\"\n\n
VERSION_FILE := ./linode_api4/version.py

ifdef TEST_CASE
TEST_CASE_COMMAND = -k $(TEST_CASE)
endif
Expand All @@ -12,60 +16,63 @@ ifdef TEST_MODEL
MODEL_COMMAND = models/$(TEST_MODEL)
endif

@PHONEY: clean
.PHONY: clean
clean:
mkdir -p dist
rm -r dist
rm -f baked_version

@PHONEY: build
build: clean
.PHONY: build
build: clean create-version
$(PYTHON) -m build --wheel --sdist

.PHONY: create-version
create-version:
@printf "${VERSION_MODULE_DOCSTRING}__version__ = \"${LINODE_SDK_VERSION}\"\n" > $(VERSION_FILE)

@PHONEY: release
.PHONY: release
release: build
$(PYTHON) -m twine upload dist/*

@PHONEY: install
install: clean requirements
$(PYTHON) -m pip install .
.PHONY: dev-install
dev-install: clean
$(PYTHON) -m pip install -e ".[dev]"

@PHONEY: requirements
requirements:
$(PYTHON) -m pip install -r requirements.txt -r requirements-dev.txt
.PHONY: install
install: clean create-version
$(PYTHON) -m pip install .

@PHONEY: black
.PHONY: black
black:
$(PYTHON) -m black linode_api4 test

@PHONEY: isort
.PHONY: isort
isort:
$(PYTHON) -m isort linode_api4 test

@PHONEY: autoflake
.PHONY: autoflake
autoflake:
$(PYTHON) -m autoflake linode_api4 test

@PHONEY: format
.PHONY: format
format: black isort autoflake

@PHONEY: lint
.PHONY: lint
lint: build
$(PYTHON) -m isort --check-only linode_api4 test
$(PYTHON) -m autoflake --check linode_api4 test
$(PYTHON) -m black --check --verbose linode_api4 test
$(PYTHON) -m pylint linode_api4
$(PYTHON) -m twine check dist/*

@PHONEY: testint
.PHONY: testint
testint:
$(PYTHON) -m pytest test/integration/${INTEGRATION_TEST_PATH}${MODEL_COMMAND} ${TEST_CASE_COMMAND}

@PHONEY: testunit
.PHONY: testunit
testunit:
$(PYTHON) -m pytest test/unit

@PHONEY: smoketest
.PHONY: smoketest
smoketest:
$(PYTHON) -m pytest -m smoke test/integration --disable-warnings
9 changes: 9 additions & 0 deletions linode_api4/groups/linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ def instance_create(
:type metadata: dict
:param firewall: The firewall to attach this Linode to.
:type firewall: int or Firewall
:param interfaces: An array of Network Interfaces to add to this Linode’s Configuration Profile.
At least one and up to three Interface objects can exist in this array.
:type interfaces: list[ConfigInterface] or list[dict[str, Any]]

:returns: A new Instance object, or a tuple containing the new Instance and
the generated password.
Expand Down Expand Up @@ -303,6 +306,12 @@ def instance_create(
fw = kwargs.pop("firewall")
kwargs["firewall_id"] = fw.id if isinstance(fw, Firewall) else fw

if "interfaces" in kwargs:
kwargs["interfaces"] = [
i._serialize() if isinstance(i, ConfigInterface) else i
for i in kwargs["interfaces"]
]

params = {
"type": ltype.id if issubclass(type(ltype), Base) else ltype,
"region": region.id if issubclass(type(region), Base) else region,
Expand Down
2 changes: 1 addition & 1 deletion linode_api4/objects/nodebalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class NodeBalancer(Base):
"region": Property(slug_relationship=Region),
"configs": Property(derived_class=NodeBalancerConfig),
"transfer": Property(),
"tags": Property(),
"tags": Property(mutable=True),
}

# create derived objects
Expand Down
5 changes: 5 additions & 0 deletions linode_api4/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
The version of this linode_api4 package.
"""

__version__ = "0.0.0.dev"
66 changes: 65 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,71 @@
[build-system]
requires = ["setuptools"]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"


[project]
name = "linode_api4"
authors = [{ name = "Linode", email = "developers@linode.com" }]
description = "The official Python SDK for Linode API v4"
readme = "README.rst"
requires-python = ">=3.8"
keywords = [
"akamai",
"Akamai Connected Cloud",
"linode",
"cloud",
"SDK",
"Linode APIv4",
]
license = { text = "BSD-3-Clause" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = ["requests", "polling"]
dynamic = ["version"]

[project.optional-dependencies]
test = ["tox>=4.4.0"]

dev = [
"tox>=4.4.0",
"mock>=5.0.0",
"pytest>=7.3.1",
"httpretty>=1.1.4",
"black>=23.1.0",
"isort>=5.12.0",
"autoflake>=2.0.1",
"pylint",
"twine>=4.0.2",
"build>=0.10.0",
"Sphinx>=6.0.0",
"sphinx-autobuild>=2021.3.14",
"sphinxcontrib-fulltoc>=1.2.0",
"build>=0.10.0",
"twine>=4.0.2",
]

[project.urls]
Homepage = "https://github.com/linode/linode_api4-python"
Documentation = "https://linode-api4.readthedocs.io/"
Repository = "https://github.com/linode/linode_api4-python.git"

[tool.setuptools.dynamic]
version = { attr = "linode_api4.version.__version__" }

[tool.setuptools.packages.find]
exclude = ['contrib', 'docs', 'test', 'test.*']

[tool.isort]
profile = "black"
line_length = 80
Expand Down
13 changes: 0 additions & 13 deletions requirements-dev.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

Loading