etherlyzer 0.5.2__tar.gz → 0.5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/PKG-INFO +6 -6
  2. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/README.md +2 -2
  3. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/pyproject.toml +7 -7
  4. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/exporter.py +2 -2
  5. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/formatters.py +1 -1
  6. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/ieee/catalog.py +1 -1
  7. etherlyzer-0.5.2/src/etherlyzer/ieee/registry.py → etherlyzer-0.5.3/src/etherlyzer/ieee/ieee_registry.py +3 -3
  8. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/ieee/index.py +1 -1
  9. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/cli.py +5 -0
  10. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/commands/identify.py +1 -1
  11. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/util/dirs.py +1 -1
  12. etherlyzer-0.5.2/src/etherlyzer/util/settings.py → etherlyzer-0.5.3/src/etherlyzer/util/knobs.py +22 -12
  13. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/LICENSE +0 -0
  14. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/__init__.py +0 -0
  15. {etherlyzer-0.5.2 → etherlyzer-0.5.3/src/etherlyzer}/etherlyzer.env +0 -0
  16. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/ieee/__init__.py +0 -0
  17. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/ieee/csv_parser.py +0 -0
  18. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/__init__.py +0 -0
  19. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/commands/__init__.py +0 -0
  20. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/commands/bulk.py +0 -0
  21. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/commands/format.py +0 -0
  22. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/commands/info.py +0 -0
  23. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/commands/normalize.py +0 -0
  24. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/commands/update.py +0 -0
  25. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/terminal/utility.py +0 -0
  26. {etherlyzer-0.5.2 → etherlyzer-0.5.3}/src/etherlyzer/util/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: etherlyzer
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: Fast offline lookup and classification of Ethernet-related identifiers.
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -18,9 +18,9 @@ Classifier: Programming Language :: Python :: 3.14
18
18
  Classifier: Topic :: System :: Networking
19
19
  Classifier: Topic :: Security
20
20
  Classifier: Typing :: Typed
21
- Requires-Dist: pandas (>=3.0.5,<4.0.0)
22
- Requires-Dist: platformdirs (>=4.10.0,<5.0.0)
23
- Requires-Dist: python-dotenv (>=1.2.2,<2.0.0)
21
+ Requires-Dist: pandas (>=3.0.6,<4.0.0)
22
+ Requires-Dist: platformdirs (>=4.12.2,<5.0.0)
23
+ Requires-Dist: python-dotenv (>=1.2.4,<2.0.0)
24
24
  Requires-Dist: requests (>=2.34.2,<3.0.0)
25
25
  Requires-Dist: tqdm (>=4.70.1,<5.0.0)
26
26
  Project-URL: Homepage, https://github.com/blue-hexagon/EtherLyzer
@@ -62,7 +62,7 @@ Typical use cases include:
62
62
 
63
63
  Etherlyzer automatically fetches the official IEEE registry listings once every 24 hours, ensuring that the local registry data remains up to date. IEEE states that its public listings are updated every 24 hours.
64
64
 
65
- The synchronization interval can be adjusted to your preference in the shipped `etherlyzer.env` file.
65
+ The synchronization interval can be adjusted to your preference in the shipped `src/etherlyzer/etherlyzer.env` file.
66
66
 
67
67
  ## Showcasing
68
68
 
@@ -226,7 +226,7 @@ etherlyzer format l..iIdOØ1!23-4oo.. --fix-typos --casing "upper" --block-size
226
226
 
227
227
  ## Configuration
228
228
 
229
- The included `etherlyzer.env` file provides sensible defaults and works out of the box but is configurable.
229
+ The included `src/etherlyzer/etherlyzer.env` file provides sensible defaults and works out of the box but is configurable.
230
230
 
231
231
 
