Skip to content

Commit

Permalink
Merge f7ddd4e into 1ee2503
Browse files Browse the repository at this point in the history
  • Loading branch information
ncilfone committed Aug 30, 2023
2 parents 1ee2503 + f7ddd4e commit 7222a47
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 50 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/python-coverage.yaml
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand All @@ -38,11 +38,11 @@ jobs:
- name: Test with pytest
run: |
coverage run -m pytest --cov-config=.coveragerc
- name: Debug coverage
run: coverage report -m
- name: Convert to LCO
run: coverage lcov --rcfile=.coveragerc

- name: Upload coverage data to coveralls.io
run: coveralls --service=github --rcfile=.coveragerc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/python-docs.yaml
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
deploy:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand All @@ -28,7 +28,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e .[s3,tune]
pip install -r ./requirements/DEV_REQUIREMENTS.txt
pip install -r ./requirements/S3_REQUIREMENTS.txt
pip install -r ./requirements/TUNE_REQUIREMENTS.txt
pip install -r ./requirements/TEST_EXTRAS_REQUIREMENTS.txt
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-lint.yaml
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
run_lint:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand All @@ -37,8 +37,8 @@ jobs:
- name: Run isort linter
run: |
isort --check . --skip="debug" --skip="versioneer.py" --skip="tests" --skip="_version.py"
isort --check .
- name: Run black linter
run: |
black --check . --exclude="versioneer.py|_version.py|debug|tests"
black --check .
2 changes: 1 addition & 1 deletion .github/workflows/python-manual-docs.yaml
Expand Up @@ -7,7 +7,7 @@ on: workflow_dispatch
jobs:
deploy:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yaml
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
deploy:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-pytest-s3.yaml
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-pytest-tune.yaml
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-pytest.yml
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-test-docs.yaml
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
deploy:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

Expand Down
10 changes: 7 additions & 3 deletions REQUIREMENTS.txt
@@ -1,6 +1,10 @@
attrs~=21.4
attrs~=23.1 ; python_version >= '3.7'
attrs~=22.2 ; python_version == '3.6'
cryptography~=37.0
GitPython~=3.1
pytomlpp~=1.0
pyYAML~=5.4
setuptools~=59.6
# pyYAML~=5.4
pyYAML~=6.0
setuptools~=68.1 ; python_version >= '3.8'
setuptools~=68.0 ; python_version == '3.7'
setuptools~=59.6 ; python_version == '3.6'
23 changes: 14 additions & 9 deletions requirements/DEV_REQUIREMENTS.txt
@@ -1,13 +1,18 @@
black~=22.1 ; python_version >= '3.7'
black~=23.7 ; python_version >= '3.8'
black~=23.3 ; python_version == '3.7'
black~=21.4b0 ; python_version == '3.6'
coveralls~=3.3
coverage[toml]~=6.1
isort~=5.10
# coveralls~=3.3
coverage[toml]~=7.3 ; python_version >= '3.8'
coverage[toml]~=7.2 ; python_version == '3.7'
coverage[toml]~=6.2 ; python_version == '3.6'
isort~=5.12 ; python_version >= '3.8'
isort~=5.11 ; python_version == '3.7'
isort~=5.10 ; python_version == '3.6'
moto~=3.1
pre-commit~=2.20 ; python_version >= '3.7'
pre-commit~=3.3 ; python_version >= '3.7'
pre-commit~=2.17 ; python_version == '3.6'
pydoc-markdown~=4.3, < 4.6.* ; python_version >= '3.7'
pydoc-markdown~=4.8 ; python_version >= '3.7'
pydoc-markdown~=3.13 ; python_version == '3.6'
pytest~=7.0
pytest-cov~=3.0
pylint~=2.11
pytest~=7.4
pytest-cov~=4.1
pylint~=2.17
6 changes: 3 additions & 3 deletions requirements/S3_REQUIREMENTS.txt
@@ -1,4 +1,4 @@
boto3~=1.20
botocore~=1.26
boto3~=1.28
botocore~=1.31
hurry.filesize~=0.9
s3transfer~=0.5
s3transfer~=0.6
7 changes: 4 additions & 3 deletions requirements/TUNE_REQUIREMENTS.txt
@@ -1,4 +1,5 @@
mypy_extensions~=0.4; python_version < '3.8'
optuna~=2.10
torch>=1.8.1
ax-platform~=0.2.4; python_version >= '3.7'
optuna~=3.3
torch~=2.0
ax-platform~=0.3.4; python_version >= '3.9'
ax-platform~=0.3.3; python_version == '3.8'
30 changes: 16 additions & 14 deletions spock/backend/help.py
Expand Up @@ -110,20 +110,22 @@ def handle_attributes_print(info_dict, max_indent: int):
max_indent: max indent for pretty print of help
"""
# Figure out indents
max_param_length = max([len(k) for k in info_dict.keys()])
max_type_length = max([v["len"]["type"] for v in info_dict.values()])
# Print akin to the argparser
for k, v in info_dict.items():
print(
f" {k}"
+ (" " * (max_param_length - v["len"]["name"] + max_indent))
+ f'{v["type"]}'
+ (" " * (max_type_length - v["len"]["type"] + max_indent))
+ f'{v["desc"]} {v["default"]}'
)
# Blank for spacing :-/
print("")
# Add check for an empty dict (corresponds to any empty spock class)
if len(info_dict) > 0:
# Figure out indents
max_param_length = max([len(k) for k in info_dict.keys()])
max_type_length = max([v["len"]["type"] for v in info_dict.values()])
# Print akin to the argparser
for k, v in info_dict.items():
print(
f" {k}"
+ (" " * (max_param_length - v["len"]["name"] + max_indent))
+ f'{v["type"]}'
+ (" " * (max_type_length - v["len"]["type"] + max_indent))
+ f'{v["desc"]} {v["default"]}'
)
# Blank for spacing :-/
print("")


def get_type_string(val, nested_others):
Expand Down
5 changes: 5 additions & 0 deletions spock/utils.py
Expand Up @@ -602,13 +602,15 @@ def add_repo_info(out_dict: Dict) -> Dict:
head_result = subprocess.run(
"git rev-parse --abbrev-ref --symbolic-full-name HEAD",
stdout=subprocess.PIPE,
stdin=subprocess.DEVNULL if sys.platform == "win32" else None,
shell=True,
check=False,
)
else:
head_result = subprocess.run(
"git rev-parse --abbrev-ref --symbolic-full-name HEAD",
capture_output=True,
stdin=subprocess.DEVNULL if sys.platform == "win32" else None,
shell=True,
check=False,
)
Expand All @@ -631,6 +633,9 @@ def add_repo_info(out_dict: Dict) -> Dict:
out_dict.update(
{"# Git Origin": repo.active_branch.commit.repo.remotes.origin.url}
)
# Attempt to close to not leak resources
# https://github.com/gitpython-developers/GitPython#leakage-of-system-resources
repo.close()
except git.InvalidGitRepositoryError: # pragma: no cover
# But it's okay if we are not
out_dict = make_blank_git(out_dict)
Expand Down

0 comments on commit 7222a47

Please sign in to comment.