Skip to content

Commit

Permalink
remove partial install (napalm-automation#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop authored Nov 24, 2017
1 parent e51aa58 commit 35c8cd2
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 145 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include requirements/*
include requirements*
include napalm/*/templates/*.j2
include napalm/*/utils/textfsm_templates/*.tpl
include napalm/junos/utils/*.yml
36 changes: 0 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,10 @@ You can also watch a [live demo](https://youtu.be/93q-dHC0u0I) of NAPALM to see
Install
=======

Full installation
-----------------

If you want to fully install NAPALM you can do it by executing:

```
pip install napalm
```

That will install all the drivers currently available.


Partial Installation
--------------------

If you want to install just a subset of the available modules you can just pick them as follows:

```
pip install --install-option="ios" napalm
```

To install multiple drivers:
```
pip install --install-option="eos" --install-option="junos" napalm
```

To add drivers to an existing instalation:
```
pip install --install-option="eos" --install-option="junos" --force-reinstall -U napalm
```

Check the ['Supported Network Operating Systems'](#supported-network-operating-systems) section for more information about supported modules.


Upgrading
=========
Expand All @@ -69,13 +40,6 @@ We plan to upgrade napalm as fast as possible. Adding new methods and bugfixes.
pip install napalm -U
```

or:

```
pip install --install-option="eos" --install-option="junos" napalm -U
```


We will be posting news on our slack channel and on Twitter.


Expand Down
28 changes: 1 addition & 27 deletions docs/installation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installation
Full installation
-----------------

If you want to fully install NAPALM you can do it by executing:
You can install napalm with pip:

.. code-block:: bash
Expand All @@ -14,32 +14,6 @@ If you want to fully install NAPALM you can do it by executing:
That will install all the drivers currently available.


Partial Installation
--------------------

If you want to install just a subset of the available modules you can just pick them as follows:

.. code-block:: bash
pip install --install-option="eos" --install-option="junos" napalm
That will install only the ``eos`` and the ``junos`` drivers. If you want to add an extra driver later you can use ``pip --force-reinstall -U`` to do it:

.. code-block:: bash
pip install --install-option="ios" --force-reinstall -U napalm
Note you can pass those options to a requirements file as well:

.. code-block:: bash
# requrements.txt
napalm --install-option="ios" --install-option="eos"
Check the `supported devices`_ section for more information on supported drivers.

Dependencies
------------

Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
future
jtextfsm
jinja2
netaddr
pyYAML
pyeapi
netmiko>=1.4.3
pyIOSXR>=0.51
netmiko>=1.4.3
junos-eznc>=2.1.5
pynxos
netmiko>=1.4.3
scp
6 changes: 0 additions & 6 deletions requirements/all

This file was deleted.

5 changes: 0 additions & 5 deletions requirements/base

This file was deleted.

1 change: 0 additions & 1 deletion requirements/eos

This file was deleted.

1 change: 0 additions & 1 deletion requirements/ios

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/iosxr

This file was deleted.

1 change: 0 additions & 1 deletion requirements/junos

This file was deleted.

3 changes: 0 additions & 3 deletions requirements/nxos

This file was deleted.

65 changes: 5 additions & 60 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,74 +1,19 @@
"""setup.py file."""
import uuid
import os

from distutils.core import Command
from setuptools import setup, find_packages
from setuptools.command import install
from subprocess import check_call


from pip.req import parse_requirements

import pip # noqa: test pip is installed
import sys

__author__ = 'David Barroso <[email protected]>'

# Read SUPPORTED_DRIVERS from file (without importing)
_locals = {}
filename = os.path.join('napalm', '_SUPPORTED_DRIVERS.py')
with open(filename) as supported:
exec(supported.read(), None, _locals)
SUPPORTED_DRIVERS = _locals['SUPPORTED_DRIVERS']


def process_requirements(dep):
print("PROCESSING DEPENDENCIES FOR {}".format(dep))
u = uuid.uuid1()
iter_reqs = parse_requirements("requirements/{}".format(dep), session=u)

for ir in iter_reqs:
check_call([sys.executable, '-m', 'pip', 'install', str(ir.req)])


def custom_command_driver(driver):
class CustomCommand(Command):
"""A custom command to run Pylint on all Python source files."""
user_options = []

def initialize_options(self):
pass
install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
reqs = [str(ir.req) for ir in install_reqs]

def finalize_options(self):
pass

def run(self):
"""Run command."""
process_requirements(driver)

return CustomCommand


class CustomInstall(install.install):
"""A custom command to run Pylint on all Python source files."""

def run(self):
"""Run command."""
if any([d in sys.argv for d in SUPPORTED_DRIVERS]):
process_requirements('base')
else:
process_requirements('all')
install.install.run(self)


custom_commands = {d: custom_command_driver(d) for d in SUPPORTED_DRIVERS}
custom_commands['install'] = CustomInstall
__author__ = 'David Barroso <[email protected]>'

setup(
cmdclass=custom_commands,
name="napalm",
version='2.1.0',
version='2.2.0',
packages=find_packages(exclude=("test*", )),
test_suite='test_base',
author="David Barroso, Kirk Byers, Mircea Ulinic",
Expand All @@ -88,7 +33,7 @@ def run(self):
],
url="https://github.com/napalm-automation/napalm",
include_package_data=True,
install_requires=[],
install_requires=reqs,
entry_points={
'console_scripts': [
'cl_napalm_configure=napalm.base.clitools.cl_napalm_configure:main',
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist = py27,py34,py35,py36

[testenv]
deps =
-rrequirements/all
-rrequirements/dev
-rrequirements.txt
-rrequirements-dev.txt
commands =
py.test

0 comments on commit 35c8cd2

Please sign in to comment.