Move version to single place; Move 'build' to User Guide; Add 'make publish'
This commit is contained in:
8
Makefile
8
Makefile
@@ -1,15 +1,19 @@
|
||||
VERSION=1.0.2
|
||||
VERSION=$(shell python3 -c "import sys; sys.path.insert(0, '.'); from vppcfg._version import __version__; print(__version__)")
|
||||
VPPCFG:=vppcfg
|
||||
PYTHON?=python3
|
||||
PIP?=pip
|
||||
PIP_DEPENDS=build yamale netaddr pylint
|
||||
PIP_DEPENDS+=argparse pyyaml ipaddress black
|
||||
PIP_DEPENDS+=argparse pyyaml ipaddress black build twine
|
||||
WIPE=dist $(VPPCFG).egg-info .pybuild debian/vppcfg debian/vppcfg.*.log
|
||||
WIPE+=debian/vppcfg.*.debhelper debian/.debhelper debian/files
|
||||
WIPE+=debian/vppcfg.substvars
|
||||
WHL_INSTALL=dist/$(VPPCFG)-$(VERSION)-py3-none-any.whl
|
||||
TESTS=tests.py
|
||||
|
||||
.PHONY: publish
|
||||
publish:
|
||||
$(PYTHON) -m twine upload dist/$(VPPCFG)*$(VERSION)*
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
$(PYTHON) -m build
|
||||
|
||||
29
README.md
29
README.md
@@ -5,34 +5,9 @@ reconciles a running [VPP](https://fd.io/) daemon with its configuration. It is
|
||||
re-entrant and stateless. The tool connects to the VPP API and creates/removes all of the
|
||||
configuration in a minimally intrusive way.
|
||||
|
||||
***NOTE*** This code is under development, and probably won't work well until this note is removed.
|
||||
If you're interested in helping, reach out to <pim at ipng dot ch> to discuss options.
|
||||
|
||||
## Building
|
||||
|
||||
This program expects Python3 and PIP to be installed. It's known to work on Debian Bullseye and
|
||||
Bookworm, as well as on Ubuntu Focal, Jammy and Noble.
|
||||
|
||||
You can simply install this package from [[PyPi](https://pypi.org/project/vppcfg/)]:
|
||||
```
|
||||
|
||||
## Start a Virtual Environment
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
|
||||
## Install python build dependencies
|
||||
$ make install-deps
|
||||
|
||||
## Ensure all unittests pass.
|
||||
$ make test
|
||||
|
||||
## Build vppcfg
|
||||
$ make build
|
||||
|
||||
## Exit the virtual environment
|
||||
$ deactivate
|
||||
|
||||
## Install the tool with PIP
|
||||
$ make install
|
||||
$ pip install [--break-system-packages] vppcfg
|
||||
```
|
||||
|
||||
## Running
|
||||
|
||||
@@ -5,6 +5,29 @@ safely to a running VPP dataplane. It contains a strict syntax and semantic vali
|
||||
and a path planner that brings the dataplane from any configuration state safely to any
|
||||
other configuration state, as defined by these YAML files.
|
||||
|
||||
## Building
|
||||
|
||||
This program expects Python3 and PIP to be installed. It's known to work on Debian Bullseye,
|
||||
Bookworm and Trixie, as well as on Ubuntu Focal, Jammy and Noble.
|
||||
|
||||
Optionally, edit `vppcfg/_version.py` and bump the version number. Then:
|
||||
```
|
||||
## Start a Virtual Environment
|
||||
$ python3 -m venv .venv
|
||||
$ source .venv/bin/activate
|
||||
|
||||
$ make install-deps
|
||||
$ make test
|
||||
$ make build
|
||||
$ deactivate
|
||||
|
||||
## Publish requires a valid ~/.pypirc with an upload token.
|
||||
$ make publish
|
||||
|
||||
## Install the tool with PIP
|
||||
$ make install
|
||||
```
|
||||
|
||||
## User Guide
|
||||
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "vppcfg"
|
||||
version = "1.0.2"
|
||||
dynamic = ["version"]
|
||||
authors = [
|
||||
{ name="Pim van Pelt", email="pimg@ipng.ch" }
|
||||
]
|
||||
@@ -21,3 +21,6 @@ Homepage = "https://git.ipng.ch/ipng/vppcfg"
|
||||
[build-system]
|
||||
requires = ["setuptools>=61.0.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools.dynamic]
|
||||
version = {attr = "vppcfg._version.__version__"}
|
||||
|
||||
8
setup.py
8
setup.py
@@ -1,10 +1,16 @@
|
||||
"""vppcfg setuptools setup.py for pip and deb pkg installations"""
|
||||
|
||||
import os
|
||||
from setuptools import setup
|
||||
|
||||
# Read version from _version.py
|
||||
version_file = os.path.join(os.path.dirname(__file__), "vppcfg", "_version.py")
|
||||
with open(version_file) as f:
|
||||
exec(f.read())
|
||||
|
||||
setup(
|
||||
name="vppcfg",
|
||||
version="1.0.2",
|
||||
version=__version__,
|
||||
install_requires=[
|
||||
"requests",
|
||||
'importlib-metadata; python_version >= "3.8"',
|
||||
|
||||
3
vppcfg/_version.py
Normal file
3
vppcfg/_version.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""Version information for vppcfg."""
|
||||
|
||||
__version__ = "1.0.3"
|
||||
@@ -24,9 +24,11 @@ import yaml
|
||||
# Ensure the paths are correct when we execute from the source tree
|
||||
try:
|
||||
from vppcfg.config import Validator
|
||||
from vppcfg._version import __version__
|
||||
except ModuleNotFoundError:
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
from vppcfg.config import Validator
|
||||
from vppcfg._version import __version__
|
||||
from vppcfg.vpp.reconciler import Reconciler
|
||||
from vppcfg.vpp.dumper import Dumper
|
||||
|
||||
@@ -211,6 +213,7 @@ def main():
|
||||
logging.basicConfig(
|
||||
format="[%(levelname)-8s] %(name)s.%(funcName)s: %(message)s", level=level
|
||||
)
|
||||
logging.info(f"vppcfg version {__version__}")
|
||||
|
||||
opt_kwargs = {}
|
||||
if "vpp_json_dir" in args and args.vpp_json_dir is not None:
|
||||
|
||||
Reference in New Issue
Block a user