Skip to content

Commit

Permalink
Fix build by upgrading python (#57)
Browse files Browse the repository at this point in the history
Plus some luisp strong opinions:
* remove travis config
* remove p-c-p and venv-update
  • Loading branch information
nemacysts authored May 16, 2024
1 parent 998cc1d commit 372d50c
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: 3.8
- run: pip install tox
- run: tox
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: 3.8

- name: Install Python dependencies
run: pip install wheel
Expand Down
18 changes: 10 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
default_language_version:
python: python3.8

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -32,28 +35,27 @@ repos:
- id: fix-encoding-pragma
args: ['--remove']
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.4.2
rev: v2.0.4
hooks:
- id: autopep8
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.3.2
rev: v3.12.0
hooks:
- id: reorder-python-imports
args: [
'--remove-import', 'from __future__ import absolute_import',
'--remove-import', 'from __future__ import unicode_literals',
]
- repo: https://github.com/asottile/pyupgrade
rev: v1.9.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py3-plus]
- repo: https://github.com/asottile/add-trailing-comma
rev: v0.7.1
rev: v3.1.0
hooks:
- id: add-trailing-comma
args: [--py36-plus]
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

[mypy]
python_version = 3.6
python_version = 3.8
check_untyped_defs = False
ignore_missing_imports = True
warn_redundant_casts = True
Expand Down
5 changes: 1 addition & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Coverage==5.0 fails with `Safety level may not be changed inside a transaction`
# on python 3.6.0 (xenial) (https://github.com/nedbat/coveragepy/issues/703)
coverage<5.0
coverage
mypy
pre-commit>=1.0.0
pytest
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
version='1.1.18',
classifiers=[
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.8',
],
install_requires=[
'pytimeparse',
Expand Down
2 changes: 1 addition & 1 deletion sticht/rollbacks/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _get_metric_configs_for_service_by_cluster(
) -> Dict[str, Dict[str, Any]]: # TODO: add type for rollback file config
configs = {}
for filename in get_rollback_files_from_soaconfigs(soa_dir, service=service):
with open(filename, 'r') as file:
with open(filename) as file:
configs[get_cluster_from_soaconfigs_filename(filename)] = yaml.safe_load(file)
return configs

Expand Down
2 changes: 1 addition & 1 deletion sticht/rollbacks/slo.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_slos_for_service(service, soa_dir) -> Generator:

for sink in composite_sink.sinks():
if not alert_config_by_ts_metric[
sink.source.timeseries, sink.source.metric
sink.source.timeseries, sink.source.metric,
].is_silent:
signalflow, rules = sink.generate_signalflow_signals_and_rules()
query = textwrap.dedent('\n'.join(signalflow))
Expand Down
12 changes: 7 additions & 5 deletions sticht/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,13 @@ async def listen_for_slack_events(self):
log_error(f'Exception while processing event: {traceback.format_exc()}')
log.debug(f'event: {event!r}')
except Exception:
log_error('\n'.join(
'Uncaught error in listen_for_slack_events:',
traceback.format_exc(),
'Restarting event listener.',
))
log_error(
'\n'.join(
'Uncaught error in listen_for_slack_events:',
traceback.format_exc(),
'Restarting event listener.',
),
)
await self.listen_for_slack_events()

def notify_users(self, message):
Expand Down
2 changes: 1 addition & 1 deletion sticht/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def trigger(self, *args, **kwargs):
float
] = None # in normal operation, this will be None, but this lets tests set a max time.

def __init__(self,):
def __init__(self):

self.event_loop = asyncio.get_event_loop()
self.finished_event = asyncio.Event(loop=self.event_loop)
Expand Down
2 changes: 1 addition & 1 deletion tests/rollbacks/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


@mock.patch('sticht.rollbacks.sources.splunk.SplunkMetricWatcher.query')
def test_watch_metrics_for_service_creates_watchers(mock_splunk_metric_watcher_query, tmp_path,):
def test_watch_metrics_for_service_creates_watchers(mock_splunk_metric_watcher_query, tmp_path):
service = 'serviceA'
soa_dir = tmp_path
(soa_dir / service).mkdir()
Expand Down
11 changes: 6 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
# limitations under the License.

[tox]
envlist = py36
tox_pip_extensions_ext_pip_custom_platform = true
tox_pip_extensions_ext_venv_update = true
envlist = py38

[testenv]
basepython = python3.6
basepython = python3.8
deps = -rrequirements-dev.txt
passenv = HOME SSH_AUTH_SOCK USER
passenv =
HOME
SSH_AUTH_SOCK
USER
commands =
coverage erase
coverage run -m pytest {posargs:tests}
Expand Down

0 comments on commit 372d50c

Please sign in to comment.