Skip to content

Commit

Permalink
bump version, merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 15, 2020
2 parents 5715e74 + 04aa0a2 commit 8250dba
Show file tree
Hide file tree
Showing 13 changed files with 135 additions and 204 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
argopt/*.py[co]
argopt/tests/*.py[co]
*.py[co]
# build
argopt.egg-info/
build/
dist/
# test
.tox/
.coverage
__pycache__
__pycache__
102 changes: 75 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,89 @@
# sudo: required
# dist: trusty
language: python
matrix:
env:
global:
- PIP_CACHE_DIR="$HOME/.cache/pip" # unify pip cache location for all platforms
cache:
pip: true
directories:
- $HOME/.cache/pip
before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
notifications:
email: false
stages:
- check
- test
- name: deploy
if: repo = casperdcl/argopt
jobs:
include:
- python: 2.6
- stage: test
name: py2.6
python: 2.6
env: TOXENV=py26
- python: 2.7
dist: trusty
- name: py2.7
python: 2.7
env: TOXENV=py27
- python: 3.4
- name: py3.4
python: 3.4
env: TOXENV=py34
- python: 3.5
- name: py3.5
python: 3.5
env: TOXENV=py35
- python: 3.6
- name: py3.6
python: 3.6
env: TOXENV=py36
- python: 3.7-dev
- name: py3.7
python: 3.7
env: TOXENV=py37
- python: pypy2.7-5.10.0
- name: pypy2.7
python: pypy2.7-5.10.0
env: TOXENV=pypy
- python: pypy3.5-5.10.0
- name: pypy3.5
python: pypy3.5-5.10.0
env: TOXENV=pypy3
- python: 3.6
- stage: check
name: style
python: 3.7
env: TOXENV=flake8
cache:
pip: true
directories:
- $HOME/.cache/pip
before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
notifications:
email: false
- name: setup
python: 3.7
env: TOXENV=setup.py
- stage: deploy
name: PyPI and GitHub
python: 3.7
install:
script:
- pip install .[dev]
- make build
- echo "$GPG_KEY" | base64 --decode > .key.gpg
- gpg --import .key.gpg
- rm .key.gpg
- git log --pretty='format:- %s%n%b---' $(git tag --sort=creatordate | tail -n2 | head -n1)..HEAD > CHANGES.md
deploy:
- provider: script
script: twine upload -s -i casper.dcl@physics.org dist/argopt-*
skip_cleanup: true
on:
tags: true
- provider: releases
api_key: $GITHUB_TOKEN
file_glob: true
file: dist/argopt-*.whl*
skip_cleanup: true
draft: true
name: argopt $TRAVIS_TAG stable
edge: true
tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT
release_notes_file: CHANGES.md
on:
tags: true
before_install:
# fix a crash with multiprocessing on Travis
# - sudo rm -rf /dev/shm
# - sudo ln -s /run/shm /dev/shm
- git fetch --tags
- git fetch --tags
install:
- pip install tox
- pip install .
- pip install tox
- pip install .
script:
- tox
- tox
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
* files: *
MPLv2.0 2015-2018 (c) Casper da Costa-Luis
MPLv2.0 2015-2020 (c) Casper da Costa-Luis
[casperdcl](https://github.com/casperdcl).


Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include tox.ini

# Test suite
recursive-include argopt/tests *.py
include requirements-dev.txt

# Examples/Documentation
recursive-include examples *.py
Expand Down
21 changes: 9 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@
coverclean
prebuildclean
clean
toxclean
installdev
install
build
pypimeta
buildupload
pypi
none

help:
@python setup.py make
@python setup.py make -p

alltests:
@+make testcoverage
Expand All @@ -46,16 +47,16 @@ all:
@+make build

flake8:
@+flake8 --max-line-length=80 --exclude .tox --count --statistics --exit-zero .
@+flake8 -j 8 --count --statistics --exit-zero .

test:
tox --skip-missing-interpreters
tox --skip-missing-interpreters -p all

testnose:
nosetests argopt -d -v

testsetup:
python setup.py check --restructuredtext --strict
python setup.py check --metadata --restructuredtext --strict
python setup.py make none

testcoverage:
Expand Down Expand Up @@ -95,19 +96,15 @@ install:

build:
@make prebuildclean
python setup.py sdist --formats=gztar,zip bdist_wheel
python setup.py bdist_wininst

pypimeta:
python setup.py register
@make testsetup
python setup.py sdist bdist_wheel
# python setup.py bdist_wininst

pypi:
twine upload dist/*

buildupload:
@make testsetup
@make build
@make pypimeta
@make pypi

none:
Expand Down
6 changes: 3 additions & 3 deletions argopt/_argopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@


RE_ARG_ONCE = re.compile(r"(?<!Optional\(|neOrMore\()"
"Argument\('(\S+?)', (\S+?), (\S+?)\)")
r"Argument\('(\S+?)', (\S+?), (\S+?)\)")
RE_ARG_STAR = re.compile(r"Optional\(OneOrMore\(Argument\("
"'(\S+?)', (\S+?), (\S+?)\)\)\)")
r"'(\S+?)', (\S+?), (\S+?)\)\)\)")
RE_ARG_PLUS = re.compile(r"(?<!Optional\()"
"OneOrMore\(Argument\('(\S+?)', (\S+?), (\S+?)\)\)")
r"OneOrMore\(Argument\('(\S+?)', (\S+?), (\S+?)\)\)")
RE_ARG_QEST = re.compile(r"Optional\(Argument\('(\S+?)', (\S+?), (\S+?)\)\)")


Expand Down
13 changes: 6 additions & 7 deletions argopt/_docopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def single_match(self, left):
@classmethod
def parse(class_, argument_description):
name, _, description = argument_description.strip().partition(' ')
matched = re.findall('\[default: (.*)\]', description, flags=re.I)
matched = re.findall(r'\[default: (.*)\]', description, flags=re.I)
value = matched[0] if matched else None
return class_(name, value, description)

Expand Down Expand Up @@ -226,7 +226,7 @@ def parse(class_, option_description):
meta = s[1:-1] if s.startswith('<') and s.endswith('>') else s
argcount = 1
if argcount:
matched = re.findall('\[default: (.*)\]', description, flags=re.I)
matched = re.findall(r'\[default: (.*)\]', description, flags=re.I)
value = matched[0] if matched else None
return class_(short, long, argcount, value, description, meta)

Expand Down Expand Up @@ -254,7 +254,7 @@ def __repr__(self):
class Required(ParentPattern):
def match(self, left, collected=None):
collected = [] if collected is None else collected
l = left
l = left # NOQA
c = collected
for p in self.children:
matched, l, c = p.match(l, c)
Expand All @@ -279,7 +279,7 @@ class OneOrMore(ParentPattern):
def match(self, left, collected=None):
assert len(self.children) == 1
collected = [] if collected is None else collected
l = left
l = left # NOQA
c = collected
l_ = None
matched = True
Expand Down Expand Up @@ -471,9 +471,8 @@ def parse_defaults(doc):
ind = get_indent(doc, optargs=True)
if not ind:
return [], []
#split = re.split('\n (<\S+?>|-\S+?)', doc)[1:]
split = re.split('\n' + ind + '(<\S+?>|[A-Z0-9_]+|-\S+)', doc)[1:]
#print ">>>>>", split, "<<<<<<"
# TODO: split = re.split('\n (<\S+?>|-\S+?)', doc)[1:]
split = re.split('\n' + ind + r'(<\S+?>|[A-Z0-9_]+|-\S+)', doc)[1:]
# strip next sections from descriptions
split = [s1 + s2.split('\n\n')[0]
for s1, s2 in zip(split[::2], split[1::2])]
Expand Down
4 changes: 2 additions & 2 deletions argopt/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__all__ = ["__version__"]

# major, minor, patch, -extra
version_info = 0, 5, 0
version_info = 0, 6, 0

# Nice string for the version
__version__ = '.'.join(map(str, version_info))
Expand All @@ -25,7 +25,7 @@ def commit_hash(*args):
res = _sh('git', 'log', '-n', '1', '--oneline', *args,
stderr=STDOUT).lstrip().split()[0]
return None if res.startswith('fatal') else res
except:
except: # NOQA
return None

cur_hash = commit_hash()
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def main():
(os.path.dirname(__file__), __file__))
raise
args = parser.parse_args()
print (args)
print(args)


if __name__ == '__main__':
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
py-make>=0.1.0 # setup.py make/pymake
twine # pymake pypi
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[bdist_wheel]
universal = 1

[flake8]
max_line_length = 80
exclude = .asv,.tox,.ipynb_checkpoints,build,dist,.git,__pycache__
Loading

0 comments on commit 8250dba

Please sign in to comment.