Skip to content

Commit 5ee2ea3

Browse files
Merge pull request #278 from linode/dev
Release v5.4.0
2 parents 3e78a74 + 1610f83 commit 5ee2ea3

File tree

135 files changed

+10220
-3431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+10220
-3431
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"

.github/workflows/lint.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Linting Actions
2+
on:
3+
pull_request: null
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: checkout repo
13+
uses: actions/checkout@v3
14+
15+
- name: setup python 3
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.x'
19+
20+
- name: install dependencies
21+
run: pip3 install -r requirements-dev.txt -r requirements.txt
22+
23+
- name: run linter
24+
run: make lint

.github/workflows/main.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ name: Test Suite
33

44
on:
55
push:
6-
branches: [ master ]
6+
branches:
7+
- dev
8+
- main
79
pull_request:
8-
branches: [ master ]
910
workflow_dispatch:
1011

1112
jobs:
1213
build:
1314
runs-on: ubuntu-latest
1415
strategy:
1516
matrix:
16-
python-version: ['3.7','3.8','3.9','3.10', '3.11']
17+
python-version: ['3.7','3.8','3.9','3.10','3.11']
1718
steps:
1819
- uses: actions/checkout@v2
1920
- uses: actions/setup-python@v2

.github/workflows/publish-pypi.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: release
2+
on:
3+
workflow_dispatch: null
4+
release:
5+
types: [ published ]
6+
jobs:
7+
pypi-release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
13+
- name: Update system packages
14+
run: sudo apt-get update -y
15+
16+
- name: Install make
17+
run: sudo apt-get install -y build-essential
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install Python deps
25+
run: pip install wheel
26+
27+
- name: Install package requirements
28+
run: make requirements
29+
30+
- name: Build the package
31+
run: make build
32+
env:
33+
LINODE_SDK_VERSION: ${{ github.event.release.tag_name }}
34+
35+
- name: Publish the release artifacts to PyPI
36+
uses: pypa/gh-action-pypi-publish@37f50c210e3d2f9450da2cd423303d6a14a6e29f # pin@release/v1
37+
with:
38+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ docs/_build/*
1010
.pytest_cache/*
1111
.tox/*
1212
venv
13+
baked_version

.pylintrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ confidence=
5050
# --enable=similarities". If you want to run only the classes checker, but have
5151
# no Warning level messages displayed, use"--disable=all --enable=classes
5252
# --disable=W"
53-
disable=blacklisted-name,invalid-name,missing-docstring,empty-docstring,unneeded-not,singleton-comparison,misplaced-comparison-constant,unidiomatic-typecheck,consider-using-enumerate,consider-iterating-dictionary,bad-classmethod-argument,bad-mcs-method-argument,bad-mcs-classmethod-argument,single-string-used-for-slots,line-too-long,too-many-lines,trailing-whitespace,missing-final-newline,trailing-newlines,multiple-statements,superfluous-parens,bad-whitespace,mixed-line-endings,unexpected-line-ending-format,bad-continuation,wrong-spelling-in-comment,wrong-spelling-in-docstring,invalid-characters-in-docstring,multiple-imports,wrong-import-order,ungrouped-imports,wrong-import-position,old-style-class,len-as-condition,fatal,astroid-error,parse-error,method-check-failed,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,literal-comparison,no-self-use,no-classmethod-decorator,no-staticmethod-decorator,cyclic-import,duplicate-code,too-many-ancestors,too-many-instance-attributes,too-few-public-methods,too-many-public-methods,too-many-return-statements,too-many-branches,too-many-arguments,too-many-locals,too-many-statements,too-many-boolean-expressions,consider-merging-isinstance,too-many-nested-blocks,simplifiable-if-statement,redefined-argument-from-local,no-else-return,consider-using-ternary,trailing-comma-tuple,unreachable,dangerous-default-value,pointless-statement,pointless-string-statement,expression-not-assigned,unnecessary-pass,unnecessary-lambda,duplicate-key,deprecated-lambda,assign-to-new-keyword,useless-else-on-loop,exec-used,eval-used,confusing-with-statement,using-constant-test,lost-exception,assert-on-tuple,attribute-defined-outside-init,bad-staticmethod-argument,protected-access,arguments-differ,signature-differs,abstract-method,super-init-not-called,no-init,non-parent-init-called,useless-super-delegation,unnecessary-semicolon,bad-indentation,mixed-indentation,lowercase-l-suffix,wildcard-import,deprecated-module,relative-import,reimported,import-self,misplaced-future,fixme,invalid-encoded-data,global-variable-undefined,global-variable-not-assigned,global-statement,global-at-module-level,unused-import,unused-variable,unused-argument,unused-wildcard-import,redefined-outer-name,redefined-builtin,redefine-in-handler,undefined-loop-variable,cell-var-from-loop,bare-except,broad-except,duplicate-except,nonstandard-exception,binary-op-exception,property-on-old-class,logging-not-lazy,logging-format-interpolation,bad-format-string-key,unused-format-string-key,bad-format-string,missing-format-argument-key,unused-format-string-argument,format-combined-specification,missing-format-attribute,invalid-format-index,anomalous-backslash-in-string,anomalous-unicode-escape-in-string,bad-open-mode,boolean-datetime,redundant-unittest-assert,deprecated-method,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,useless-object-inheritance,comparison-with-callable,bad-option-value,consider-using-f-string,unspecified-encoding,missing-timeout,unnecessary-dunder-call
53+
disable=consider-using-dict-items,blacklisted-name,invalid-name,missing-docstring,empty-docstring,unneeded-not,singleton-comparison,misplaced-comparison-constant,unidiomatic-typecheck,consider-using-enumerate,consider-iterating-dictionary,bad-classmethod-argument,bad-mcs-method-argument,bad-mcs-classmethod-argument,single-string-used-for-slots,line-too-long,too-many-lines,trailing-whitespace,missing-final-newline,trailing-newlines,multiple-statements,superfluous-parens,bad-whitespace,mixed-line-endings,unexpected-line-ending-format,bad-continuation,wrong-spelling-in-comment,wrong-spelling-in-docstring,invalid-characters-in-docstring,multiple-imports,wrong-import-order,ungrouped-imports,wrong-import-position,old-style-class,len-as-condition,fatal,astroid-error,parse-error,method-check-failed,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,literal-comparison,no-self-use,no-classmethod-decorator,no-staticmethod-decorator,cyclic-import,duplicate-code,too-many-ancestors,too-many-instance-attributes,too-few-public-methods,too-many-public-methods,too-many-return-statements,too-many-branches,too-many-arguments,too-many-locals,too-many-statements,too-many-boolean-expressions,consider-merging-isinstance,too-many-nested-blocks,simplifiable-if-statement,redefined-argument-from-local,no-else-return,consider-using-ternary,trailing-comma-tuple,unreachable,dangerous-default-value,pointless-statement,pointless-string-statement,expression-not-assigned,unnecessary-pass,unnecessary-lambda,duplicate-key,deprecated-lambda,assign-to-new-keyword,useless-else-on-loop,exec-used,eval-used,confusing-with-statement,using-constant-test,lost-exception,assert-on-tuple,attribute-defined-outside-init,bad-staticmethod-argument,protected-access,arguments-differ,signature-differs,abstract-method,super-init-not-called,no-init,non-parent-init-called,useless-super-delegation,unnecessary-semicolon,bad-indentation,mixed-indentation,lowercase-l-suffix,wildcard-import,deprecated-module,relative-import,reimported,import-self,misplaced-future,fixme,invalid-encoded-data,global-variable-undefined,global-variable-not-assigned,global-statement,global-at-module-level,unused-import,unused-variable,unused-argument,unused-wildcard-import,redefined-outer-name,redefined-builtin,redefine-in-handler,undefined-loop-variable,cell-var-from-loop,bare-except,broad-except,duplicate-except,nonstandard-exception,binary-op-exception,property-on-old-class,logging-not-lazy,logging-format-interpolation,bad-format-string-key,unused-format-string-key,bad-format-string,missing-format-argument-key,unused-format-string-argument,format-combined-specification,missing-format-attribute,invalid-format-index,anomalous-backslash-in-string,anomalous-unicode-escape-in-string,bad-open-mode,boolean-datetime,redundant-unittest-assert,deprecated-method,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,useless-object-inheritance,comparison-with-callable,bad-option-value,consider-using-f-string,unspecified-encoding,missing-timeout,unnecessary-dunder-call,no-value-for-parameter,c-extension-no-member,attribute-defined-outside-init,use-a-generator
5454

5555
# Enable the message, report, category or checker with the given id(s). You can
5656
# either give multiple identifier separated by comma (,) or put this option
5757
# multiple time (only on the command line, not in the configuration file where
5858
# it should appear only once). See also the "--disable" option for examples.
59-
enable=syntax-error,unrecognized-inline-option,init-is-generator,return-in-init,function-redefined,not-in-loop,return-outside-function,yield-outside-function,return-arg-in-generator,nonexistent-operator,duplicate-argument-name,abstract-class-instantiated,bad-reversed-sequence,too-many-star-expressions,invalid-star-assignment-target,star-needs-assignment-target,nonlocal-and-global,continue-in-finally,nonlocal-without-binding,used-prior-global-declaration,method-hidden,access-member-before-definition,no-method-argument,no-self-argument,invalid-slots-object,assigning-non-slot,invalid-slots,inherit-non-class,inconsistent-mro,duplicate-bases,non-iterator-returned,unexpected-special-method-signature,invalid-length-returned,import-error,relative-beyond-top-level,used-before-assignment,undefined-variable,undefined-all-variable,invalid-all-object,no-name-in-module,unbalanced-tuple-unpacking,unpacking-non-sequence,bad-except-order,raising-bad-type,bad-exception-context,misplaced-bare-raise,raising-non-exception,notimplemented-raised,catching-non-exception,slots-on-old-class,super-on-old-class,bad-super-call,missing-super-argument,no-member,not-callable,assignment-from-no-return,no-value-for-parameter,too-many-function-args,unexpected-keyword-arg,redundant-keyword-arg,missing-kwoa,invalid-sequence-index,invalid-slice-index,assignment-from-none,not-context-manager,invalid-unary-operand-type,unsupported-binary-operation,repeated-keyword,not-an-iterable,not-a-mapping,unsupported-membership-test,unsubscriptable-object,unsupported-assignment-operation,unsupported-delete-operation,invalid-metaclass,logging-unsupported-format,logging-format-truncated,logging-too-many-args,logging-too-few-args,bad-format-character,truncated-format-string,mixed-format-string,format-needs-mapping,missing-format-string-key,too-many-format-args,too-few-format-args,bad-str-strip-call,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,yield-inside-async-function,not-async-context-manager,unused-variable,attribute-defined-outside-init,bad-indentation
59+
enable=syntax-error,unrecognized-inline-option,init-is-generator,return-in-init,function-redefined,not-in-loop,return-outside-function,yield-outside-function,return-arg-in-generator,nonexistent-operator,duplicate-argument-name,abstract-class-instantiated,bad-reversed-sequence,too-many-star-expressions,invalid-star-assignment-target,star-needs-assignment-target,nonlocal-and-global,continue-in-finally,nonlocal-without-binding,used-prior-global-declaration,method-hidden,access-member-before-definition,no-method-argument,no-self-argument,invalid-slots-object,assigning-non-slot,invalid-slots,inherit-non-class,inconsistent-mro,duplicate-bases,non-iterator-returned,unexpected-special-method-signature,invalid-length-returned,import-error,relative-beyond-top-level,used-before-assignment,undefined-variable,undefined-all-variable,invalid-all-object,no-name-in-module,unbalanced-tuple-unpacking,unpacking-non-sequence,bad-except-order,raising-bad-type,bad-exception-context,misplaced-bare-raise,raising-non-exception,notimplemented-raised,catching-non-exception,slots-on-old-class,super-on-old-class,bad-super-call,missing-super-argument,no-member,not-callable,assignment-from-no-return,too-many-function-args,unexpected-keyword-arg,redundant-keyword-arg,missing-kwoa,invalid-sequence-index,invalid-slice-index,assignment-from-none,not-context-manager,invalid-unary-operand-type,unsupported-binary-operation,repeated-keyword,not-an-iterable,not-a-mapping,unsupported-membership-test,unsubscriptable-object,unsupported-assignment-operation,unsupported-delete-operation,invalid-metaclass,logging-unsupported-format,logging-format-truncated,logging-too-many-args,logging-too-few-args,bad-format-character,truncated-format-string,mixed-format-string,format-needs-mapping,missing-format-string-key,too-many-format-args,too-few-format-args,bad-str-strip-call,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,yield-inside-async-function,not-async-context-manager,unused-variable,bad-indentation
6060

6161

6262
[REPORTS]

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
graft test
22
global-exclude *.pyc
3+
include baked_version

Makefile

+32-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ PYTHON ?= python3
33
@PHONEY: clean
44
clean:
55
mkdir -p dist
6-
rm dist/*
6+
rm -r dist
7+
rm -f baked_version
78

89
@PHONEY: build
910
build: clean
@@ -14,3 +15,33 @@ build: clean
1415
@PHONEY: release
1516
release: build
1617
twine upload dist/*
18+
19+
20+
install: clean
21+
python3 setup.py install
22+
23+
24+
requirements:
25+
pip install -r requirements.txt -r requirements-dev.txt
26+
27+
28+
black:
29+
black linode_api4 test
30+
31+
32+
isort:
33+
isort linode_api4 test
34+
35+
36+
autoflake:
37+
autoflake linode_api4 test
38+
39+
40+
format: black isort autoflake
41+
42+
43+
lint:
44+
isort --check-only linode_api4 test
45+
autoflake --check linode_api4 test
46+
black --check --verbose linode_api4 test
47+
pylint linode_api4

README.rst

+62-8
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ The official python library for the `Linode API v4`_ in python.
55

66
.. _Linode API v4: https://developers.linode.com/api/v4/
77

8-
.. image:: https://travis-ci.com/linode/linode_api4-python.svg?branch=master
9-
:target: https://travis-ci.com/linode/linode_api4-python
8+
.. image:: https://img.shields.io/github/actions/workflow/status/linode/linode_api4-python/main.yml?label=tests
9+
:target: https://img.shields.io/github/actions/workflow/status/linode/linode_api4-python/main.yml?label=tests
1010

1111
.. image:: https://badge.fury.io/py/linode-api4.svg
1212
:target: https://badge.fury.io/py/linode-api4
@@ -30,13 +30,62 @@ To build and install this package:
3030
- ``./setup.py install``
3131

3232
Usage
33-
-----
33+
=====
34+
35+
Quick Start
36+
-----------
37+
38+
In order to authenticate with the Linode API, you will first need to create a
39+
`Linode Personal Access Token`_ with your desired account permissions.
40+
41+
The following code sample can help you quickly get started using this package.
42+
43+
.. code-block:: python
44+
45+
from linode_api4 import LinodeClient, Instance
46+
47+
# Create a Linode API client
48+
client = LinodeClient("MY_PERSONAL_ACCESS_TOKEN")
49+
50+
# Create a new Linode
51+
new_linode, root_pass = client.linode.instance_create(
52+
ltype="g6-nanode-1",
53+
region="us-southeast",
54+
image="linode/ubuntu22.04",
55+
label="my-ubuntu-linode"
56+
)
3457
35-
Check out the `Getting Started guide`_ to start using this library, or read
36-
`the docs`_ for extensive documentation.
58+
# Print info about the Linode
59+
print("Linode IP:", new_linode.ipv4[0])
60+
print("Linode Root Password:", root_pass)
3761
38-
.. _Getting Started guide: http://linode_api4.readthedocs.io/en/latest/guides/getting_started.html
39-
.. _the docs: http://linode_api4.readthedocs.io/en/latest/index.html
62+
# List all Linodes on the account
63+
my_linodes = client.linode.instances()
64+
65+
# Print the Label of every Linode on the account
66+
print("All Instances:")
67+
for instance in my_linodes:
68+
print(instance.label)
69+
70+
# List Linodes in the us-southeast region
71+
specific_linodes = client.linode.instances(
72+
Instance.region == "us-southeast"
73+
)
74+
75+
# Print the label of each Linode in us-southeast
76+
print("Instances in us-southeast:")
77+
for instance in specific_linodes:
78+
print(instance.label)
79+
80+
# Delete the new instance
81+
new_linode.delete()
82+
83+
Check out the `Getting Started guide`_ for more details on getting started
84+
with this library, or read `the docs`_ for more extensive documentation.
85+
86+
.. _Linode Personal Access Token: https://www.linode.com/docs/products/tools/api/guides/manage-api-tokens/
87+
.. _Getting Started guide: https://linode-api4.readthedocs.io/en/latest/guides/getting_started.html
88+
.. _the docs: https://linode-api4.readthedocs.io/en/latest/index.html
4089

4190
Examples
4291
--------
@@ -89,7 +138,12 @@ Documentation
89138

90139
This library is documented with Sphinx_. Docs live in the ``docs`` directory.
91140
The easiest way to build the docs is to run ``sphinx-autobuild`` in that
92-
folder.
141+
folder::
142+
143+
sphinx-autobuild docs docs/build
144+
145+
After running this command, ``sphinx-autobuild`` will host a local web server
146+
with the rendered documentation.
93147

94148
Classes and functions inside the library should be annotated with sphinx-compliant
95149
docstrings which will be used to automatically generate documentation for the

docs/conf.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# -- Project information -----------------------------------------------------
2121

2222
project = 'linode_api4'
23-
copyright = '2020, Linode'
23+
copyright = '2023, Linode'
2424
author = 'Linode'
2525

2626
# The short X.Y version
@@ -86,7 +86,10 @@
8686
# further. For a list of options available for each theme, see the
8787
# documentation.
8888
#
89-
# html_theme_options = {}
89+
html_theme_options = {
90+
'sidebar_width': '320px',
91+
'page_width': '1000px',
92+
}
9093

9194
# Add any paths that contain custom static files (such as style sheets) here,
9295
# relative to this directory. They are copied after the builtin static files,

0 commit comments

Comments
 (0)