Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #30 from s-weigand/make-docs-makefile-python-versi…
Browse files Browse the repository at this point in the history
…on-aware

Make docs makefile python version aware
  • Loading branch information
joernweissenborn committed Jul 24, 2018
2 parents d828c8d + 9394a25 commit 9986f22
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 69 deletions.
89 changes: 45 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,71 +8,65 @@ matrix:
include:
- python: 3.6
env: TOXENV=flake8
before_install:
- echo "before_install"
- python -m pip install -U pip>=9.0.1
- pip install tox
script:
- tox
after_success:
# this prevents the tests to upload stuff to coveralls.io
- echo "done"

- python: 3.6
#taken from https://quick-sphinx-tutorial.readthedocs.io/en/latest/advanced.html
branches:
only:
- master

env: tests-doc-creation
sudo: false
install:
- python -m pip install -U -r requirements_dev.txt
- python setup.py install
# taken from https://quick-sphinx-tutorial.readthedocs.io/en/latest/advanced.html
env: TOXENV=docs
before_install:
- echo "before_install"
- python -m pip install -U pip>=9.0.1
- pip install tox
script:
- cd docs; make clean_all html linkcheck
- tox
after_success:
# this prevents the tests to upload stuff to coveralls.io
- echo "done"

# LINUX
- python: "3.6"
env: TOXENV=py36
env: linux-py36

- python: "3.7-dev" # 3.7 development branch
env: TOXENV=py37
env: linux-py37

# OSX
- language: generic
python: 3.6
env: osx-py36
os: osx
env:
- osx-py36
before_install:
- echo "before_install"
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda update conda -y
- conda create -n py36 python=3.6 -y
install:
- source activate py36
- python -m pip install -U pip>=8.1.2
- pip install tox coveralls
- pip uninstall -y virtualenv
- conda install -y --name py36 virtualenv
- pip freeze
script: tox -e py36
- python -m pip install -U pip>=9.0.1

# - language: generic
# python: 3.7
# env: osx-py37
# os: osx
# before_install:
# - wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
# - bash miniconda.sh -b -p $HOME/miniconda
# - export PATH="$HOME/miniconda/bin:$PATH"
# - conda update conda -y
# - conda create -n py37 python=3.7 -y
# install:
# - source activate py37
# - python -m pip install -U pip>=8.1.2
# - pip install tox coveralls
# - pip uninstall -y virtualenv
# - conda install -y --name py37 virtualenv
# - pip freeze
# script: tox -e py37
- language: generic
python: 3.7
env: osx-py37
os: osx
before_install:
- echo "before_install"
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda update conda -y
- conda create -n py37 python=3.7 -y
- source activate py37
- python -m pip install -U pip>=9.0.1

# - python: 3.6
# env: win_coverage
Expand All @@ -84,15 +78,22 @@ matrix:
# - coveralls
# - coverage erase

before_install:
- echo "before_install"
- python -m pip install -U pip>=9.0.1

install:
- python -m pip install -U pip>=8.1.2
- pip install tox coveralls
- pip install coveralls
- pip install -r requirements_dev.txt

script: tox
script:
- pip install .
- py.test --cov=lmfit_varpro --cov-config .coveragerc tests/
- pip freeze

after_success:
- coveralls
- coverage erase
- coveralls
- coverage erase

notifications:
slack:
Expand Down
18 changes: 6 additions & 12 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ If you are proposing a feature:
Get Started!
------------

Ready to contribute? Here's how to set up `lmfit_varpro` for local development.
Ready to contribute? Here's how to set up `lmfit-varpro` for local development.

1. Fork the `lmfit_varpro` repo on GitHub.
1. Fork the `lmfit-varpro` repo on GitHub.
2. Clone your fork locally::

$git clone git@github.com:your_name_here/lmfit_varpro.git
$git clone git@github.com:your_name_here/lmfit-varpro.git

3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::

Expand All @@ -81,18 +81,12 @@ Ready to contribute? Here's how to set up `lmfit_varpro` for local development.

Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::
5. When you're done making changes, check that your changes pass all tests
(unit tests, codestyle tests and doc creation test)::

$flake8 lmfit_varpro tests
$python setup.py test

..
Hopefully we can soon get all tests running with pytest and tox
$tox
$py.test

To get flake8 and tox, just pip install them into your virtualenv.
To get all requirements run `pip install -r requirements_dev.txt` in your virtualenv.

6. Commit your changes and push your branch to GitHub::

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ Python-lmfit based implementation of variable projection

## Credits

This package was partially created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and
the [audreyr/cookiecutter-pypackage ](https://github.com/audreyr/cookiecutter-pypackage) project template.
The credits can be found in the documentations
`credits section <https://lmfit-varpro.readthedocs.io/en/latest/credits.html>`_
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ build: none
test_script:
# delete old .coverage file
- coverage erase
- tox
- tox -e py36

artifacts:
- path: .coverage
Expand Down
21 changes: 19 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
# Minimal makefile for Sphinx documentation
#
# get the right python version in case someone is using system python
python2_sys_alias=python
python3_sys_alias=python3
IS_PROPER_PYTHON = $(shell $(python2_sys_alias) -c 'from __future__ import print_function;import sys; print(int(sys.version_info >= (3,6)))')
ifeq ("$(IS_PROPER_PYTHON)","1")
PYTHON_TO_USE=$(python2_sys_alias)
.PHONY: which_python
else
IS_PROPER_PYTHON = $(shell $(python3_sys_alias) -c 'from __future__ import print_function;import sys; print(int(sys.version_info >= (3,6)))')
ifeq ("$(IS_PROPER_PYTHON)","1")
PYTHON_TO_USE=$(python3_sys_alias)
.PHONY: which_python
else
$(error You need at least python 3.6 with lmfit-varpro installed to work on lmfit-varpro documentation)
endif
endif


# You can set these variables from the command line.
SPHINXOPTS = -W
SPHINXBUILD = python -msphinx
SPHINXBUILD = $(PYTHON_TO_USE) -msphinx
SPHINXPROJ = glotaran
SOURCEDIR = .
BUILDDIR = _build
Expand All @@ -20,7 +37,7 @@ clean_all:
rm -rf $(API_TOCTREE_DIR)/*

api_docs:
python generate_api_documentation.py
$(PYTHON_TO_USE) generate_api_documentation.py

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Expand Down
7 changes: 7 additions & 0 deletions docs/credits.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Credits
=======

Thanks goes to these projects/peoples work that helped us developing:

* `cookiecutter <https://github.com/audreyr/cookiecutter>`_ (documentation skeleton)
* `audreyr/cookiecutter-pypackage <https://github.com/audreyr/cookiecutter-pypackage>`_ (documentation skeleton)
2 changes: 1 addition & 1 deletion docs/generate_api_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def write_known_packages(child_packages, child_modules,
import lmfit_varpro
PACKAGE_ROOT = lmfit_varpro.__path__[0]
PROJECT_ROOT = os.path.split(PACKAGE_ROOT)[0]
module_imports = traverse_package(PACKAGE_ROOT, PROJECT_ROOT)
module_imports = traverse_package(PACKAGE_ROOT, PACKAGE_ROOT)
child_modules = module_imports["child_modules"]
child_packages = module_imports["child_packages"]

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Welcome to glotaran's documentation!

authors
history
credits

Indices and tables
==================
Expand Down
6 changes: 3 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ You can simply use `pip`_ to install it directly from the `Github repo`_.

.. code-block:: console
$ pip install git+https://github.com/glotaran/lmfit_varpro.git
$ pip install git+https://github.com/glotaran/lmfit-varpro.git
Or you can either clone the public repository:

.. code-block:: console
$ git clone git://github.com/glotaran/lmfit_varpro
$ git clone git://github.com/glotaran/lmfit-varpro
Or download the `tarball`_:

.. code-block:: console
$ curl -OL https://github.com/glotaran/lmfit_varpro/tarball/master
$ curl -OL https://github.com/glotaran/lmfit-varpro/tarball/master
And once you have a copy of the source, you can install it with:

Expand Down
12 changes: 8 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py36, flake8
envlist = py36, flake8, docs


[travis]
Expand All @@ -15,10 +15,14 @@ basepython=python
deps=flake8
commands=flake8 lmfit_varpro tests

[testenv:docs]
deps = -r{toxinidir}/requirements_dev.txt
whitelist_externals = make
commands =
make --directory=docs clean_all html linkcheck

[testenv]
passenv = *
commands =
python -m pip install -q -r {toxinidir}/requirements_dev.txt
py.test --cov=lmfit_varpro --cov-config {toxinidir}/.coveragerc tests/
; coverage run --append -m py.tests --basetemp={envtmpdir} tests/
coverage report --show-missing
py.test --cov=lmfit_varpro --cov-config {toxinidir}/.coveragerc tests/

0 comments on commit 9986f22

Please sign in to comment.