Skip to content

Commit

Permalink
migrate to poetry (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop committed Jan 23, 2019
1 parent 76247d3 commit 968806d
Show file tree
Hide file tree
Showing 13 changed files with 1,048 additions and 71 deletions.
16 changes: 11 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ matrix:
script:
- make start_dev_env
- make $TESTS
before_deploy:
- pip install poetry
- poetry config http-basic.pypi $PYPI_USER $PYPI_PASSWORD
- poetry build
deploy:
provider: pypi
user: dbarroso
password:
secure: kUJVNxWPy2J1LrB3Mu7uo4iDBLYFuNNZhUCgrueJy1hQJOQc2W7+RE3h2gKV/TmCOEDaXZxE8uN9GVX5TqJqFvycu6F1YUkhsgIg8ocKOtrpNqGWOnA7xCC9HN7V75xiTgtbkUadmlr+ui72FqSfryvO+hwmqgEeSbBK/tP9mHhB906CueGr1SZ8pSeJlvgqeiyqL/nTy3bvCi+sQdAjeXh2+sFvVMwcLgN4cYXcjNu3UD1YNJIZfUogbHvATmDRQtPYctIgDuwWRpzltVDnahhwP1zxIGFVIyW/BVsuQHtb3sNzt9WjdFmqLp927rBxEMJBoYYkK7kwOk94FLdazI/KpQGGLusGzhCSghrDzLcKRAoGv7ZrT65M6E/cmjLD9LcqmcLCqK19OlI66scbg3hn7nl9kLZ3UhqqMQOr51nK6dKBxXe0Fpzsy7V8p4WhLCg9BSTb1Bu6FNZvzNh+qovvC3hA2Gz0SUelEpf3STdeihgcbjlkVm6lz8b5/5ZhNTiF+bE2kNChchOrHg3ki5/yMV6KTmV3Gsd89GCQbAFB9vQwa981ZUnIfpapg5vLkW3uHfafrVadK+AyPYJ9rsWRmQ0MG9dCF4DeersqcVz7Aw8WFipC8kzr6SG91T8F8+okzBM7x8vX4S9/52HCa2aFKADHmyqtLpFvHaRkOsE=
provider: script
script: poetry publish
on:
tags: true
branch: master
condition: "$TRAVIS_PYTHON_VERSION == 3.7"
after_success:
- coveralls
env:
global:
- secure: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76muzsdsNafXqOU9vBUe6WnV3GYqYOmvVGTNOB0aG21aRQojY6xwOfj+aVkZa74nwpt4VbrP3AupMDIiMmpX7VOynoCvHoA6XOSi0687XtCwqG32IedDb61AaThB89LBjWm/18UElFAw51V6hG0XovAUdceehSOTpZL1NEtBDBTvJD4/wUnQ8cbnbfqnwxDUWkZB/DEnfwFLL33zwPVdx4fdD1VgeMD2vdpm1e8cIRB7qFhb7YRDhVEGOGtyWRvWbw92sjY+SD2q4UJ95KA6KzOkuSHVbbnC4YzWQ2I=
19 changes: 19 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,25 @@ Setting up your environment

In order to run tests locally you need to have `Docker <https://docs.docker.com/install/>`_ and `docker-compose <https://docs.docker.com/compose/>`_ installed.

Updating dependencies
---------------------

Nornir dependencies are managed by `poetry <https://github.com/sdispater/poetry>`_. The guidelines to pin dependencies are:

1. For the application dependencies:
a. if semver is supported we pin to major release
b. if semver is not supported we pin to specific version
2. For development:
a. black is pinned to a specific version
b. everything is set to *

Then, to update them:

1. PRs can't update dependencies, if development or application dependencies need to be updated we will have a dedicated PR
2. Prior to a release we will update dependencies

These guidelines are not set in stone and can be changed or broken if there is a compelling reason.

Starting development environment
--------------------------------

Expand Down
12 changes: 8 additions & 4 deletions Dockerfile.tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ FROM python:${PYTHON}-stretch

RUN apt-get update && apt-get install -y pandoc


RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python && \
/root/.poetry/bin/poetry config settings.virtualenvs.create false

ADD poetry.lock /tmp
ADD pyproject.toml /tmp
RUN cd /tmp && /root/.poetry/bin/poetry install

ADD docs/requirements.txt /tmp/requirements-docs.txt
RUN pip install -r /tmp/requirements-docs.txt

ADD requirements.txt /tmp/
ADD requirements-dev.txt /tmp/
RUN pip install -r /tmp/requirements-dev.txt

WORKDIR "/nornir"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enter-container:
.PHONY: pytest
pytest:
${DOCKER_COMPOSE} \
run nornir py.test --cov=nornir --cov-report=term-missing -vs ${ARGS}
run nornir pytest --cov=nornir --cov-report=term-missing -vs ${ARGS}

.PHONY: black
black:
Expand All @@ -54,7 +54,7 @@ mypy:

.PHONY: _nbval_docker
_nbval_docker:
pip install .
/root/.poetry/bin/poetry install
pytest --nbval \
docs/plugins \
docs/howto \
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Please note that Nornir requires Python 3.6 or higher. Install Nornir with pip.
pip install nornir
```

Development version
-------------------

If you want to clone the repo and install it from there you will need to use [poetry](https://github.com/sdispater/poetry).

Documentation
=============

Expand Down
17 changes: 12 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

from jinja2 import Environment, FileSystemLoader

import toml

sys.path.insert(0, os.path.abspath("../"))

from nornir.core.deserializer.configuration import Config # noqa
from nornir.version import __version__ # noqa


# -- General configuration ------------------------------------------------
BASEPATH = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -60,11 +60,18 @@
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#


def extract_version():
with open("../pyproject.toml") as f:
parsed_toml = toml.loads(f.read())
return parsed_toml["tool"]["poetry"]["version"]


# The short X.Y version.
version = __version__
version = extract_version()
# The full version, including alpha/beta/rc tags.
release = __version__
release = extract_version()

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ future
jinja2
# netaddr
pyYAML
toml
1 change: 0 additions & 1 deletion nornir/version.py

This file was deleted.

0 comments on commit 968806d

Please sign in to comment.