-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
327 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[paths] | ||
source = | ||
src | ||
*/site-packages | ||
|
||
[run] | ||
branch = true | ||
source = | ||
jupyter_analysis_tools | ||
tests | ||
parallel = true | ||
|
||
[report] | ||
show_missing = true | ||
precision = 2 | ||
omit = *migrations* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
graft docs | ||
graft src | ||
graft ci | ||
graft tests | ||
|
||
include .coveragerc | ||
include .editorconfig | ||
include .pre-commit-config.yaml | ||
include tbump.toml | ||
include tox.ini | ||
|
||
include AUTHORS.rst | ||
include CHANGELOG.rst | ||
include CONTRIBUTING.rst | ||
include LICENSE | ||
include README.rst | ||
|
||
global-exclude *.py[cod] __pycache__/* *.so *.dylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
from os.path import abspath | ||
from os.path import dirname | ||
from os.path import exists | ||
from os.path import join | ||
from os.path import relpath | ||
|
||
base_path = dirname(dirname(abspath(__file__))) | ||
templates_path = join(base_path, "ci", "templates") | ||
|
||
|
||
def check_call(args): | ||
print("+", *args) | ||
subprocess.check_call(args) | ||
|
||
|
||
def exec_in_env(): | ||
env_path = join(base_path, ".tox", "bootstrap") | ||
if sys.platform == "win32": | ||
bin_path = join(env_path, "Scripts") | ||
else: | ||
bin_path = join(env_path, "bin") | ||
if not exists(env_path): | ||
import subprocess | ||
|
||
print("Making bootstrap env in: {0} ...".format(env_path)) | ||
try: | ||
check_call([sys.executable, "-m", "venv", env_path]) | ||
except subprocess.CalledProcessError: | ||
try: | ||
check_call([sys.executable, "-m", "virtualenv", env_path]) | ||
except subprocess.CalledProcessError: | ||
check_call(["virtualenv", env_path]) | ||
print("Installing `jinja2` into bootstrap environment...") | ||
check_call([join(bin_path, "pip"), "install", "jinja2", "tox"]) | ||
python_executable = join(bin_path, "python") | ||
if not os.path.exists(python_executable): | ||
python_executable += '.exe' | ||
|
||
print("Re-executing with: {0}".format(python_executable)) | ||
print("+ exec", python_executable, __file__, "--no-env") | ||
os.execv(python_executable, [python_executable, __file__, "--no-env"]) | ||
|
||
|
||
def main(): | ||
import jinja2 | ||
|
||
print("Project path: {0}".format(base_path)) | ||
|
||
jinja = jinja2.Environment( | ||
loader=jinja2.FileSystemLoader(templates_path), | ||
trim_blocks=True, | ||
lstrip_blocks=True, | ||
keep_trailing_newline=True, | ||
) | ||
|
||
tox_environments = [ | ||
line.strip() | ||
# 'tox' need not be installed globally, but must be importable | ||
# by the Python that is running this script. | ||
# This uses sys.executable the same way that the call in | ||
# cookiecutter-pylibrary/hooks/post_gen_project.py | ||
# invokes this bootstrap.py itself. | ||
for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], universal_newlines=True).splitlines() | ||
] | ||
tox_environments = [line for line in tox_environments if line.startswith('py')] | ||
|
||
for root, _, files in os.walk(templates_path): | ||
for name in files: | ||
relative = relpath(root, templates_path) | ||
with open(join(base_path, relative, name), "w") as fh: | ||
fh.write(jinja.get_template(join(relative, name)).render(tox_environments=tox_environments)) | ||
print("Wrote {}".format(name)) | ||
print("DONE.") | ||
|
||
|
||
if __name__ == "__main__": | ||
args = sys.argv[1:] | ||
if args == ["--no-env"]: | ||
main() | ||
elif not args: | ||
exec_in_env() | ||
else: | ||
print("Unexpected arguments {0}".format(args), file=sys.stderr) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
virtualenv>=16.6.0 | ||
pip>=19.1.1 | ||
setuptools>=18.0.1 | ||
six>=1.14.0 | ||
tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: build | ||
on: [push, pull_request] | ||
jobs: | ||
test: | ||
name: {{ '${{ matrix.name }}' }} | ||
runs-on: {{ '${{ matrix.os }}' }} | ||
timeout-minutes: 30 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: 'check' | ||
python: '3.9' | ||
toxpython: 'python3.9' | ||
tox_env: 'check' | ||
os: 'ubuntu-latest' | ||
- name: 'docs' | ||
python: '3.9' | ||
toxpython: 'python3.9' | ||
tox_env: 'docs' | ||
os: 'ubuntu-latest' | ||
{% for env in tox_environments %} | ||
{% set prefix = env.split('-')[0] -%} | ||
{% if prefix.startswith('pypy') %} | ||
{% set python %}pypy-{{ prefix[4] }}.{{ prefix[5] }}{% endset %} | ||
{% set cpython %}pp{{ prefix[4:5] }}{% endset %} | ||
{% set toxpython %}pypy{{ prefix[4] }}.{{ prefix[5] }}{% endset %} | ||
{% else %} | ||
{% set python %}{{ prefix[2] }}.{{ prefix[3:] }}{% endset %} | ||
{% set cpython %}cp{{ prefix[2:] }}{% endset %} | ||
{% set toxpython %}python{{ prefix[2] }}.{{ prefix[3:] }}{% endset %} | ||
{% endif %} | ||
{% for os, python_arch in [ | ||
['ubuntu', 'x64'], | ||
['windows', 'x64'], | ||
['macos', 'x64'], | ||
] %} | ||
- name: '{{ env }} ({{ os }})' | ||
python: '{{ python }}' | ||
toxpython: '{{ toxpython }}' | ||
python_arch: '{{ python_arch }}' | ||
tox_env: '{{ env }}{% if 'cover' in env %},codecov{% endif %}' | ||
os: '{{ os }}-latest' | ||
{% endfor %} | ||
{% endfor %} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: {{ '${{ matrix.python }}' }} | ||
architecture: {{ '${{ matrix.python_arch }}' }} | ||
- name: install dependencies | ||
run: | | ||
python -mpip install --progress-bar=off -r ci/requirements.txt | ||
virtualenv --version | ||
pip --version | ||
tox --version | ||
pip list --format=freeze | ||
- name: test | ||
env: | ||
TOXPYTHON: '{{ '${{ matrix.toxpython }}' }}' | ||
run: > | ||
tox -e {{ '${{ matrix.tox_env }}' }} -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env python | ||
# -*- encoding: utf-8 -*- | ||
|
||
import io | ||
import re | ||
from glob import glob | ||
from os.path import basename | ||
from os.path import dirname | ||
from os.path import join | ||
from os.path import splitext | ||
|
||
from setuptools import find_packages | ||
from setuptools import setup | ||
|
||
def read(*names, **kwargs): | ||
with io.open(join(dirname(__file__), *names), encoding=kwargs.get('encoding', 'utf8')) as fh: | ||
return fh.read() | ||
|
||
setup( | ||
name='jupyter-analysis-tools', | ||
version='0.1.0', | ||
license='MIT', | ||
description='Common Python helpers used in data analysis notebooks (.ipynb) with GIT', | ||
long_description='{}\n{}'.format( | ||
re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')), | ||
re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst')), | ||
), | ||
author='Ingo Breßler', | ||
author_email='dev@ingobressler.net', | ||
url='https://github.com/BAMresearch/jupyter_analysis_tools', | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], | ||
include_package_data=True, | ||
zip_safe=False, | ||
classifiers=[ | ||
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: Unix', | ||
'Operating System :: POSIX', | ||
'Operating System :: Microsoft :: Windows', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3 :: Only', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: Implementation :: CPython', | ||
'Programming Language :: Python :: Implementation :: PyPy', | ||
# uncomment if you test on these interpreters: | ||
# 'Programming Language :: Python :: Implementation :: IronPython', | ||
# 'Programming Language :: Python :: Implementation :: Jython', | ||
# 'Programming Language :: Python :: Implementation :: Stackless', | ||
'Topic :: Utilities', | ||
], | ||
project_urls={ | ||
'Documentation': 'https://bamresearch.github.io/jupyter_analysis_tools/', | ||
'Changelog': 'https://bamresearch.github.io/jupyter_analysis_tools/en/latest/changelog.html', | ||
'Issue Tracker': 'https://github.com/BAMresearch/jupyter_analysis_tools/issues', | ||
}, | ||
keywords=[ | ||
# eg: 'keyword1', 'keyword2', 'keyword3', | ||
], | ||
python_requires='>=3.7', | ||
install_requires=[ | ||
# eg: 'aspectlib==1.1.1', 'six>=1.7', | ||
], | ||
extras_require={ | ||
# eg: | ||
# 'rst': ['docutils>=0.11'], | ||
# ':python_version=="2.6"': ['argparse'], | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
github_url = "https://github.com/BAMresearch/jupyter_analysis_tools/" | ||
|
||
[version] | ||
current = "0.1.0" | ||
regex = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)' | ||
|
||
[git] | ||
message_template = "Bump to {new_version}" | ||
tag_template = "v{new_version}" | ||
|
||
[[file]] | ||
src = "setup.py" | ||
search = "version='{current_version}'" | ||
|
||
[[file]] | ||
src = "README.rst" | ||
search = "/v{current_version}.svg" | ||
|
||
[[file]] | ||
src = "README.rst" | ||
search = "/v{current_version}...main" | ||
|
||
[[file]] | ||
src = "docs/conf.py" | ||
search = "version = release = '{current_version}'" | ||
|
||
[[file]] | ||
src = "src/jupyter_analysis_tools/__init__.py" | ||
search = "__version__ = '{current_version}'" | ||
|
||
[[before_commit]] | ||
name = "check changelog" | ||
cmd = "grep -q {new_version} CHANGELOG.rst" | ||
|
||
# Or run some commands after the git tag and the branch | ||
# have been pushed: | ||
# [[after_push]] | ||
# name = "publish" | ||
# cmd = "./publish.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ipykernel | ||
notebook | ||
pandas | ||
ipywidgets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
from jupyter_analysis_tools import * | ||
|
||
|
||
def test_main(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters