Skip to content

Commit

Permalink
a9 pre release (#5)
Browse files Browse the repository at this point in the history
* doc/readme housekeeping
* add 3.10 to ci
* make tests not a package, make it more in line w/ scrapli core
* adding release branch creation to publish process
* bump pins
* regen integration sessions after minor lab updates, bump pins
* 3.10 classifier
  • Loading branch information
carlmontanari authored May 29, 2021
1 parent 9a25a1c commit ff4c670
Show file tree
Hide file tree
Showing 128 changed files with 2,264 additions and 2,091 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
build_posix:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 9
max-parallel: 12
matrix:
os: [ubuntu-latest, macos-latest]
version: [3.6, 3.7, 3.8, 3.9]
version: [3.6, 3.7, 3.8, 3.9, 3.10.0-beta.1]
steps:
- uses: actions/checkout@v2
- name: set up python ${{ matrix.version }}
Expand All @@ -42,11 +42,6 @@ jobs:
# version we are targeting with nox, while still having versions like 3.9.0a4
run: |
echo "FRIENDLY_PYTHON_VERSION=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")" >> $GITHUB_ENV
- name: install libxml2 and libxslt seems to only be needed for 3.9 image for some reason
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.9'
run: |
sudo apt install libxml2-dev
sudo apt install libxslt-dev
- name: setup test env
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ jobs:
run: |
python setup.py sdist bdist_wheel
python -m twine upload dist/*
- name: create release branch
uses: peterjgrainger/action-create-branch@v2.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: ${{ github.event.release.tag_name }}
10 changes: 2 additions & 8 deletions .github/workflows/weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- cron: '0 10 * * 0'
workflow_dispatch:

# in the future make this just call the commit workflow, but right now looks a little hacky to do in actions
jobs:
darglint:
runs-on: ${{ matrix.os }}
Expand All @@ -32,10 +31,10 @@ jobs:
build_posix:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 9
max-parallel: 12
matrix:
os: [ubuntu-latest, macos-latest]
version: [3.6, 3.7, 3.8, 3.9]
version: [3.6, 3.7, 3.8, 3.9, 3.10.0-beta.1]
steps:
- uses: actions/checkout@v2
- name: set up python ${{ matrix.version }}
Expand All @@ -47,11 +46,6 @@ jobs:
# version we are targeting with nox, while still having versions like 3.9.0a4
run: |
echo "FRIENDLY_PYTHON_VERSION=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")" >> $GITHUB_ENV
- name: install libxml2 and libxslt seems to only be needed for 3.9 image for some reason
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.9'
run: |
sudo apt install libxml2-dev
sudo apt install libxslt-dev
- name: setup test env
run: |
python -m pip install --upgrade pip
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ scrapli_cfg
scrapli_cfg makes merging or replacing device configurations over Telnet or SSH easy, all while giving you the
scrapli behaviour you know and love.

*NOTE* this is still a work in progress, the first "official" release will be 2021.07.30... until then there will be
pre-releases made for that date.


#### Key Features:

Expand Down
4 changes: 0 additions & 4 deletions docs/generate/generate_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
"path": "platform/core/cisco_iosxe/patterns",
"content": None,
},
"scrapli_cfg.platform.core.cisco_iosxe.types": {
"path": "platform/core/cisco_iosxe/types",
"content": None,
},
"scrapli_cfg.platform.core.cisco_iosxr.async_platform": {
"path": "platform/core/cisco_iosxr/async_platform",
"content": None,
Expand Down
11 changes: 1 addition & 10 deletions docs/user_guide/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ device. You can create your connection object directly from the appropriate scra
`conn` object (scrapli connection object). A simple example of creating a scrapli_cfg object by both methods is below:

```python

from scrapli import Scrapli
from scrapli_cfg.platform.core.cisco_iosxe import ScrapliCfgIOSXE
from scrapli_cfg import ScrapliCfg
Expand Down Expand Up @@ -52,7 +51,7 @@ The other remaining primary arguments are as follows:
accept `cls` as the first argument which is a reference to the scrapli-cfg object itself (and thus has access to
the underlying scrapli connection). More on this in the [`on_prepare` section](#on-prepare).
- `dedicated_connection`: If `False` (default value) scrapli cfg will not open or close the underlying scrapli
connection and will raise an exception if the scrapli connection is not open. If `True` will automatically open
connection and will raise an exception if the scrapli connection is not open. If `True` it will automatically open
and close the scrapli connection when using with a context manager, `prepare` will open the scrapli connection (if
not already open), and `close` will close the scrapli connection.
- `ignore_version`: Ignore checking device version support; currently this just means that scrapli-cfg will not
Expand Down Expand Up @@ -87,7 +86,6 @@ needs in order to manage the configurations.
A simple example of fetching and printing the device version:

```python

from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg

Expand Down Expand Up @@ -115,7 +113,6 @@ like to get -- generally this will be either "startup" or "running".
A simple example of fetching and printing the device startup configuration:

```python

from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg

Expand Down Expand Up @@ -145,7 +142,6 @@ as `get_config`, just resulting in fetching a checkpoint file. Some details abou
A simple example of fetching and printing a checkpoint file from an NXOS device:

```python

from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg

Expand Down Expand Up @@ -175,7 +171,6 @@ If `replace` is `False` (default) then the config will be loaded as a *merge* ca
as a full *replace* candidate.

```python

from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg

Expand Down Expand Up @@ -207,7 +202,6 @@ candidate config/delete config sessions used to load the config.


```python

from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg

Expand Down Expand Up @@ -236,7 +230,6 @@ with Scrapli(**device) as conn:
If you've loaded a config and want to save/commit it you can do so with the `commit_config` method:

```python

from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg

Expand Down Expand Up @@ -276,7 +269,6 @@ the diff will always show the "full" configuration diff (with colorful output th
You can see each of the diffs like so:

```python

from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg

Expand Down Expand Up @@ -318,7 +310,6 @@ designed to help you with.
Here is an example of using this method:

```python

from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg
from scrapli_cfg.platform.core.arista_eos.patterns import ETHERNET_INTERFACES
Expand Down
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ nav:
- Async Platform: api_docs/platform/core/cisco_iosxe/async_platform.md
- Sync Platform: api_docs/platform/core/cisco_iosxe/sync_platform.md
- Patterns: api_docs/platform/core/cisco_iosxe/patterns.md
- Types: api_docs/platform/core/cisco_iosxe/types.md
- Cisco IOSXR:
- Base Platform: api_docs/platform/core/cisco_iosxr/async_platform.md
- Async Platform: api_docs/platform/core/cisco_iosxr/async_platform.md
Expand Down
14 changes: 13 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""scrapli_cfg.noxfile"""
import re
import sys
from pathlib import Path
from typing import Dict, List

Expand Down Expand Up @@ -58,9 +59,14 @@ def parse_requirements(dev: bool = True) -> Dict[str, str]:

REQUIREMENTS: Dict[str, str] = parse_requirements(dev=False)
DEV_REQUIREMENTS: Dict[str, str] = parse_requirements(dev=True)
PLATFORM: str = sys.platform
SKIP_LIST: List[str] = [
"unit_tests-darwin-3.10",
"integration_tests-darwin-3.10",
]


@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"])
def unit_tests(session):
"""
Nox run unit tests
Expand All @@ -75,6 +81,9 @@ def unit_tests(session):
N/A
"""
if f"unit_tests-{PLATFORM}-{session.python}" in SKIP_LIST:
return

session.install("-r", "requirements-dev.txt")
session.install(".")
session.run(
Expand Down Expand Up @@ -106,6 +115,9 @@ def integration_tests(session):
N/A
"""
if f"integration_tests-{PLATFORM}-{session.python}" in SKIP_LIST:
return

session.install("-r", "requirements-dev.txt")
session.install(".")
# setting scrapli vrouter -> 1 so that the saved scrapli replay sessions are "correctly"
Expand Down
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
black==21.5b0
black==21.5b1
darglint==1.8.0
isort==5.8.0
mypy==0.812
nox==2020.12.31
pycodestyle==2.7.0
pydocstyle==6.0.0
pydocstyle==6.1.1
pyfakefs==4.4.0
pylama==7.7.1
pylint==2.8.2
pytest-asyncio==0.15.1
pytest-cov==2.11.1
pytest-cov==2.12.0
pytest==6.2.4
scrapli-replay==2021.7.30a4
scrapli-replay==2021.7.30a5
-r requirements-asyncssh.txt
-r requirements-paramiko.txt
-r requirements-ssh2.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mdx-gh-links==0.2
mkdocs==1.1.2
mkdocs-material==7.1.4
mkdocs-material==7.1.5
mkdocs-material-extensions==1.0.1
pdoc3==0.9.2 ; sys_platform != "win32"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
scrapli>=2021.07.30a2
scrapli>=2021.07.30a3
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import setuptools

__version__ = "2021.07.30a8"
__version__ = "2021.07.30a9"
__author__ = "Carl Montanari"

with open("README.md", "r", encoding="utf-8") as f:
Expand Down Expand Up @@ -62,6 +62,7 @@ def get_packages(package):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
],
Expand Down
Empty file removed tests/__init__.py
Empty file.
48 changes: 40 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
from pathlib import Path

import pytest
from devices import CONFIG_REPLACER, DEVICES

import scrapli_cfg

EXPECTED_CONFIG_PATH = f"{Path(scrapli_cfg.__file__).parents[1]}/tests/expected_configs"
EXPECTED_CONFIGS = {
"arista_eos": open(f"{EXPECTED_CONFIG_PATH}/arista_eos").read(),
"cisco_iosxe": open(f"{EXPECTED_CONFIG_PATH}/cisco_iosxe").read(),
"cisco_nxos": open(f"{EXPECTED_CONFIG_PATH}/cisco_nxos").read(),
"cisco_iosxr": open(f"{EXPECTED_CONFIG_PATH}/cisco_iosxr").read(),
"juniper_junos": open(f"{EXPECTED_CONFIG_PATH}/juniper_junos").read(),
}
TEST_DATA_PATH = f"{Path(scrapli_cfg.__file__).parents[1]}/tests/test_data"


@pytest.fixture(scope="session")
def test_data_path():
"""Fixture to provide path to test data files"""
return TEST_DATA_PATH


@pytest.fixture(scope="session")
def test_devices_dict():
"""Fixture to return test devices dict"""
return DEVICES


@pytest.fixture(scope="session")
def expected_configs():
"""Fixture to provide expected configs"""
return {
"arista_eos": open(f"{TEST_DATA_PATH}/expected/arista_eos").read(),
"cisco_iosxe": open(f"{TEST_DATA_PATH}/expected/cisco_iosxe").read(),
"cisco_nxos": open(f"{TEST_DATA_PATH}/expected/cisco_nxos").read(),
"cisco_iosxr": open(f"{TEST_DATA_PATH}/expected/cisco_iosxr").read(),
"juniper_junos": open(f"{TEST_DATA_PATH}/expected/juniper_junos").read(),
}


@pytest.fixture(scope="session")
def test_devices_dict():
"""Fixture to return test devices dict"""
return DEVICES


@pytest.fixture(scope="session")
def config_replacer_dict():
"""Fixture to return dict of config replacer helper functions"""
return CONFIG_REPLACER
Loading

0 comments on commit ff4c670

Please sign in to comment.