Skip to content

Commit

Permalink
Typos after v1.10.0, setuptools_scm (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
prisae committed Oct 22, 2019
1 parent 6a51330 commit 30c5f23
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 96 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
__pycache__/

# Sphinx
_build/
docs/_build/

# Pytest and coverage related
htmlcov
.coverage
.coverage.*
.pytest_cache/

# setuptools_scm
empymod/version.py

# Build related
.eggs/
build/
dist/
empymod.egg-info/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ install:
# Install and activate environment, install packages
- conda create -q -n test-environment -c $CHAN python=$PYTHON numpy scipy pytest pytest-cov $PCKGS
- source activate test-environment
- pip install coveralls pytest-flake8 $INST
- pip install setuptools_scm coveralls pytest-flake8 $INST
- python setup.py install
- cp tests/matplotlibrc .

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ Changelog
#########


v1.10.1: setuptools_scm
-----------------------

**2019-10-22**

- Typos from v1.10.0; update example in ``model.loop``.
- Implement ``setuptools_scm`` for versioning (adds git hashes for
dev-versions).


v1.10.0: Loop source and receiver
---------------------------------

Expand Down
101 changes: 48 additions & 53 deletions MAINTENANCE.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Maintainers Guide
=================

A release is currently done completely manually, no automatic deployment is
set up.
Releases of ``empymod`` are currently done manually. This is the 'recipe'.


Making a release
Expand All @@ -11,85 +10,81 @@ Making a release
1. Update:

- ``CHANGELOG``
- ``setup.py``: Version number, download url; DO NOT CHANGE THAT
- ``empymod/__init__.py``: Check version number, remove '.dev?'.
- ``README.md``: Remove all badges
- ``empymod/__init__.py``: Update version number.

2. Check syntax of README::
2. Remove any old stuff (just in case)::

python setup.py --long-description | rst2html.py --no-raw > index.html
rm -rf build/ dist/ empymod.egg-info/

3. Remove any old stuff (just in case)::
3. Push it to GitHub, create a release tagging it

rm -rf build/ dist/ empymod.egg-info/
4. Get the Zenodo-DOI and add it to release notes

4. Push it to GitHub, create a release tagging it
5. Create tar and wheel::

5. Get the Zenodo-DOI and add it to release notes
python setup.py sdist
python setup.py bdist_wheel

6. Ensure ``python3-setuptools`` is installed::
6. Push it to PyPi (requires ~/.pypircs)::

sudo apt install python3-setuptools
~/anaconda3/bin/twine upload dist/*

7. Create tar and wheel::
7. conda build

python setup.py sdist
python setup.py bdist_wheel
Has to be done outside of ~/, because conda skeleton cannot handle, at the
moment, the encrypted home
(https://conda.io/docs/build_tutorials/pkgs.html).

8. Test it on testpypi (requires ~/.pypirc)::

~/anaconda3/bin/twine upload dist/* -r testpypi
1. Install miniconda in /opt::

Optionally test it already in conda if skeleton builds::
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p /opt/miniconda/miniconda
export PATH="/opt/miniconda/miniconda/bin:$PATH"
conda update conda
conda install -y conda-build anaconda-client
conda config --set anaconda_upload yes
anaconda login

conda skeleton pypi --pypi-url https://test.pypi.io/pypi/ empymod
2. Now to the conda-build part::

9. Push it to PyPi (requires ~/.pypircs)::
conda skeleton pypi empymod
conda build --python 3.5 empymod
conda build --python 3.6 empymod
conda build --python 3.7 empymod

~/anaconda3/bin/twine upload dist/*
3. Convert for all platforms::

10. conda build
conda convert --platform all /opt/miniconda/miniconda/conda-bld/linux-64/empymod-[version]-py35_0.tar.bz2
conda convert --platform all /opt/miniconda/miniconda/conda-bld/linux-64/empymod-[version]-py36_0.tar.bz2
conda convert --platform all /opt/miniconda/miniconda/conda-bld/linux-64/empymod-[version]-py37_0.tar.bz2

Has to be done outside of ~/, because conda skeleton cannot handle, at the
moment, the encrypted home
(https://conda.io/docs/build_tutorials/pkgs.html).
4. Upload them::

anaconda upload osx-64/*
anaconda upload win-*/*
anaconda upload linux-32/*

1. Install miniconda in /opt::
5. Logout::

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p /opt/miniconda/miniconda
export PATH="/opt/miniconda/miniconda/bin:$PATH"
conda update conda
conda install -y conda-build anaconda-client
conda config --set anaconda_upload yes
anaconda login
anaconda logout

2. Now to the conda-build part::

conda skeleton pypi empymod
conda build --python 3.5 empymod
conda build --python 3.6 empymod
conda build --python 3.7 empymod
Useful things
-------------

3. Convert for all platforms::
- If unsure, test it first on testpypi (requires ~/.pypirc)::

conda convert --platform all /opt/miniconda/miniconda/conda-bld/linux-64/empymod-[version]-py35_0.tar.bz2
conda convert --platform all /opt/miniconda/miniconda/conda-bld/linux-64/empymod-[version]-py36_0.tar.bz2
conda convert --platform all /opt/miniconda/miniconda/conda-bld/linux-64/empymod-[version]-py37_0.tar.bz2
~/anaconda3/bin/twine upload dist/* -r testpypi

4. Upload them::
- If unsure, test the test-pypi for conda if the skeleton builds::

anaconda upload osx-64/*
anaconda upload win-*/*
anaconda upload linux-32/*
conda skeleton pypi --pypi-url https://test.pypi.io/pypi/ empymod

5. Logout::
- If there were changes to README, check it with::

anaconda logout
python setup.py --long-description | rst2html.py --no-raw > index.html

10. Post-commit changes
- If it fails, you might have to install ``python3-setuptools``::

- ``setup.py``: Bump number, add '.dev0' to version number
- ``empymod/__init__.py``: Bump number, add '.dev0' to version number
- ``README.md``: Add the current badges (|docs| |tests| |coverage|)
sudo apt install python3-setuptools
3 changes: 1 addition & 2 deletions docs/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ If you prefer to contact me outside of GitHub use the contact form on my
personal website, https://werthmuller.org.
To install empymod from source, you can download the latest version from GitHub
and either add the path to ``empymod`` to your python-path variable, or install
it in your python distribution via:
and install it in your python distribution via:
.. code-block:: console
Expand Down
14 changes: 13 additions & 1 deletion empymod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,16 @@
'DigitalFilter']

# Version
__version__ = '1.10.1dev0'
try:
# - Released versions just tags: v1.10.0;
# - GitHub commits add 'dev#'+hash: 1.10.1.dev3+g973038c;
# - Uncommited changes add timestamp: 1.10.1.dev3+g973038c.d20191022.
from .version import version as __version__
except ImportError:
# If used without using setup.py or without the .git-directory, or using
# the Git or Zenodo zip-files or other unthought of ways of using it, we
# provide here the last stable released version number, with a '-hc' for
# hard-coded.
# So v1.10.0-hc is most likely v1.10.0, but it can be anything between
# v1.10.0 and v1.10.1.
__version__ = '1.10.1-hc'
65 changes: 32 additions & 33 deletions empymod/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def bipole(src, rec, depth, res, freqtime, signal=None, aniso=None,
>>> from empymod import bipole
>>> # x-directed bipole source: x0, x1, y0, y1, z0, z1
>>> src = [-50, 50, 0, 0, 100, 100]
>>> # x-directed dipole source-array: x, y, z, azimuth, dip
>>> # x-directed dipole receiver-array: x, y, z, azimuth, dip
>>> rec = [np.arange(1, 11)*500, np.zeros(10), 200, 0, 0]
>>> # layer boundaries
>>> depth = [0, 300, 1000, 1050]
Expand Down Expand Up @@ -1246,60 +1246,59 @@ def loop(src, rec, depth, res, freqtime, signal=None, aniso=None, epermH=None,
--------
>>> import numpy as np
>>> from empymod import loop
>>> # x-directed bipole source: x0, x1, y0, y1, z0, z1
>>> src = [-50, 50, 0, 0, 100, 100]
>>> # x-directed dipole source-array: x, y, z, azimuth, dip
>>> rec = [np.arange(1, 11)*500, np.zeros(10), 200, 0, 0]
>>> # z-directed loop source: x, y, z, azimuth, dip
>>> src = [0, 0, 0, 0, 90]
>>> # z-directed magnetic dipole receiver-array: x, y, z, azimuth, dip
>>> rec = [np.arange(1, 11)*500, np.zeros(10), 200, 0, 90]
>>> # layer boundaries
>>> depth = [0, 300, 1000, 1050]
>>> depth = [0, 300, 500]
>>> # layer resistivities
>>> res = [1e20, .3, 1, 50, 1]
>>> res = [2e14, 10, 500, 10]
>>> # Frequency
>>> freq = 1
>>> # Calculate electric field due to an electric source at 1 Hz.
>>> # Calculate magnetic field due to a loop source at 1 Hz.
>>> # [mrec = True (default)]
>>> EMfield = bipole(src, rec, depth, res, freq, verb=4)
>>> EMfield = loop(src, rec, depth, res, freq, verb=4)
:: empymod START ::
~
depth [m] : 0 300 1000 1050
res [Ohm.m] : 1E+20 0.3 1 50 1
aniso [-] : 1 1 1 1 1
epermH [-] : 1 1 1 1 1
epermV [-] : 1 1 1 1 1
mpermH [-] : 1 1 1 1 1
mpermV [-] : 1 1 1 1 1
depth [m] : 0 300 500
res [Ohm.m] : 2E+14 10 500 10
aniso [-] : 1 1 1 1
epermH [-] : 1 1 1 1
epermV [-] : 1 1 1 1
mpermH [-] : 1 1 1 1
mpermV [-] : 1 1 1 1
direct field : Calc. in wavenumber domain
frequency [Hz] : 1
Hankel : DLF (Fast Hankel Transform)
> Filter : Key 201 (2009)
> DLF type : Standard
Kernel Opt. : None
Loop over : None (all vectorized)
Source(s) : 1 bipole(s)
> intpts : 1 (as dipole)
> length [m] : 100
> x_c [m] : 0
> y_c [m] : 0
> z_c [m] : 100
Source(s) : 1 dipole(s)
> x [m] : 0
> y [m] : 0
> z [m] : 0
> azimuth [°] : 0
> dip [°] : 0
> dip [°] : 90
Receiver(s) : 10 dipole(s)
> x [m] : 500 - 5000 : 10 [min-max; #]
: 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
> y [m] : 0 - 0 : 10 [min-max; #]
: 0 0 0 0 0 0 0 0 0 0
> z [m] : 200
> azimuth [°] : 0
> dip [°] : 0
Required ab's : 11
~
:: empymod END; runtime = 0:00:00.005536 :: 1 kernel call(s)
> dip [°] : 90
Required ab's : 33
~
:: empymod END; runtime = 0:00:00.005025 :: 1 kernel call(s)
>>> print(EMfield)
[ 1.68809346e-10 -3.08303130e-10j -8.77189179e-12 -3.76920235e-11j
-3.46654704e-12 -4.87133683e-12j -3.60159726e-13 -1.12434417e-12j
1.87807271e-13 -6.21669759e-13j 1.97200208e-13 -4.38210489e-13j
1.44134842e-13 -3.17505260e-13j 9.92770406e-14 -2.33950871e-13j
6.75287598e-14 -1.74922886e-13j 4.62724887e-14 -1.32266600e-13j]
[ -3.05449848e-10 -2.00374185e-11j -7.12528991e-11 -5.37083268e-12j
-2.52076501e-11 -1.62732412e-12j -1.18412295e-11 -8.99570998e-14j
-6.44054097e-12 +5.61150066e-13j -3.77109625e-12 +7.89022722e-13j
-2.28484774e-12 +8.08897623e-13j -1.40021365e-12 +7.32151174e-13j
-8.55487532e-13 +6.18402706e-13j -5.15642408e-13 +4.99091919e-13j]
"""

Expand Down Expand Up @@ -1372,7 +1371,7 @@ def loop(src, rec, depth, res, freqtime, signal=None, aniso=None, epermH=None,
# Get this source
srcazmdip = get_azm_dip(src, isz, nsrcz, 1, srcdipole, strength,
'src', verb)
tsrc, srcazm, srcdip, srcg_w, _, src_w = srcazmdip
tsrc, srcazm, srcdip, _, _, src_w = srcazmdip

for irz in range(nrecz): # Loop over receiver depths

Expand Down
6 changes: 6 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
numpy
scipy >= 1.0.0
sphinx
sphinxcontrib-napoleon
numpydoc >= 0.9
setuptools_scm
3 changes: 0 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
numpy
scipy >= 1.0.0
sphinx
sphinxcontrib-napoleon
numpydoc >= 0.9
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# -*- coding: utf-8 -*-
import os
import re
from setuptools import setup

# Get README and remove badges.
readme = open('README.rst').read()
readme = re.sub('----.*marker', '----', readme, flags=re.DOTALL)

description = 'Open-source full 3D electromagnetic modeller for 1D VTI media'

setup(
name='empymod',
version='1.10.1.dev0',
description=description,
long_description=readme,
author='The empymod Developers',
author_email='dieter@werthmuller.org',
url='https://empymod.github.io',
download_url='https://github.com/empymod/empymod/tarball/v1.10.0',
license='Apache License V2.0',
packages=['empymod', 'empymod.scripts'],
classifiers=[
Expand All @@ -27,4 +29,10 @@
'numpy',
'scipy>=1.0.0',
],
use_scm_version={
'root': '.',
'relative_to': __file__,
'write_to': os.path.join('empymod', 'version.py'),
},
setup_requires=['setuptools_scm'],
)

0 comments on commit 30c5f23

Please sign in to comment.