From dbf986fbda73bf11f0bd5e53740526e5ed499467 Mon Sep 17 00:00:00 2001 From: Jason Regina Date: Thu, 22 Jul 2021 08:30:18 -0500 Subject: [PATCH] template files --- EXCLUDE | 7 +++++++ MANIFEST.in | 1 + Makefile | 29 +++++++++++++++++++++++++++++ pyproject.toml | 10 ++++++++++ requirements.txt | 31 +++++++++++++++++++++++++++++++ setup.cfg | 37 +++++++++++++++++++++++++++++++++++++ src/hello/__init__.py | 0 src/hello/hello.py | 17 +++++++++++++++++ tests/test_hello.py | 9 +++++++++ 9 files changed, 141 insertions(+) create mode 100644 EXCLUDE create mode 100644 MANIFEST.in create mode 100644 Makefile create mode 100644 pyproject.toml create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 src/hello/__init__.py create mode 100644 src/hello/hello.py create mode 100644 tests/test_hello.py diff --git a/EXCLUDE b/EXCLUDE new file mode 100644 index 0000000..35a0363 --- /dev/null +++ b/EXCLUDE @@ -0,0 +1,7 @@ +*__pycache__* +*.py[cod] +*$py.class +miniconda3/* +sha256sum.txt +Miniconda3-py* +*.pytest_cache* diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..1aba38f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include LICENSE diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..aa957f1 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +REPOSITORY=https://repo.anaconda.com/miniconda +INSTALLER=Miniconda3-py38_4.9.2-Linux-x86_64.sh +HASH=1314b90489f154602fd794accfc90446111514a5a72fe1f71ab83e07de9504a7 +HASHFILE=sha256sum.txt +PYENV=miniconda3 +PYTHON=$(PYENV)/bin/python3 + +.PHONY: build checksum clean + +build: $(PYENV)/bin/activate + $(PYTHON) -m build + +$(PYENV)/bin/activate: checksum requirements.txt + test -d $(PYENV) || bash ./$(INSTALLER) -b -p $(PYENV) + $(PYTHON) -m pip install -U pip wheel setuptools build pytest + $(PYTHON) -m pip install -r requirements.txt + touch $(PYENV)/bin/activate + +checksum: $(INSTALLER) $(HASHFILE) + sha256sum -c $(HASHFILE) + +$(INSTALLER): + wget $(REPOSITORY)/$(INSTALLER) + +$(HASHFILE): + echo "$(HASH) $(INSTALLER)" > $(HASHFILE) + +clean: + rm -rf dist/ $(PYENV) $(HASHFILE) $(INSTALLER) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c5fa778 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,10 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "-s" +testpaths = [ + "tests", +] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..de1d8df --- /dev/null +++ b/requirements.txt @@ -0,0 +1,31 @@ +attrs==21.2.0 +brotlipy==0.7.0 +build==0.5.1 +certifi==2020.6.20 +cffi==1.14.3 +chardet==3.0.4 +conda==4.9.2 +conda-package-handling==1.7.2 +cryptography==3.2.1 +evaluation-tools==1.2.0 +idna==2.10 +iniconfig==1.1.1 +packaging==21.0 +pep517==0.10.0 +pip==21.1.3 +pluggy==0.13.1 +py==1.10.0 +pycosat==0.6.3 +pycparser==2.20 +pyOpenSSL==19.1.0 +pyparsing==2.4.7 +PySocks==1.7.1 +pytest==6.2.4 +requests==2.24.0 +ruamel-yaml==0.15.87 +setuptools==57.2.0 +six==1.15.0 +toml==0.10.2 +tqdm==4.51.0 +urllib3==1.25.11 +wheel==0.36.2 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..a7c2f59 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,37 @@ +[metadata] +name = hello +version = 0.1.0 +author = Your Name +author_email = your.name@noaa.gov +description = Generic template for data-driven projects using Python. +long_description = file: README.md +long_description_content_type = text/markdown; charset=UTF-8 +license = USDOC +license_files = + LICENSE +url = https://github.com/NOAA-OWP/ +project_urls = + Documentation = https://github.com/NOAA-OWP/ + Source = https://github.com/NOAA-OWP/ + Tracker = https://github.com/NOAA-OWP/ +classifiers = + Development Status :: 1 - Planning + Intended Audience :: Education + Intended Audience :: Science/Research + License :: Free To Use But Restricted + Programming Language :: Python :: 3.8 + Topic :: Scientific/Engineering :: Hydrology + Operating System :: OS Independent + Private :: Do not Upload + +[options] +packages = find: +package_dir = + =src +install_requires = + numpy +python_requires = >=3.8 +include_package_data = True + +[options.packages.find] +where = src diff --git a/src/hello/__init__.py b/src/hello/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/hello/hello.py b/src/hello/hello.py new file mode 100644 index 0000000..f6ad6cd --- /dev/null +++ b/src/hello/hello.py @@ -0,0 +1,17 @@ +def greet(name: str): + """ + Create a simple greeting. + + Parameters + ---------- + name: str, required + Name of person to greet. + + Returns + ------- + greeting: str + String with a simple greeting. + + """ + # Return greeting + return f"Hello, {name}!" diff --git a/tests/test_hello.py b/tests/test_hello.py new file mode 100644 index 0000000..2d6151e --- /dev/null +++ b/tests/test_hello.py @@ -0,0 +1,9 @@ +import pytest +from hello.hello import greet + +def test_greet(): + # Create a greeting + greeting = greet("Jo") + + # Check the greeting + assert greeting == "Hello, Jo!"