232
232
  ```dotenv
@@ -32,7 +32,7 @@ Typical use cases include:
32
32
 
33
33
  Etherlyzer automatically fetches the official IEEE registry listings once every 24 hours, ensuring that the local registry data remains up to date. IEEE states that its public listings are updated every 24 hours.
34
34
 
35
- The synchronization interval can be adjusted to your preference in the shipped `etherlyzer.env` file.
35
+ The synchronization interval can be adjusted to your preference in the shipped `src/etherlyzer/etherlyzer.env` file.
36
36
 
37
37
  ## Showcasing
38
38
 
@@ -196,7 +196,7 @@ etherlyzer format l..iIdOØ1!23-4oo.. --fix-typos --casing "upper" --block-size
196
196
 
197
197
  ## Configuration
198
198
 
199
- The included `etherlyzer.env` file provides sensible defaults and works out of the box but is configurable.
199
+ The included `src/etherlyzer/etherlyzer.env` file provides sensible defaults and works out of the box but is configurable.
200
200
 
201
201
 
202
202
  ```dotenv
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "etherlyzer"
3
- version = "0.5.2"
3
+ version = "0.5.3"
4
4
  description = "Fast offline lookup and classification of Ethernet-related identifiers."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -38,9 +38,9 @@ classifiers = [
38
38
 
39
39
  dependencies = [
40
40
  "requests (>=2.34.2,<3.0.0)",
41
- "python-dotenv>=1.2.2,<2.0.0",
42
- "platformdirs (>=4.10.0,<5.0.0)",
43
- "pandas (>=3.0.5,<4.0.0)",
41
+ "python-dotenv>=1.2.4,<2.0.0",
42
+ "platformdirs (>=4.12.2,<5.0.0)",
43
+ "pandas (>=3.0.6,<4.0.0)",
44
44
  "tqdm (>=4.70.1,<5.0.0)",
45
45
  ]
46
46
 
@@ -58,15 +58,15 @@ packages = [
58
58
  { include = "etherlyzer", from = "src" }
59
59
  ]
60
60
  include = [
61
- { path = "etherlyzer.env", format = ["sdist", "wheel"] }
61
+ { path = "src/etherlyzer/etherlyzer.env", format = ["sdist", "wheel"] }
62
62
  ]
63
63
 
64
64
 
65
65
  [tool.poetry.group.dev.dependencies]
66
66
  pytest = "^9.1.1"
67
67
  pytest-cov = "^7.1.0"
68
- mypy = "^2.2.0"
69
- ruff = "^0.15.21"
68
+ mypy = "^2.4.0"
69
+ ruff = "^0.16.10"
70
70
 
71
71
 
72
72
  [tool.pytest.ini_options]
@@ -1,7 +1,7 @@
1
- from etherlyzer.util.settings import config
1
+ from etherlyzer.util.knobs import config
2
2
  from etherlyzer.formatters import MACFormatter
3
3
 
4
- from etherlyzer.ieee.registry import IEEEEntry
4
+ from etherlyzer.ieee.ieee_registry import IEEEEntry
5
5
 
6
6
 
7
7
  class RegistryMatchExporter:
@@ -1,7 +1,7 @@
1
1
  from enum import StrEnum
2
2
  from typing import Literal
3
3
 
4
- from etherlyzer.util.settings import config
4
+ from etherlyzer.util.knobs import config
5
5
  from string import punctuation
6
6
 
7
7
 
@@ -1,4 +1,4 @@
1
- from etherlyzer.ieee.registry import RegCategory, IEEEEntry, EtherTypeEntry, IEEERegistry
1
+ from etherlyzer.ieee.ieee_registry import RegCategory, IEEEEntry, EtherTypeEntry, IEEERegistry
2
2
 
3
3
 
4
4
  class Catalog:
@@ -8,8 +8,8 @@ from requests import RequestException
8
8
  from tqdm import tqdm
9
9
 
10
10
  from etherlyzer.ieee.csv_parser import IEEERegistryReader
11
- from etherlyzer.util.dirs import IEEE_DATA_PLATDIR
12
- from etherlyzer.util.settings import config
11
+ from etherlyzer.util.dirs import DATA_PLATFORM_DIR
12
+ from etherlyzer.util.knobs import config
13
13
 
14
14
 
15
15
  class RegCategory(StrEnum):
@@ -96,7 +96,7 @@ class IEEERegistry:
96
96
 
97
97
  @property
98
98
  def filepath(self) -> Path:
99
- return IEEE_DATA_PLATDIR / Path("".join([self.name, ".csv"]))
99
+ return DATA_PLATFORM_DIR / Path("".join([self.name, ".csv"]))
100
100
 
101
101
  @property
102
102
  def assignment_length(self) -> int:
@@ -5,7 +5,7 @@ from pathlib import Path
5
5
  from time import sleep
6
6
  from typing import TypeVar
7
7
 
8
- from etherlyzer.ieee.registry import RegCategory, IEEEEntry, EtherTypeEntry, IEEERegistry
8
+ from etherlyzer.ieee.ieee_registry import RegCategory, IEEEEntry, EtherTypeEntry, IEEERegistry
9
9
 
10
10
  HEX_DIGITS = frozenset("0123456789ABCDEF")
11
11
 
@@ -1,8 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import argparse
4
+ from pathlib import Path
4
5
 
5
6
  from etherlyzer.terminal.commands import info, format, normalize, identify, update, bulk
7
+ from etherlyzer.util.dirs import DATA_PLATFORM_DIR
8
+ from etherlyzer.util.knobs import handle_settings_file
6
9
 
7
10
 
8
11
  def build_parser() -> argparse.ArgumentParser:
@@ -34,6 +37,8 @@ def build_parser() -> argparse.ArgumentParser:
34
37
 
35
38
 
36
39
  def main(argv: list[str] | None = None) -> int:
40
+ handle_settings_file()
41
+
37
42
  parser = build_parser()
38
43
 
39
44
  args = parser.parse_args(argv)
@@ -3,7 +3,7 @@ import re
3
3
  from etherlyzer.formatters import MACFormatter
4
4
  from etherlyzer.ieee.index import IEEEIndex
5
5
  from etherlyzer.ieee.catalog import Catalog
6
- from etherlyzer.ieee.registry import RegCategory, EtherTypeEntry
6
+ from etherlyzer.ieee.ieee_registry import RegCategory, EtherTypeEntry
7
7
 
8
8
 
9
9
  def run(args):
@@ -3,4 +3,4 @@ from pathlib import Path
3
3
  from platformdirs import user_cache_dir
4
4
 
5
5
  PROJECT_ROOT = Path(__file__).parent.parent.parent
6
- IEEE_DATA_PLATDIR = Path(user_cache_dir(appname="etherlyzer", appauthor="Manjana", version="1.0", ensure_exists=True))
6
+ DATA_PLATFORM_DIR = Path(user_cache_dir(appname="etherlyzer", appauthor="Manjana", version="1.0", ensure_exists=True))
@@ -5,50 +5,60 @@ from pathlib import Path
5
5
 
6
6
  from dotenv import load_dotenv
7
7
 
8
- load_dotenv("etherlyzer.env")
8
+ from etherlyzer.util.dirs import DATA_PLATFORM_DIR
9
9
 
10
10
 
11
- class MACCase(StrEnum):
11
+
12
+ class MACCasing(StrEnum):
12
13
  UPPER = "upper"
13
14
  LOWER = "lower"
14
15
 
15
16
 
16
17
  @dataclass(slots=True, frozen=True)
17
- class Settings:
18
+ class EtherlyzerKnobs:
18
19
  db_update_interval_hours: int = 24
19
20
 
20
21
  field_separator: str = ";"
21
22
  mac_separator: str = "."
22
23
  mac_block_size: int = 4
23
- mac_case: MACCase = MACCase.UPPER
24
+ mac_case: MACCasing = MACCasing.UPPER
24
25
 
25
26
  show_sync_messages: bool = False
26
27
 
28
+ def __post_init__(self) -> None: # noqa
29
+ if not (DATA_PLATFORM_DIR / "etherlyzer.env").exists():
30
+ from importlib.resources import files
31
+ import shutil
32
+ template_env = files("etherlyzer").joinpath("etherlyzer.env")
33
+ destination_env = DATA_PLATFORM_DIR / "etherlyzer.env"
34
+ with template_env.open("rb") as src, destination_env.open("wb") as dst:
35
+ shutil.copyfileobj(src, dst)
36
+ load_dotenv(DATA_PLATFORM_DIR / "etherlyzer.env")
27
37
 
28
38
 
29
- def validate_config(conf: Settings) -> None:
30
- if conf.db_update_interval_hours <= 0:
39
+ def validate_knobs(etherlyzer_knobs: EtherlyzerKnobs) -> None:
40
+ if etherlyzer_knobs.db_update_interval_hours <= 0:
31
41
  raise ValueError(
32
42
  "DB_UPDATE_INTERVAL_HOURS must be greater than zero."
33
43
  )
34
44
 
35
- if len(conf.field_separator) != 1:
45
+ if len(etherlyzer_knobs.field_separator) != 1:
36
46
  raise ValueError(
37
47
  "FIELD_SEPARATOR must contain exactly one character."
38
48
  )
39
49
 
40
- if conf.mac_separator not in {"", ":", "-", "."}:
50
+ if etherlyzer_knobs.mac_separator not in {"", ":", "-", "."}:
41
51
  raise ValueError(
42
52
  "MAC_SEPARATOR must be one of '', ':', '-', or '.'."
43
53
  )
44
54
 
45
- if conf.mac_block_size not in {2, 4, 12}:
55
+ if etherlyzer_knobs.mac_block_size not in {2, 4, 12}:
46
56
  raise ValueError(
47
57
  "MAC_BLOCK_SIZE must be 2, 4, or 12."
48
58
  )
49
59
 
50
60
 
51
- def load_config(cls: type[Settings]) -> Settings:
61
+ def load_from_env(cls: type[EtherlyzerKnobs]) -> EtherlyzerKnobs:
52
62
  values = {}
53
63
 
54
64
  for field in fields(cls):
@@ -90,5 +100,5 @@ def load_config(cls: type[Settings]) -> Settings:
90
100
  return cls(**values)
91
101
 
92
102
 
93
- config = load_config(Settings)
94
- validate_config(config)
103
+ config = load_from_env(EtherlyzerKnobs)
104
+ validate_knobs(config)
File without changes