Skip to content

Commit

Permalink
Merge pull request openwisp#55 from AnonGuy/master-pipenv
Browse files Browse the repository at this point in the history
Implement pipenv tasks to openwisp#38
  • Loading branch information
nemesifier authored Nov 5, 2018
2 parents fba9b8f + e3014d1 commit 4ff53c1
Show file tree
Hide file tree
Showing 10 changed files with 667 additions and 60 deletions.
29 changes: 14 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,26 @@ branches:
- master

before_install:
- pip install -U pip wheel setuptools
- pip install --no-cache-dir -U -r requirements-test.txt
- ./runflake8
- ./runisort
- pip install -U pipenv
- pipenv install --dev --skip-lock
- pipenv run pip freeze
- pipenv run lint
- pipenv run isort

install:
- pip install $DJANGO
- pipenv install $DJANGO
# fix issues with travis
- pip install "attrs>=17.4.0"
- pip install "six>=1.11.0"
- python setup.py -q develop
- pipenv install --skip-lock "attrs>=17.4.0"
- pipenv install --skip-lock "six>=1.11.0"
# TODO: temporary, remove when django-netjsonconfig 0.9.0 is released
- pip install https://github.com/openwisp/django-netjsonconfig/tarball/master
- if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]]; then pip install git+git://github.com/tinio/pysqlite.git@extension-enabled#egg=pysqlite; fi
# TODO: temporary, remove when django-x509 is released with the passphrase add-on
- pip install https://github.com/openwisp/django-x509/tarball/master
- if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]]; then pipenv install git+git://github.com/tinio/pysqlite.git@extension-enabled#egg=pysqlite; fi
- pipenv run pip install https://github.com/openwisp/django-x509/tarball/master

script:
# for some reason the migrations check is failing only on django 2.0
- if [[ $TRAVIS_PYTHON_VERSION == 3.4 ]]; then ./tests/manage.py makemigrations config pki --dry-run | grep "No changes detected"; fi
- coverage run --source=openwisp_controller runtests.py
- if [[ $TRAVIS_PYTHON_VERSION == 3.4 ]]; then pipenv run ./tests/manage.py makemigrations config pki --dry-run | grep "No changes detected"; fi
- pipenv run pip freeze
- pipenv run coverage run --source=openwisp_controller runtests.py

after_success:
coveralls
pipenv run coveralls
20 changes: 20 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[source]]
verify_ssl = true
url = "https://pypi.org/simple"
name = "pypi"

[packages]
"e1839a8" = {editable = true, path = "."}
"2e72db2" = {file = "https://github.com/openwisp/django-netjsonconfig/tarball/master"}
"e81041b" = {file = "https://github.com/openwisp/django-x509/tarball/master"}

[dev-packages]
coverage = "*"
coveralls = "*"
isort = "*"
flake8 = "*"

[scripts]
lint = "python -m flake8"
isort = "python -m isort"
test = "python runtests.py"
613 changes: 613 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

22 changes: 8 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ Alternatively you can install via pip using git:
pip install -e git+git://github.com/openwisp/openwisp-controller#egg=openwisp_controller
If you want to contribute, install your cloned fork:
If you want to contribute, install your cloned fork with `pipenv <https://pipenv.readthedocs.io/en/latest/>`_:

.. code-block:: shell
git clone git@github.com:<your_fork>/openwisp-controller.git
cd openwisp_controller
python setup.py develop
pipenv install --dev
Setup (integrate in an existing django project)
-----------------------------------------------
Expand Down Expand Up @@ -203,41 +203,35 @@ Install sqlite:
sudo apt-get install sqlite3 libsqlite3-dev libsqlite3-mod-spatialite openssl libssl-dev
sudo apt-get install gdal-bin libproj-dev libgeos-dev libspatialite-dev
Install your forked repo:
Install your forked repo with `pipenv <https://pipenv.readthedocs.io/en/latest/>`_:

.. code-block:: shell
git clone git://github.com/<your_fork>/openwisp-controller
cd openwisp-controller/
python setup.py develop
Install test requirements:

.. code-block:: shell
pip install -r requirements-test.txt
pipenv install --dev
Create database:

.. code-block:: shell
cd tests/
./manage.py migrate
./manage.py createsuperuser
pipenv run ./manage.py migrate
pipenv run ./manage.py createsuperuser
Launch development server:

.. code-block:: shell
./manage.py runserver 0.0.0.0:8000
pipenv run ./manage.py runserver 0.0.0.0:8000
You can access the admin interface at http://127.0.0.1:8000/admin/.

Run tests with:

.. code-block:: shell
./runtests.py
pipenv run ./runtests.py
Install and run on docker
--------------------------
Expand Down
4 changes: 0 additions & 4 deletions requirements-test.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

4 changes: 0 additions & 4 deletions runflake8

This file was deleted.

3 changes: 0 additions & 3 deletions runisort

This file was deleted.

6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ known_first_party = openwisp_users, openwisp_utils
line_length=110
default_section = THIRDPARTY
skip = migrations
diff = 1
check_only = 1
recursive = 1


[flake8]
# W503: line break before or after operator
# W504: line break after or after operator
# W605: invalid escape sequence
exclude = migrations,./tests/*settings*.py
ignore = W605, W503, W504
max-line-length = 110
22 changes: 6 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@
from openwisp_controller import get_version
from setuptools import find_packages, setup


def get_install_requires():
"""
parse requirements.txt, ignore links, exclude comments
"""
requirements = []
for line in open('requirements.txt').readlines():
# skip to next iteration if comment or empty line
if line.startswith('#') or line == '' or line.startswith('http') or line.startswith('git'):
continue
# add line to requirements
requirements.append(line)
return requirements


if sys.argv[-1] == 'publish':
# delete any *.pyc, *.pyo and __pycache__
os.system('find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf')
Expand Down Expand Up @@ -48,7 +33,12 @@ def get_install_requires():
packages=find_packages(exclude=['tests', 'docs']),
include_package_data=True,
zip_safe=False,
install_requires=get_install_requires(),
install_requires=[
"django-netjsonconfig>=0.8.1,<0.10.0",
"openwisp-utils[users]<0.3",
"django-loci>=0.1.1,<0.3.0",
"djangorestframework-gis>=0.12.0,<0.14.0"
],
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Web Environment',
Expand Down

0 comments on commit 4ff53c1

Please sign in to comment.