Skip to content

Commit 248be6d

Browse files
authored
Add support for up to python 3.11 (#232)
* Lifecycle python support * Update go hook testing
1 parent fc208d1 commit 248be6d

File tree

11 files changed

+50
-32
lines changed

11 files changed

+50
-32
lines changed

.github/workflows/pr-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
python: [3.7, 3.8, 3.9]
21+
python: ["3.8", "3.9", "3.10", "3.11"]
2222
defaults:
2323
run:
2424
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
@@ -28,7 +28,7 @@ jobs:
2828
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
2929
- uses: actions/setup-go@v3
3030
with:
31-
go-version: '>=1.19.0'
31+
go-version: '>=1.21.0'
3232
- name: Set up Python ${{ matrix.python }}
3333
uses: actions/setup-python@v2
3434
with:
@@ -41,7 +41,7 @@ jobs:
4141
go install github.com/go-critic/go-critic/cmd/gocritic@latest
4242
go install golang.org/x/tools/cmd/goimports@latest
4343
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
44-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
44+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
4545
- name: Install plugin
4646
run: |
4747
pip install .

.golangci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
linters:
2+
# Disable all linters.
3+
# Default: false
4+
disable-all: true
5+
# Enable specific linter
6+
# https://golangci-lint.run/usage/linters/#enabled-by-default
7+
enable:
8+
- errcheck
9+
- gosimple
10+
- govet
11+
- ineffassign
12+
- staticcheck
13+
- unused
14+
- gofmt
15+
- goimports
16+
- gocritic

.pre-commit-config.yaml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.3.0
3+
rev: v4.5.0
44
hooks:
55
- id: check-case-conflict
66
- id: end-of-file-fixer
@@ -25,7 +25,7 @@ repos:
2525
hooks:
2626
- id: black
2727
- repo: https://github.com/pycqa/flake8
28-
rev: '5.0.4'
28+
rev: '6.1.0'
2929
hooks:
3030
- id: flake8
3131
additional_dependencies:
@@ -35,16 +35,15 @@ repos:
3535
- flake8-comprehensions>=2.1.0
3636
- flake8-debugger>=3.1.0
3737
- flake8-pep3101>=1.2.1
38-
# language_version: python3.6
3938
exclude: templates/
4039
- repo: https://github.com/pre-commit/pygrep-hooks
41-
rev: v1.9.0
40+
rev: v1.10.0
4241
hooks:
4342
- id: python-check-blanket-noqa
4443
- id: python-check-mock-methods
4544
- id: python-no-log-warn
4645
- repo: https://github.com/PyCQA/bandit
47-
rev: "1.7.4"
46+
rev: "1.7.5"
4847
hooks:
4948
- id: bandit
5049
files: ^python/
@@ -74,16 +73,19 @@ repos:
7473
# ignore all files, run on hard-coded modules instead
7574
pass_filenames: false
7675
always_run: true
77-
- repo: https://github.com/dnephin/pre-commit-golang
78-
rev: v0.5.1
76+
- id: go-unit-tests
77+
name: go unit tests
78+
entry: go test ./...
79+
pass_filenames: false
80+
types: [go]
81+
language: system
82+
- id: go-build-mod
83+
name: go build mod
84+
entry: go build ./...
85+
pass_filenames: false
86+
types: [go]
87+
language: system
88+
- repo: https://github.com/golangci/golangci-lint
89+
rev: v1.55.2
7990
hooks:
80-
- id: go-fmt
81-
# - id: go-vet
82-
- id: go-imports
83-
- id: go-cyclo
84-
args: [-over=20]
85-
- id: golangci-lint
86-
- id: go-critic
87-
- id: go-unit-tests
88-
- id: go-build
89-
- id: go-mod-tidy
91+
- id: golangci-lint-full

.pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ persistent=yes
99
disable=
1010
missing-docstring, # not everything needs a docstring
1111
fixme, # work in progress
12-
bad-continuation, # clashes with black
1312
too-few-public-methods, # triggers when inheriting
1413
ungrouped-imports, # clashes with isort
1514
duplicate-code, # broken, setup.py

buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 0.2
22
phases:
33
install:
44
runtime-versions:
5-
python: 3.7
5+
python: 3.8
66
golang: 1.12
77
commands:
88
- pip install pre-commit

cfn/logging/cloudwatchlogs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (p *cloudWatchLogsProvider) Write(b []byte) (int, error) {
9292
LogStreamName: aws.String(p.logStreamName),
9393

9494
LogEvents: []*cloudwatchlogs.InputLogEvent{
95-
&cloudwatchlogs.InputLogEvent{
95+
{
9696
Message: aws.String(string(b)),
9797
Timestamp: aws.Int64(time.Now().UnixNano() / int64(time.Millisecond)),
9898
},

cfn/logging/cloudwatchlogs_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestCloudWatchLogProvider(t *testing.T) {
1515
DescribeLogGroupsFn: func(input *cloudwatchlogs.DescribeLogGroupsInput) (*cloudwatchlogs.DescribeLogGroupsOutput, error) {
1616
return &cloudwatchlogs.DescribeLogGroupsOutput{
1717
LogGroups: []*cloudwatchlogs.LogGroup{
18-
&cloudwatchlogs.LogGroup{LogGroupName: input.LogGroupNamePrefix},
18+
{LogGroupName: input.LogGroupNamePrefix},
1919
},
2020
}, nil
2121
},
@@ -102,7 +102,7 @@ func TestCloudWatchLogProvider(t *testing.T) {
102102
DescribeLogGroupsFn: func(input *cloudwatchlogs.DescribeLogGroupsInput) (*cloudwatchlogs.DescribeLogGroupsOutput, error) {
103103
return &cloudwatchlogs.DescribeLogGroupsOutput{
104104
LogGroups: []*cloudwatchlogs.LogGroup{
105-
&cloudwatchlogs.LogGroup{LogGroupName: input.LogGroupNamePrefix},
105+
{LogGroupName: input.LogGroupNamePrefix},
106106
},
107107
}, nil
108108
},
@@ -144,7 +144,7 @@ func TestCloudWatchLogProvider(t *testing.T) {
144144
DescribeLogGroupsFn: func(input *cloudwatchlogs.DescribeLogGroupsInput) (*cloudwatchlogs.DescribeLogGroupsOutput, error) {
145145
return &cloudwatchlogs.DescribeLogGroupsOutput{
146146
LogGroups: []*cloudwatchlogs.LogGroup{
147-
&cloudwatchlogs.LogGroup{LogGroupName: input.LogGroupNamePrefix},
147+
{LogGroupName: input.LogGroupNamePrefix},
148148
},
149149
}, nil
150150
},
@@ -188,7 +188,7 @@ func TestCloudWatchLogGroupExists(t *testing.T) {
188188
DescribeLogGroupsFn: func(input *cloudwatchlogs.DescribeLogGroupsInput) (*cloudwatchlogs.DescribeLogGroupsOutput, error) {
189189
return &cloudwatchlogs.DescribeLogGroupsOutput{
190190
LogGroups: []*cloudwatchlogs.LogGroup{
191-
&cloudwatchlogs.LogGroup{LogGroupName: input.LogGroupNamePrefix},
191+
{LogGroupName: input.LogGroupNamePrefix},
192192
},
193193
}, nil
194194
},

cfn/metrics/publisher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (p *Publisher) publishMetric(metricName string, data map[string]string, uni
9797
d = append(d, dim)
9898
}
9999
md := []*cloudwatch.MetricDatum{
100-
&cloudwatch.MetricDatum{
100+
{
101101
MetricName: aws.String(metricName),
102102
Unit: aws.String(unit),
103103
Value: aws.Float64(value),

cfn/scheduler/scheduler_notag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (s *Scheduler) Reschedule(lambdaCtx context.Context, secsFromNow int64, cal
116116
_, perr := s.client.PutTargets(&cloudwatchevents.PutTargetsInput{
117117
Rule: aws.String(invocationIDS.Handler),
118118
Targets: []*cloudwatchevents.Target{
119-
&cloudwatchevents.Target{
119+
{
120120
Arn: aws.String(lc.InvokedFunctionArn),
121121
Id: aws.String(invocationIDS.Target),
122122
Input: aws.String(string(callbackRequest)),

python/rpdk/go/codegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def init_handlers(self, project: Project, src):
154154
contents = template.render()
155155
project.safewrite(path, contents)
156156

157-
# pylint: disable=unused-argument,no-self-use
157+
# pylint: disable=unused-argument
158158
def _get_generated_root(self, project: Project):
159159
LOG.debug("Init started")
160160

0 commit comments

Comments
 (0)