Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Boeckenhoff
tfields
Commits
3a96a4f5
Commit
3a96a4f5
authored
Oct 11, 2020
by
dboe
Browse files
Update template
parent
2961c4db
Pipeline
#83962
passed with stage
in 36 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
LICENSE.rst
View file @
3a96a4f5
...
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
...
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
Makefile
View file @
3a96a4f5
...
@@ -12,7 +12,8 @@ GITSTATUS = $(shell git status --porcelain)
...
@@ -12,7 +12,8 @@ GITSTATUS = $(shell git status --porcelain)
part
?=
patch
part
?=
patch
test
:
FORCE
test
:
FORCE
flake8 rna tests
flake8 tfields tests
pylint tfields tests
py.test
py.test
coverage
:
coverage
:
...
...
docs/apidoc-template/toc.rst_t
View file @
3a96a4f5
...
@@ -8,4 +8,3 @@ API Documentation
...
@@ -8,4 +8,3 @@ API Documentation
{% for docname in docnames %}
{% for docname in docnames %}
{{ docname }}
{{ docname }}
{%- endfor %}
{%- endfor %}
docs/usage.rst
View file @
3a96a4f5
...
@@ -4,4 +4,4 @@ Usage
...
@@ -4,4 +4,4 @@ Usage
To use tfields in a project::
To use tfields in a project::
>>> import tfields
>>> import tfields
\ No newline at end of file
setup.cfg
View file @
3a96a4f5
...
@@ -13,7 +13,7 @@ search = version='{current_version}'
...
@@ -13,7 +13,7 @@ search = version='{current_version}'
replace = {new_version}
replace = {new_version}
[bumpversion:file:docs/cookiecutter_input.json]
[bumpversion:file:docs/cookiecutter_input.json]
search =
"
package_version
"
:
"
{current_version}
"
search =
'
package_version
'
:
'
{current_version}
'
replace = {new_version}
replace = {new_version}
[metadata]
[metadata]
...
@@ -71,6 +71,7 @@ docs =
...
@@ -71,6 +71,7 @@ docs =
sphinx_rtd_theme>=0.4.3
sphinx_rtd_theme>=0.4.3
test =
test =
flake8
flake8
pylint
pytest
pytest
pytest-cov
pytest-cov
coverage
coverage
...
@@ -88,14 +89,14 @@ exclude_lines =
...
@@ -88,14 +89,14 @@ exclude_lines =
pragma: no cover
pragma: no cover
if False
if False
[coverage:run]
omit =
tfields/plotting/*.py
[flake8]
[flake8]
max-line-length = 99
max-line-length = 99
doctests = True
doctests = True
exclude = .git, .eggs, __pycache__, docs, dist, venv, .tox
exclude = .git, .eggs, __pycache__, docs, dist, venv, .tox
ignore = E203 W503 W504 # wrong flake defaults: see https://github.com/psf/black/issues/315, https://github.com/psf/black/issues/43
[pylint.]
ignore = setup.py
[build_sphinx]
[build_sphinx]
builder = html,man
builder = html,man
...
@@ -113,6 +114,7 @@ skip_missing_interpreters = true
...
@@ -113,6 +114,7 @@ skip_missing_interpreters = true
envlist =
envlist =
py{35,36,37,38}
py{35,36,37,38}
recreate = true
recreate = true
usedevelop = true
[gh-actions]
[gh-actions]
python =
python =
...
@@ -131,7 +133,6 @@ commands =
...
@@ -131,7 +133,6 @@ commands =
pytest \
pytest \
--cov={[metadata]name} \
--cov={[metadata]name} \
--ignore=docs \
--ignore=docs \
--ignore=tfields/plotting \
--junitxml=report/junit.xml
--junitxml=report/junit.xml
[testenv:flake8]
[testenv:flake8]
...
...
setup.py
View file @
3a96a4f5
from
setuptools
import
setup
from
setuptools
import
setup
setup
(
version
=
'
0.3.2
'
)
setup
(
version
=
"
0.3.2
"
)
tests/test_package.py
View file @
3a96a4f5
...
@@ -3,9 +3,10 @@
...
@@ -3,9 +3,10 @@
"""Tests for `tfields` package."""
"""Tests for `tfields` package."""
import
unittest
import
unittest
import
tfields
class
Test
_tfields
(
unittest
.
TestCase
):
class
Test
Package
(
unittest
.
TestCase
):
"""Tests for `tfields` package."""
"""Tests for `tfields` package."""
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -16,5 +17,5 @@ class Test_tfields(unittest.TestCase):
...
@@ -16,5 +17,5 @@ class Test_tfields(unittest.TestCase):
def
test_version_type
(
self
):
def
test_version_type
(
self
):
"""Assure that version type is str."""
"""Assure that version type is str."""
import
tfields
self
.
assertIsInstance
(
tfields
.
__version__
,
str
)
self
.
assertIsInstance
(
tfields
.
__version__
,
str
)
tfields/__main__.py
View file @
3a96a4f5
...
@@ -8,49 +8,64 @@ import tfields
...
@@ -8,49 +8,64 @@ import tfields
class
SomeAction
(
argparse
.
Action
):
class
SomeAction
(
argparse
.
Action
):
"""Some actions."""
def
__init__
(
self
,
option_strings
,
dest
,
nargs
=
None
,
**
kwargs
):
def
__init__
(
self
,
option_strings
,
dest
,
nargs
=
None
,
**
kwargs
):
if
nargs
is
not
None
:
if
nargs
is
not
None
:
raise
ValueError
(
"nargs not allowed"
)
raise
ValueError
(
"nargs not allowed"
)
super
().
__init__
(
option_strings
,
dest
,
**
kwargs
)
super
().
__init__
(
option_strings
,
dest
,
**
kwargs
)
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
print
(
"Example action invoked by manage in namespace: %r with values %r"
print
(
" and option string %r"
%
(
namespace
,
values
,
option_string
))
"Example action invoked by manage in namespace: %r with values %r"
" and option string %r"
%
(
namespace
,
values
,
option_string
)
)
setattr
(
namespace
,
self
.
dest
,
values
)
setattr
(
namespace
,
self
.
dest
,
values
)
def
showcase_dummy
(
self
):
"""
You can define a method to expose functionality of the class
"""
print
(
self
)
def
manage
(
args
):
def
manage
(
args_
):
"""Example function."""
print
(
"Managing!"
)
print
(
"Managing!"
)
print
(
args
.
x
*
args
.
y
)
print
(
args
_
.
x
*
args
_
.
y
)
def
parse_args
(
args
):
def
parse_args
(
args_
):
"""Parse args."""
# create the top-level parser
# create the top-level parser
parser
=
argparse
.
ArgumentParser
(
prog
=
'tfields app'
)
parser
=
argparse
.
ArgumentParser
(
prog
=
"tfields app"
)
parser
.
add_argument
(
'--version'
,
action
=
'version'
,
parser
.
add_argument
(
version
=
'v'
+
tfields
.
__version__
,
"--version"
,
help
=
"Show program's version number and exit"
)
action
=
"version"
,
parser
=
argparse
.
ArgumentParser
(
prog
=
'tfields app'
)
version
=
"v"
+
tfields
.
__version__
,
help
=
"Show program's version number and exit"
,
)
parser
=
argparse
.
ArgumentParser
(
prog
=
"tfields app"
)
# subparsers
# subparsers
subparsers
=
parser
.
add_subparsers
(
help
=
'
sub-command help
'
)
subparsers
=
parser
.
add_subparsers
(
help
=
"
sub-command help
"
)
# create the parser for the "test" command
# create the parser for the "test" command
example_sub_parser
=
subparsers
.
add_parser
(
'
manage
'
,
help
=
'
manage something
'
)
example_sub_parser
=
subparsers
.
add_parser
(
"
manage
"
,
help
=
"
manage something
"
)
example_sub_parser
.
add_argument
(
'
-x
'
,
type
=
int
,
default
=
1
)
example_sub_parser
.
add_argument
(
"
-x
"
,
type
=
int
,
default
=
1
)
example_sub_parser
.
add_argument
(
'
-y
'
,
type
=
float
,
default
=
42.
)
example_sub_parser
.
add_argument
(
"
-y
"
,
type
=
float
,
default
=
42.
0
)
example_sub_parser
.
set_defaults
(
func
=
manage
)
example_sub_parser
.
set_defaults
(
func
=
manage
)
# If no arguments were used, print base-level help with possible commands.
# If no arguments were used, print base-level help with possible commands.
if
len
(
args
)
==
0
:
if
len
(
args
_
)
==
0
:
parser
.
print_help
(
file
=
sys
.
stderr
)
parser
.
print_help
(
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
args
=
parser
.
parse_args
(
args
)
args
_
=
parser
.
parse_args
(
args
_
)
# let argparse do the job of calling the appropriate function after
# let argparse do the job of calling the appropriate function after
# argument parsing is complete
# argument parsing is complete
args
.
func
(
args
)
return
args
_
.
func
(
args
_
)
if
__name__
==
'
__main__
'
:
if
__name__
==
"
__main__
"
:
args
=
parse_args
(
sys
.
argv
[
1
:])
_
=
parse_args
(
sys
.
argv
[
1
:])
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment