From 625c38ff2a9f4212b92c843e72b241a41f6a181e Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 24 May 2024 16:15:32 -0700 Subject: [PATCH 01/12] reponame vs packagename fix --- {{cookiecutter.repo_name}}/pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.repo_name}}/pyproject.toml b/{{cookiecutter.repo_name}}/pyproject.toml index c224ca96..fb968c1a 100644 --- a/{{cookiecutter.repo_name}}/pyproject.toml +++ b/{{cookiecutter.repo_name}}/pyproject.toml @@ -6,7 +6,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -name = "{{cookiecutter.repo_name}}" +name = "{{cookiecutter.package_name}}" description = "{{cookiecutter.description}}" license = {{ "{" }}file = "LICENSE" {{ "}" }} authors = [ @@ -43,12 +43,12 @@ doc = [ # documentation = "https://{{cookiecutter.repo_name}}.readthedocs.io" [tool.setuptools] -py-modules = [] +packages = ["{{cookiecutter.package_name}}"] [tool.pytest.ini_options] minversion = "6.0" testpaths = [ - "{{cookiecutter.repo_name}}/tests", + "{{cookiecutter.package_name}}/tests", ] [tool.black] From 3eca258172c6417c784360d1e9aef8cd869ab623 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 24 May 2024 17:45:56 -0700 Subject: [PATCH 02/12] added test and tweaked version determination --- tests/test_output.py | 15 ++++++++++++++- {{cookiecutter.repo_name}}/pyproject.toml | 6 +++--- .../{{cookiecutter.package_name}}/__init__.py | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/test_output.py b/tests/test_output.py index 21a57910..2e7190cc 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -1,7 +1,8 @@ import pytest from .utils import CookiecutterMDAKit, DependencyType - +import subprocess +import sys class TestAnalysis: @@ -69,3 +70,15 @@ def test_write_outputs( output_directory=str(output_directory.resolve()), ) kitter.run() + +def test_install_and_import(tmpdir): + with tmpdir.as_cwd(): + kit = CookiecutterMDAKit(template_analysis_class="MyAnalysisClass") + kit.run() + result = subprocess.run([sys.executable, "-m", "pip", "install", "-e", "./test-mda-kit"], capture_output=True, text=True) + if result.returncode != 0: + pytest.fail(f"Failed to install: {result.stderr}") + try: + import test_mdakit_package + except ImportError as e: + pytest.fail(f"Failed to import 'test_mdakit_package': {e}") \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/pyproject.toml b/{{cookiecutter.repo_name}}/pyproject.toml index fb968c1a..4a56d365 100644 --- a/{{cookiecutter.repo_name}}/pyproject.toml +++ b/{{cookiecutter.repo_name}}/pyproject.toml @@ -6,7 +6,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -name = "{{cookiecutter.package_name}}" +name = "{{cookiecutter.repo_name}}" description = "{{cookiecutter.description}}" license = {{ "{" }}file = "LICENSE" {{ "}" }} authors = [ @@ -42,8 +42,8 @@ doc = [ # source = "https://github.com/{{cookiecutter.github_url}}" # documentation = "https://{{cookiecutter.repo_name}}.readthedocs.io" -[tool.setuptools] -packages = ["{{cookiecutter.package_name}}"] +[tool.setuptools.packages.find] +include = ["{{cookiecutter.package_name}}"] [tool.pytest.ini_options] minversion = "6.0" diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/__init__.py b/{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/__init__.py index 370baee4..d71ef92b 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/__init__.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/__init__.py @@ -6,4 +6,4 @@ # Add imports here from importlib.metadata import version -__version__ = version("{{cookiecutter.package_name}}") +__version__ = version("{{cookiecutter.repo_name}}") From 095032eb6984da55dc35d25a5d40a5540e83634a Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 24 May 2024 17:56:12 -0700 Subject: [PATCH 03/12] linting --- tests/test_output.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_output.py b/tests/test_output.py index 2e7190cc..e111e275 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -71,14 +71,17 @@ def test_write_outputs( ) kitter.run() + def test_install_and_import(tmpdir): with tmpdir.as_cwd(): kit = CookiecutterMDAKit(template_analysis_class="MyAnalysisClass") kit.run() - result = subprocess.run([sys.executable, "-m", "pip", "install", "-e", "./test-mda-kit"], capture_output=True, text=True) + result = subprocess.run([sys.executable, + "-m", "pip", "install", "-e", "./test-mda-kit"], + capture_output=True, text=True) if result.returncode != 0: pytest.fail(f"Failed to install: {result.stderr}") try: import test_mdakit_package except ImportError as e: - pytest.fail(f"Failed to import 'test_mdakit_package': {e}") \ No newline at end of file + pytest.fail(f"Failed to import 'test_mdakit_package': {e}") From f6ba77426ae452d1ce9c0af4a71836d696bcb212 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 24 May 2024 18:05:00 -0700 Subject: [PATCH 04/12] linting --- tests/test_output.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_output.py b/tests/test_output.py index e111e275..bcf5165a 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -77,8 +77,9 @@ def test_install_and_import(tmpdir): kit = CookiecutterMDAKit(template_analysis_class="MyAnalysisClass") kit.run() result = subprocess.run([sys.executable, - "-m", "pip", "install", "-e", "./test-mda-kit"], - capture_output=True, text=True) + "-m", "pip", "install", + "-e", "./test-mda-kit"], + capture_output=True, text=True) if result.returncode != 0: pytest.fail(f"Failed to install: {result.stderr}") try: From 94dae28a61e7f57e765b80a8d34796d7633dac92 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 24 May 2024 18:05:54 -0700 Subject: [PATCH 05/12] linting --- tests/test_output.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_output.py b/tests/test_output.py index bcf5165a..1755525b 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -77,9 +77,9 @@ def test_install_and_import(tmpdir): kit = CookiecutterMDAKit(template_analysis_class="MyAnalysisClass") kit.run() result = subprocess.run([sys.executable, - "-m", "pip", "install", + "-m", "pip", "install", "-e", "./test-mda-kit"], - capture_output=True, text=True) + capture_output=True, text=True) if result.returncode != 0: pytest.fail(f"Failed to install: {result.stderr}") try: From ca6b6f553ca08d00a1036c9a3b1adca0b3da3389 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Fri, 24 May 2024 20:42:01 -0700 Subject: [PATCH 06/12] debugging github actions- is pip installing into correct env within test? --- tests/test_output.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/test_output.py b/tests/test_output.py index 1755525b..ee98415e 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -76,8 +76,7 @@ def test_install_and_import(tmpdir): with tmpdir.as_cwd(): kit = CookiecutterMDAKit(template_analysis_class="MyAnalysisClass") kit.run() - result = subprocess.run([sys.executable, - "-m", "pip", "install", + result = subprocess.run(["python", "-m", "pip", "install", "-e", "./test-mda-kit"], capture_output=True, text=True) if result.returncode != 0: @@ -86,3 +85,16 @@ def test_install_and_import(tmpdir): import test_mdakit_package except ImportError as e: pytest.fail(f"Failed to import 'test_mdakit_package': {e}") + +def test_gh_actions_debug_python_env(tmpdir): + with tmpdir.as_cwd(): + + result = subprocess.run(["python", "-m", "pip", "install", + "mdanalysistests"], + capture_output=True, text=True) + if result.returncode != 0: + pytest.fail(f"Failed to install: {result.stderr}") + try: + import MDAnalysisTests + except ImportError as e: + pytest.fail(f"Failed to import 'MDAnalysisTests': {e}") \ No newline at end of file From a68f84a80766ec803554b3964e292fd13c444fb5 Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Sat, 25 May 2024 07:11:31 -0700 Subject: [PATCH 07/12] remove redundant tests --- tests/test_output.py | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/tests/test_output.py b/tests/test_output.py index ee98415e..5263f45d 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -70,31 +70,3 @@ def test_write_outputs( output_directory=str(output_directory.resolve()), ) kitter.run() - - -def test_install_and_import(tmpdir): - with tmpdir.as_cwd(): - kit = CookiecutterMDAKit(template_analysis_class="MyAnalysisClass") - kit.run() - result = subprocess.run(["python", "-m", "pip", "install", - "-e", "./test-mda-kit"], - capture_output=True, text=True) - if result.returncode != 0: - pytest.fail(f"Failed to install: {result.stderr}") - try: - import test_mdakit_package - except ImportError as e: - pytest.fail(f"Failed to import 'test_mdakit_package': {e}") - -def test_gh_actions_debug_python_env(tmpdir): - with tmpdir.as_cwd(): - - result = subprocess.run(["python", "-m", "pip", "install", - "mdanalysistests"], - capture_output=True, text=True) - if result.returncode != 0: - pytest.fail(f"Failed to install: {result.stderr}") - try: - import MDAnalysisTests - except ImportError as e: - pytest.fail(f"Failed to import 'MDAnalysisTests': {e}") \ No newline at end of file From f6f752b51d32afe604972df023fe1d000165737a Mon Sep 17 00:00:00 2001 From: ljwoods2 Date: Mon, 27 May 2024 18:48:03 -0700 Subject: [PATCH 08/12] Authors + Changelog + Removed unused import --- AUTHORS.md | 3 +++ CHANGELOG.md | 2 ++ tests/test_output.py | 2 -- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index efbcd8cb..ef49a714 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -25,3 +25,6 @@ The rules for this file: - Ian Kenney \<@ianmkenney\> - Rocco Meli \<@RMeli\> - Oliver Beckstein \<@orbeckst\> + +**2024** +- Lawson Woods \<@ljwoods2\> \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 01fda03b..634aba29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,9 +26,11 @@ The rules for this file: - ianmkenney - RMeli - orbeckst +- ljwoods2 ### Added +- Fixed ModuleNotFound after installation (Issue #113, PR #115) - Add black configurartion to `pyproject.toml` (Issue #73, PR #75) - Cookiecutter version dependency (Issue #33, PR #46) - Configuration files for external hooks (PR #9) diff --git a/tests/test_output.py b/tests/test_output.py index 8b021464..455da983 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -1,8 +1,6 @@ import pytest from .utils import CookiecutterMDAKit, DependencyType -import subprocess -import sys class TestAnalysis: From 422cf5b774bcee2b284bd8fe15aad7685640f8fb Mon Sep 17 00:00:00 2001 From: Lawson Woods Date: Wed, 10 Jul 2024 19:14:25 -0700 Subject: [PATCH 09/12] version change --- readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs.yaml b/readthedocs.yaml index ff7f71c8..83e72de1 100644 --- a/readthedocs.yaml +++ b/readthedocs.yaml @@ -5,7 +5,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "mambaforge-4.10" + python: "mambaforge-23.11" conda: environment: docs/requirements.yaml From 828c1b972358fa25465b0a21b59fd78d33fae020 Mon Sep 17 00:00:00 2001 From: Lawson Woods Date: Wed, 10 Jul 2024 19:17:01 -0700 Subject: [PATCH 10/12] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f94f9528..b9872174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ The rules for this file: ### Fixed +- Updated mambaforge version in `readthedocs.yaml` (Issue #132, PR #133) - Switched deprecated pkg_resources to use importlib (PR #122, Issue #121) - Fixed pypi_check with lowercase (PR #118, Issue #112) - Fixed ModuleNotFound after installation (Issue #113, PR #115) From 1270523bac8f78a1058b6f404dcf83015dfece74 Mon Sep 17 00:00:00 2001 From: Lawson Woods Date: Wed, 10 Jul 2024 19:18:48 -0700 Subject: [PATCH 11/12] undo forked changes --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9872174..1dbc7307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,6 @@ The rules for this file: ### Added -- Fixed ModuleNotFound after installation (Issue #113, PR #115) - Add black configurartion to `pyproject.toml` (Issue #73, PR #75) - Cookiecutter version dependency (Issue #33, PR #46) - Configuration files for external hooks (PR #9) From c33600cf75adab411548a1a910b48977d695bd89 Mon Sep 17 00:00:00 2001 From: Lawson Woods Date: Wed, 10 Jul 2024 21:48:42 -0700 Subject: [PATCH 12/12] dynamic version --- readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs.yaml b/readthedocs.yaml index 83e72de1..fc241e56 100644 --- a/readthedocs.yaml +++ b/readthedocs.yaml @@ -5,7 +5,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "mambaforge-23.11" + python: "mambaforge-latest" conda: environment: docs/requirements.yaml