diff --git a/.gitignore b/.gitignore index a68cdae..18d87f6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ venv .env public *.swp -config.yaml \ No newline at end of file +config.yaml +dist diff --git a/argos/__init__.py b/argos/__init__.py index e69de29..1cf6267 100644 --- a/argos/__init__.py +++ b/argos/__init__.py @@ -0,0 +1 @@ +VERSION = "0.1.0" diff --git a/argos/commands.py b/argos/commands.py index 6de52ce..ca87647 100644 --- a/argos/commands.py +++ b/argos/commands.py @@ -9,6 +9,7 @@ from alembic import command from alembic.config import Config from argos import logging +from argos import VERSION from argos.agent import ArgosAgent @@ -40,6 +41,11 @@ def server(): pass +@cli.command() +def version(): + click.echo(VERSION) + + @cli.command() @click.argument("server_url", envvar="ARGOS_AGENT_SERVER_URL") @click.argument("auth", envvar="ARGOS_AGENT_TOKEN") @@ -111,8 +117,11 @@ def validate_max_results(ctx, param, value): @click.option( "--max-lock-seconds", default=100, - help="The number of seconds after which a lock is considered stale, must be higher than 60 " - "(the checks have a timeout value of 60 seconds)", + help=( + "The number of seconds after which a lock is " + "considered stale, must be higher than 60 " + "(the checks have a timeout value of 60 seconds)" + ), callback=validate_max_lock_seconds, ) @coroutine diff --git a/.env.example b/conf/.env.example similarity index 100% rename from .env.example rename to conf/.env.example diff --git a/config-example.yaml b/conf/config-example.yaml similarity index 100% rename from config-example.yaml rename to conf/config-example.yaml diff --git a/log_conf.yaml b/conf/log_conf.yaml similarity index 100% rename from log_conf.yaml rename to conf/log_conf.yaml diff --git a/docs/cli.md b/docs/cli.md index 2e70714..472f8d6 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -26,8 +26,9 @@ Options: --help Show this message and exit. Commands: - agent Get and run tasks to the provided server. + agent Get and run tasks to the provided server. server + version ``` @@ -65,7 +65,7 @@ You can read more about the configuration in the [configuration section](../conf Environment variables are used to configure the server. You can also put them in an `.env` file: -```{literalinclude} ../../.env.example +```{literalinclude} ../../conf/.env.example --- caption: .env --- diff --git a/pyproject.toml b/pyproject.toml index 6912c4d..92b065a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools", "setuptools-scm"] -build-backend = "setuptools.build_meta" +requires = ["hatchling"] +build-backend = "hatchling.build" [project] name = "argos-monitoring" -version = "0.1.0" +dynamic = ["version"] description = "Distributed supervision tool for HTTP." authors = [ { name = "Alexis Métaireau", email = "alexis@notmyidea.org" }, @@ -12,10 +12,12 @@ authors = [ ] readme = "README.md" classifiers = [ - "Programming Language :: Python :: 3.11", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", - "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", + "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", + "Intended Audience :: System Administrators", ] dependencies = [ @@ -49,7 +51,7 @@ dev = [ "respx>=0.20,<1", "ruff==0.1.5,<1", "sphinx-autobuild", - "build>=1.2.1" + "hatch==1.9.4", ] docs = [ "cogapp", @@ -66,9 +68,20 @@ repository = "https://framagit.org/framasoft/framaspace/argos" "Funding" = "https://framasoft.org/en/#support" "Tracker" = "https://framagit.org/framasoft/framaspace/argos/-/issues" -[tool.setuptools] +[tool.hatch.build.targets.sdist] +include = [ + "/argos", + "/docs", + "/tests", +] + +[tool.hatch.build.targets.wheel] packages = ["argos"] +[tool.hatch.version] +path = "argos/__init__.py" + + [project.scripts] argos = "argos.commands:cli"