From ab5b671cb5a1acd6cfc96218988ba612298dc4ad Mon Sep 17 00:00:00 2001 From: "Chad B. Hovey" Date: Thu, 26 Jan 2023 12:25:17 -0700 Subject: [PATCH] pre-version 0.0.11 update --- config/README.md | 21 +++++----- geo/pyproject.toml | 59 +++++++++++++++++++++++++++ geo/{setup.py => setup_deprecated.py} | 0 geo/src/ptg/command_line.py | 6 ++- geo/tests/test_command_line.py | 13 ++++++ geo/tests/test_xybind.py | 2 +- 6 files changed, 87 insertions(+), 14 deletions(-) create mode 100644 geo/pyproject.toml rename geo/{setup.py => setup_deprecated.py} (100%) create mode 100644 geo/tests/test_command_line.py diff --git a/config/README.md b/config/README.md index a0a30a7..f3622ec 100644 --- a/config/README.md +++ b/config/README.md @@ -30,7 +30,7 @@ pip 21.2.1 setuptools 57.4.0 WARNING: You are using pip version 21.2.3; however, version 22.3.1 is available. You should consider upgrading via the '~/sibl/.venv/bin/python3.9 -m pip install --upgrade pip' command. -(.venv) ~/copyright> +(.venv) ~/sibl> python -m pip install --upgrade pip ``` @@ -91,12 +91,11 @@ click 8.1.3 comm 0.1.2 contourpy 1.0.7 copyright 0.0.1 -coverage 7.0.5 +coverage 7.1.0 cycler 0.11.0 debugpy 1.6.6 decorator 5.1.1 defusedxml 0.7.1 -entrypoints 0.4 exceptiongroup 1.1.0 executing 1.2.0 fastjsonschema 2.16.2 @@ -115,7 +114,7 @@ jedi 0.18.2 Jinja2 3.1.2 jsonpointer 2.3 jsonschema 4.17.3 -jupyter_client 7.4.9 +jupyter_client 8.0.0 jupyter_core 5.1.5 jupyter-events 0.6.3 jupyter_server 2.1.0 @@ -152,7 +151,7 @@ pluggy 1.0.0 prometheus-client 0.16.0 prompt-toolkit 3.0.36 psutil 5.9.4 -ptg 0.0.4 /Users/chovey/sibl/geo/src +ptg 0.0.11 /Users/chovey/sibl/geo ptyprocess 0.7.0 pure-eval 0.2.2 pybind11 2.10.3 @@ -193,7 +192,7 @@ uri-template 1.2.0 wcwidth 0.2.6 webcolors 1.12 webencodings 0.5.1 -websocket-client 1.4.2 +websocket-client 1.5.0 xybind 0.0.8 /Users/chovey/sibl/geo/src/bind xyfigure 0.0.9 /Users/chovey/sibl/cli/src zipp 3.11.0 @@ -246,14 +245,14 @@ version Prints the semantic verison of the current installation. Run the tests with `pytest`: ```bash -(.venv) ~/sibl> cd geo -(.venv) ~/sibl/geo> pytest -v +(.venv) ~/sibl> pytest -v +(.venv) ~/sibl> pytest geo/ -v # test only the ptg module ``` And `pytest-cov` (coverage) with line numbers missing coverage: ```bash -(.venv) ~/sibl/geo> pytest --cov=copyright --cov-report term-missing +(.venv) ~/sibl> pytest --cov=geo --cov-report term-missing ``` Success! The `venv` virtual environment `.venv` has been created, @@ -264,9 +263,9 @@ and the `atmesh` module is now installed and tested. ```bash # develop code # uninstall the now-outdated developer installation -pip uninstall copyright +pip uninstall ptg # reinstall the module with the newly developed code -pip install -e .[dev] +# see original installation instructions above ``` ## Modify VS Code if desired diff --git a/geo/pyproject.toml b/geo/pyproject.toml new file mode 100644 index 0000000..bf5a030 --- /dev/null +++ b/geo/pyproject.toml @@ -0,0 +1,59 @@ +# reference +# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html +# PEP621 +# https://peps.python.org/pep-0621/ +# +# Python Packages +# https://py-pkgs.org/welcome + + +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "ptg" +version = "0.0.11" +authors = [ + { name="Chad Hovey", email="chovey@sandia.gov" }, +] +description = "SNL SIBL Geometry Engine" +readme = "README.md" +license = { file="LICENSE" } +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dependencies = [ + "copyright @ git+https://github.com/sandialabs/copyright", + "ipykernel", + "matplotlib", + "mypy", + "notebook", + "pybind11", + "pygments", + "pytz", + "pyyaml", + "seaborn", + "scikit-image", + "scipy", +] + +# Optional dependencies video +# https://www.youtube.com/watch?v=yJyo-K7wW2g + +[project.optional-dependencies] +dev = ["black==22.3.0", "flake8", "pytest", "pytest-cov"] + +# Entry Points +# https://setuptools.pypa.io/en/latest/userguide/entry_point.html +[project.scripts] +cli-hello="ptg.command_line:say_hello" +version="ptg.command_line:version" +pydual="ptg.main:main" + +[project.urls] +"Homepage" = "https://github.com/sandialabs/sibl" +"Bug Tracker" = "https://github.com/sandialabs/sibl/issues" diff --git a/geo/setup.py b/geo/setup_deprecated.py similarity index 100% rename from geo/setup.py rename to geo/setup_deprecated.py diff --git a/geo/src/ptg/command_line.py b/geo/src/ptg/command_line.py index b45d656..65be834 100644 --- a/geo/src/ptg/command_line.py +++ b/geo/src/ptg/command_line.py @@ -6,8 +6,10 @@ import pkg_resources # part of setup tools -def say_hello(): - print("hello world!") +def say_hello() -> str: + aa = "hello world!" + print(aa) + return aa def version() -> str: diff --git a/geo/tests/test_command_line.py b/geo/tests/test_command_line.py new file mode 100644 index 0000000..cadddb7 --- /dev/null +++ b/geo/tests/test_command_line.py @@ -0,0 +1,13 @@ +from ptg import command_line as cl + + +def test_say_hello(): + known = "hello world!" + found = cl.say_hello() + assert known == found + + +def test_version(): + known = "0.0.11" + found = cl.version() + assert known == found diff --git a/geo/tests/test_xybind.py b/geo/tests/test_xybind.py index f1cb5a3..14f3944 100644 --- a/geo/tests/test_xybind.py +++ b/geo/tests/test_xybind.py @@ -24,7 +24,7 @@ def test_ptg_version(): ptg_version = command_line.version() - assert ptg_version == "0.0.4" + assert ptg_version == "0.0.11" def test_xyb_version():