Skip to content

Commit

Permalink
upgrade fate and set up for init sub-command
Browse files Browse the repository at this point in the history
part of #20
  • Loading branch information
jesteria committed Feb 15, 2023
1 parent e05c801 commit ff9da5b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 18 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "netrics-measurements"
version = "0.0.1-rc.2"
version = "0.0.1-rc.3"
description = "The extensible network measurements framework"
license = "MIT"
authors = [
Expand All @@ -11,7 +11,7 @@ packages = [{include = "netrics", from = "src"}]

[tool.poetry.dependencies]
python = "^3.8"
fate-scheduler = "0.1.0-rc.5"
fate-scheduler = "0.1.0-rc.6"
netifaces = "^0.11.0"

[tool.poetry.dev-dependencies]
Expand Down
49 changes: 33 additions & 16 deletions readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ With `pipx` installed, the above command alone will create a virtual environment

==== PyPI

NOTE: At its current stage of development Netrics is only available for download from its source repository (see below).
Netrics may be installed from https://pypi.org/project/netrics-measurements/[PyPI] via `pip`, _e.g._:

[source,sh]
----
pip install netrics-measurements
----

==== Source

Expand Down Expand Up @@ -110,36 +115,48 @@ The report printed by the above should include the line: `Status: OK (Exit code

== Initialization

Outside of <<package-managers,installation by a package manager>>, initialization is necessary to set up your Netrics installation.
Outside of <<package-managers,installation by a package manager>>, initialization is suggested to set up your Netrics installation.

[NOTE]
====
The `init` command is WIP.
<<PyPI>> and <<source,source>> distributions feature the `netrics` sub-command `init`:

Without proper initialization, you might see an error like the following:
[source,sh]
----
netrics init
----

netrics debug run: error: missing configuration file (tried: [PATH]/netrics/defaults{.toml,.yaml})
The above, (executed from a standard shell), will walk you through the process of initializing your system for Netrics, (executing all tasks which follow below).

That is, Netrics requires configuration files under an installation-dependent `PATH`.
=== Configuration initialization

For example configuration, consult the https://github.com/chicago-cdac/netrics/tree/main/test/[source repository directory: test]. You may copy or symbolically link example configuration files to your Netrics installation path.
To initialize configuration in particular, `init` features the sub-command `conf`:

Alternatively, simply `touch` the following paths to fulfill initialization:
[source,sh]
----
netrics init conf
----

[source,bash]
The above will copy the built-in default configuration distributed with Netrics to the appropriate path on your system (or to a specified path). From there, this configuration may be customized.

=== Shell completion

To install Netrics command tab-completion for your shell, `init` features the sub-command `comp`:

[source,sh]
----
touch [PATH]/netrics/{defaults,measurements}.toml
netrics init comp
----

Note that Netrics supports both TOML and YAML configuration formats.
====
The above will install tab-completion files for your user, system-wide, (or to a specified path).

Shells currently supported include: bash, fish and tcsh.

== Configuration

Netrics is _really_ a distribution of https://github.com/chicago-cdac/fate[Fate], and as such shares its configuration and execution scheme.
NOTE: Netrics is _really_ a distribution of https://github.com/chicago-cdac/fate[Fate], and as such shares its configuration and execution scheme.

Netrics expects two configuration files: *measurements* and *defaults*.

Netrics expects two configuration files: *measurements* and *defaults*. Both files _must_ exist; but, either file _may_ be empty. (Although, without measurements, there's little for Netrics to do!)
Should either file not be found on the sytem, Netrics will fall back to its built-in configuration. As necessary for your installation, to initialize these files for customization, see <<Initialization>>.

TIP: Netrics supports both TOML and YAML configuration formats.

Expand Down
13 changes: 13 additions & 0 deletions src/netrics/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ def entrypoint(hook):
hook(
conf=conf,
banner_path='netrics.cli.include.banner',
#
# entry_points: currently only used for configuring shell completion
#
# fate defaults to LIB, LIBs & LIBd (like its fate, fates & fated)
#
# we have those, but those names would look weird, so we're
# using the following instead.
#
entry_points=(
'netrics',
'netrics.s',
'netrics.d',
),
)


Expand Down

0 comments on commit ff9da5b

Please sign in to comment.