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
63 changes: 33 additions & 30 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,48 @@ on:
- develop
- release/**
- hotfix/**
- feat/dev-583-remove-set-env-in-github-actions
tags:
- "*"
- '*'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-10.15
- macos-12
- macos-13
- ubuntu-20.04
- ubuntu-16.04
- ubuntu-18.04
- windows-latest
- ubuntu-22.04
- windows-2019
- windows-2022
python:
- 3.7
- 3.8
env:
GDC_CLIENT_ZIP: "gdc-client.zip"
GDC_CLIENT_ZIP: 'gdc-client.zip'
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Run Tests
if: matrix.os != 'windows-latest'
run: |
python -m pip install --upgrade pip
pip install tox
tox -e py
- name: Package
run: |
cd bin
pip install virtualenv
. ./package
echo "GDC_CLIENT_ZIP=$GDC_CLIENT_ZIP" >> $GITHUB_ENV
shell: bash
- uses: actions/upload-artifact@v2
with:
name: ${{ env.GDC_CLIENT_ZIP }}-py${{ matrix.python }}-${{ matrix.os }}
path: bin/gdc-client_*.zip
- uses: actions/checkout@v2
with:
# required for setuptools_scm to correctly version: https://github.com/pypa/setuptools_scm/issues/480
fetch-depth: 0
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Run Tests
if: matrix.os != 'windows-latest'
run: |
pip install --upgrade pip
pip install tox
tox -e py
- name: Package
run: |
cd bin
pip install virtualenv
. ./package
echo "GDC_CLIENT_ZIP=$GDC_CLIENT_ZIP" >> $GITHUB_ENV
shell: bash
- uses: actions/upload-artifact@v2
with:
name: ${{ env.GDC_CLIENT_ZIP }}-py${{ matrix.python }}-${{ matrix.os }}
path: bin/gdc-client_*.zip
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ include:
tox:
parallel:
matrix:
- LANGUAGE_VERSION: [python3.7, python3.8, python3.9]
- LANGUAGE_VERSION: [python3.8, python3.9]
12 changes: 8 additions & 4 deletions bin/package
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
set -euox pipefail

function cleanup() {
# get rid of the virtualenv
Expand Down Expand Up @@ -33,6 +33,7 @@ while getopts ":d" opt; do
esac
done

DATE=${DATE-} # if date is not passed in, default DATE variable to empty string
VENV_NAME="venv"
BINARY_NAME="gdc-client"
VENV_PATH="$VENV_NAME/bin/activate"
Expand Down Expand Up @@ -69,7 +70,9 @@ esac
# setup.py is in previous dir
cd ..

python -m pip install -r requirements.txt
python -m pip install --upgrade pip
python -m pip install --no-deps -r requirements.txt
python -m pip install --no-deps .
python setup.py install

# go back go the ./gdc_client/bin dir
Expand All @@ -78,10 +81,10 @@ cd bin
echo "Building for ${TARGET_ENVIRONMENT}..."

# Make sure the correct version of pyinstaller and setuptools are installed
pip install -U "PyInstaller==3.5"
pip install -U PyInstaller

# Ran into ModuleNotFoundError: No module named 'pkg_resources.py2_warn' with higher versions of setuptools
pip install --upgrade 'setuptools<45.0.0'
pip install --upgrade setuptools

# Get version
VERSION=$(python -c "
Expand All @@ -96,6 +99,7 @@ pyinstaller \
--additional-hooks-dir=. \
--noconfirm \
--onefile \
--copy-metadata gdc-client \
-c gdc-client

echo "Testing produced binary..."
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-c requirements.txt

click>= 8
Comment thread
jiakf marked this conversation as resolved.
flask~=1.0.2
pytest~=4.6.2
pytest-cov~=2.7.1
Expand Down
32 changes: 16 additions & 16 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile dev-requirements.in
#
Expand All @@ -14,12 +14,12 @@ aws-sam-translator==1.11.0
# cfn-lint
aws-xray-sdk==2.11.0
# via moto
boto==2.49.0
# via moto
boto3==1.16.63
# via
# aws-sam-translator
# moto
boto==2.49.0
# via moto
botocore==1.19.63
# via
# aws-xray-sdk
Expand All @@ -42,8 +42,10 @@ chardet==3.0.4
# via
# -c requirements.txt
# requests
click==7.1.2
# via flask
click==8.1.7
# via
# -r dev-requirements.in
# flask
coverage==5.5
# via pytest-cov
cryptography==2.8
Expand All @@ -68,9 +70,9 @@ idna==2.8
# -c requirements.txt
# moto
# requests
importlib-metadata==2.1.3
importlib-metadata==7.0.1
# via
# pluggy
# -c requirements.txt
# pytest
itsdangerous==1.1.0
# via flask
Expand Down Expand Up @@ -107,8 +109,6 @@ moto==1.3.16
# via -r dev-requirements.in
packaging==20.9
# via pytest
pathlib2==2.3.7.post1
# via pytest
pluggy==0.13.1
# via pytest
py==1.11.0
Expand All @@ -124,12 +124,12 @@ pycparser==2.21
# cffi
pyparsing==2.4.7
# via packaging
pytest-cov==2.7.1
# via -r dev-requirements.in
pytest==4.6.2
# via
# -r dev-requirements.in
# pytest-cov
pytest-cov==2.7.1
# via -r dev-requirements.in
python-dateutil==2.8.2
# via
# botocore
Expand All @@ -145,8 +145,6 @@ pyyaml==5.3.1
# -c requirements.txt
# cfn-lint
# moto
requests-mock==1.5.2
# via -r dev-requirements.in
requests==2.22.0
# via
# -c requirements.txt
Expand All @@ -156,6 +154,8 @@ requests==2.22.0
# moto
# requests-mock
# responses
requests-mock==1.5.2
# via -r dev-requirements.in
responses==0.17.0
# via moto
rsa==4.7.2
Expand All @@ -172,7 +172,6 @@ six==1.16.0
# ecdsa
# mock
# moto
# pathlib2
# pytest
# python-dateutil
# python-jose
Expand All @@ -199,8 +198,9 @@ wrapt==1.14.1
# via aws-xray-sdk
xmltodict==0.13.0
# via moto
zipp==1.2.0
zipp==3.17.0
# via
# -c requirements.txt
# importlib-metadata
# moto

Expand Down
4 changes: 2 additions & 2 deletions gdc_client/auth/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def read_token_file(path):
# raise argparse.ArgumentTypeError(permissions_msg)

try:
ifs = open(abspath, "r")
except IOError as err:
ifs = open(abspath)
except OSError as err:
raise argparse.ArgumentTypeError(err)

with closing(ifs):
Expand Down
6 changes: 3 additions & 3 deletions gdc_client/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
GDC_API_PORT = 443


class GDCClient(object):
class GDCClient:
"""GDC API Requests Client"""

def __init__(self, host=GDC_API_HOST, port=GDC_API_PORT, token=None):
Expand All @@ -23,7 +23,7 @@ def __init__(self, host=GDC_API_HOST, port=GDC_API_PORT, token=None):

agent = " ".join(
[
"GDC-Client/{version}".format(version=version.__version__),
f"GDC-Client/{version.__version__}",
self.session.headers.get("User-Agent", "Unknown"),
]
)
Expand All @@ -43,7 +43,7 @@ def request(self, verb, path, **kwargs):
path=path,
),
auth=auth.GDCTokenAuth(self.token),
**kwargs
**kwargs,
)

with closing(res):
Expand Down
4 changes: 2 additions & 2 deletions gdc_client/client/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ def config(parser):
"-H",
"--host",
default=os.environ.get("GDC_API_HOST", GDC_API_HOST),
help="GDC API host [{host}]".format(host=GDC_API_HOST),
help=f"GDC API host [{GDC_API_HOST}]",
)

parser.add_argument(
"-P",
"--port",
default=os.environ.get("GDC_API_PORT", GDC_API_PORT),
help="GDC API port [{port}]".format(port=GDC_API_PORT),
help=f"GDC API port [{GDC_API_PORT}]",
)
12 changes: 5 additions & 7 deletions gdc_client/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class GDCClientArgumentParser(argparse.ArgumentParser):

def error(self, message):
self.print_help(sys.stderr)
sys.stderr.write("\ngdc-client error: {}\n".format(message))
sys.stderr.write(f"\ngdc-client error: {message}\n")
sys.exit(2)


class GDCClientConfigShared(object):
class GDCClientConfigShared:
setting_getters = {
"server": ConfigParser.get,
"http_chunk_size": ConfigParser.getint,
Expand Down Expand Up @@ -106,13 +106,11 @@ def get_setting(self, section, option):
try:
return self.setting_getters[option](self.config, section, option)
except NoOptionError:
log.debug(
'Setting named "{}" not found in section "{}"'.format(option, section)
)
log.debug(f'Setting named "{option}" not found in section "{section}"')
except NoSectionError:
log.debug('No section named "{}" found'.format(section))
log.debug(f'No section named "{section}" found')
except KeyError:
log.debug('Invalid setting "{}"'.format(option))
log.debug(f'Invalid setting "{option}"')

# Return defaults if nothing was provided in config file

Expand Down
Loading