Skip to content

Commit

Permalink
feat: move to v0.4.0
Browse files Browse the repository at this point in the history
Many small changes to get tests passing.
  • Loading branch information
cofiem committed Nov 30, 2023
1 parent 41d7215 commit 31cd85e
Show file tree
Hide file tree
Showing 22 changed files with 67 additions and 254 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ updates:
interval: "weekly"
target-branch: "main"
commit-message:
prefix: "pip stable"
prefix: "pip runtime"
prefix-development: "pip dev"
open-pull-requests-limit: 3
6 changes: 4 additions & 2 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

jobs:
analyze:
name: Analyze
name: Code Analysis
runs-on: ubuntu-latest
permissions:
actions: read
Expand All @@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
language: [ "python" ]
python-version: [ "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:
- name: Checkout repository
Expand Down Expand Up @@ -49,6 +49,8 @@ jobs:

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
languages: ${{ matrix.language }}

- name: Run pip audit
uses: pypa/[email protected]
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/codeql.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Test Package

on:
push:
branches: [ "main" ]
branches: [ "main", "develop" ]
pull_request:
branches: [ "main" ]
branches: [ "develop" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
permissions:
contents: read
pull-requests: write
Expand Down
78 changes: 0 additions & 78 deletions .github/workflows/test.yml

This file was deleted.

77 changes: 0 additions & 77 deletions CONTIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ source .venv-test/bin/activate
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade -r requirements.txt

SERVER_MONITOR_AGENT_VERSION='0.3.0'
SERVER_MONITOR_AGENT_VERSION='0.4.0'
pip install --index-url https://test.pypi.org/simple/ --no-deps server-monitor-agent==$SERVER_MONITOR_AGENT_VERSION
```

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.2
0.4.0
3 changes: 2 additions & 1 deletion ansible/roles/app/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ ubuntu_apt_source_mirror_security: http://security.ubuntu.com/ubuntu
ubuntu_package_source_file: /etc/apt/sources.list

python_versions:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'

# general
guest_data_dir: "/home/{{ guest_user_name }}/data"
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "server-monitor-agent"
description = "Utility to run checks on a server and send notifications."
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
Expand Down Expand Up @@ -72,17 +72,19 @@ src_paths = [
legacy_tox_ini = """
[tox]
isolated_build = True
envlist = py39,py310,py311
envlist = py38,py39,py310,py311,py312
[testenv]
#recreate = true
deps =
-r requirements.txt
-r requirements-dev.txt
set_env =
PYTHONDEVMODE=1
commands =
server-monitor-agent --help
server-monitor-agent --version
coverage run -m pytest --tb=no --durations=5
coverage run -m pytest --tb=long --durations=5
"""

[tool.pydocstyle]
Expand Down
4 changes: 1 addition & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,4 @@ types-PyYAML
types-requests
types-backports
types-urllib3
pyre-check; platform_system != "Windows"
openapi-python-client
pytype;python_version<"3.9"
openapi-python-client
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ PyYAML==6.0.1
boltons==23.1.1
click==8.1.7
beartype==0.16.4
importlib_metadata; python_version<"3.8"
importlib-resources
importlib-metadata
backports.zoneinfo[tzdata];python_version<"3.9"
1 change: 1 addition & 0 deletions src/server_monitor_agent/agent/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import argparse
import os
import pathlib
Expand Down
1 change: 1 addition & 0 deletions src/server_monitor_agent/agent/command.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import logging
from pathlib import Path

Expand Down
17 changes: 11 additions & 6 deletions src/server_monitor_agent/agent/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
import subprocess
import typing
from datetime import datetime
from importlib import metadata, resources
from zoneinfo import ZoneInfo
import importlib_resources
import importlib_metadata

try:
import zoneinfo
except ImportError:
from backports import zoneinfo

APP_NAME_DASH = "server-monitor-agent"
APP_NAME_UNDER = "server_monitor_agent"
Expand All @@ -26,14 +31,14 @@ def get_hostname() -> str:
def get_version() -> typing.Optional[str]:
"""Get the version of this package."""
try:
dist = metadata.distribution(APP_NAME_DASH)
dist = importlib_metadata.distribution(APP_NAME_DASH)
return dist.version
except metadata.PackageNotFoundError:
except importlib_metadata.PackageNotFoundError:
# ignore error
pass

try:
with resources.path(APP_NAME_UNDER, "entry.py") as p:
with importlib_resources.path(APP_NAME_UNDER, "entry.py") as p:
return (p.parent.parent.parent / "VERSION").read_text().strip()
except FileNotFoundError:
# ignore error
Expand Down Expand Up @@ -69,7 +74,7 @@ class CheckReport(abc.ABC):
description: str

def __post_init__(self):
self._timestamp_formatted = datetime.now(ZoneInfo(self.time_zone)).isoformat(
self._timestamp_formatted = datetime.now(zoneinfo.ZoneInfo(self.time_zone)).isoformat(
timespec="seconds"
)

Expand Down
Loading

0 comments on commit 31cd85e

Please sign in to comment.