From 6d31c7821a2b7ef43a4696f2f8e349725256fc01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Gince?= Date: Thu, 10 Jul 2025 15:24:56 -0400 Subject: [PATCH 1/6] Update docs and LICENSE handling for Poetry and author MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed references to requirements.txt and run_pytests.py in README and PR template, updating instructions to use Poetry for dependency management and testing. Modified LICENSE update logic in change_project_attributes.py to replace the author from the original 'Jérémie Gince'. --- .github/pull_request_template.md | 3 +-- README.md | 7 +++---- change_project_attributes.py | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 75ed203..a69c92e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -10,8 +10,7 @@ Please complete the following checklist when submitting a PR. The PR will not be - [ ] All new features include a unit test. Make sure that the tests passed and the coverage is - sufficient by running `python run_pytests.py --tests_folder=tests` or - `pytest tests --cov=src --cov-report=term-missing`. + sufficient by running `pytest tests --cov=src --cov-report=term-missing`. - [ ] All new functions and code are clearly documented. - [ ] The code is formatted using Black. You can do this by running `black src tests`. diff --git a/README.md b/README.md index 3f01a2a..f153368 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,6 @@ The project is constituted by the following parts: - **.gitattributes**: This file is responsible for setting the git attributes of the project. - **.gitignore**: This file is responsible for ignoring the files that you don't want to commit to the repository. A basic one is already provided and should be enough for most of the projects. -- **requirements.txt**: This file is responsible for listing the dependencies of the project. - **pyproject.toml**: This file is responsible for listing the dependencies of the project and the configuration of the project. - **README.md**: This file is responsible for providing information about the project. @@ -56,7 +55,6 @@ The project is constituted by the following parts: Feel free to remove it once you used it. - **setup.py**: This file is responsible for setting up the project. - **LICENSE**: This file is responsible for providing the license of the project. -- **run_pytests.py**: This script is used by the github actions to run the tests. # README TEMPLATE @@ -67,7 +65,8 @@ With `python` and `pip` installed, run the following commands to install the dep ```bash python -m venv .venv source .venv/bin/activate -pip install -r requirements.txt +pip install poetry +python -m poetry install ``` With `poetry` installed, run the following commands to install the dependencies: @@ -126,4 +125,4 @@ python docker_files/build_image_and_run.py --mode= ## Citation ``` -``` \ No newline at end of file +``` diff --git a/change_project_attributes.py b/change_project_attributes.py index b1252bb..5910b06 100644 --- a/change_project_attributes.py +++ b/change_project_attributes.py @@ -156,7 +156,7 @@ def update_license(args): with open("LICENSE", "r") as f: content = f.read() if args.author is not None: - content = re.sub(r'Copyright (.*?) (.*?)', f'Copyright {datetime.datetime.now().year} {args.author}', content) + content = re.sub(r'Copyright (.*?) (Jérémie Gince)', f'Copyright {datetime.datetime.now().year} {args.author}', content) with open("LICENSE", "w") as f: f.write(content) return 0 @@ -217,4 +217,3 @@ def main(): if __name__ == '__main__': sys.exit(main()) - From 1ec3f4f0173d8821a8856556ba3584bb9f187921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Gince?= Date: Thu, 10 Jul 2025 15:27:57 -0400 Subject: [PATCH 2/6] Update change_project_attributes.py --- change_project_attributes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/change_project_attributes.py b/change_project_attributes.py index 5910b06..e392f78 100644 --- a/change_project_attributes.py +++ b/change_project_attributes.py @@ -91,7 +91,7 @@ def update_init_file(args): content = re.sub(r'__email__ = "(.*?)"', f'__email__ = "{args.email}"', content) if args.url is not None: content = re.sub(r'__url__ = "(.*?)"', f'__url__ = "{args.url}"', content) - if args.pakage_name is not None: + if args.package_name is not None: content = re.sub(r'__package__ = "(.*?)"', f'__package__ = "{args.package_name}"', content) with open(init_file, "w") as f: f.write(content) @@ -156,7 +156,7 @@ def update_license(args): with open("LICENSE", "r") as f: content = f.read() if args.author is not None: - content = re.sub(r'Copyright (.*?) (Jérémie Gince)', f'Copyright {datetime.datetime.now().year} {args.author}', content) + content = re.sub(r'Copyright (.*?) Jérémie Gince', f'Copyright {datetime.datetime.now().year} {args.author}', content) with open("LICENSE", "w") as f: f.write(content) return 0 From 60b5eb2996de357ed486e1c04783b779d94349f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Gince?= Date: Thu, 10 Jul 2025 15:29:05 -0400 Subject: [PATCH 3/6] Update change_project_attributes.py --- change_project_attributes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/change_project_attributes.py b/change_project_attributes.py index e392f78..7a22b76 100644 --- a/change_project_attributes.py +++ b/change_project_attributes.py @@ -156,7 +156,7 @@ def update_license(args): with open("LICENSE", "r") as f: content = f.read() if args.author is not None: - content = re.sub(r'Copyright (.*?) Jérémie Gince', f'Copyright {datetime.datetime.now().year} {args.author}', content) + content = re.sub(r'Copyright 2024 Jérémie Gince', f'Copyright {datetime.datetime.now().year} {args.author}', content) with open("LICENSE", "w") as f: f.write(content) return 0 From 58090ed3140a39145b587bf197d202d4b3b5cddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Gince?= Date: Thu, 10 Jul 2025 15:29:50 -0400 Subject: [PATCH 4/6] Update change_project_attributes.py --- change_project_attributes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/change_project_attributes.py b/change_project_attributes.py index 7a22b76..fa5fae4 100644 --- a/change_project_attributes.py +++ b/change_project_attributes.py @@ -156,7 +156,7 @@ def update_license(args): with open("LICENSE", "r") as f: content = f.read() if args.author is not None: - content = re.sub(r'Copyright 2024 Jérémie Gince', f'Copyright {datetime.datetime.now().year} {args.author}', content) + content = re.sub(r'Copyright 2024 Jeremie Gince', f'Copyright {datetime.datetime.now().year} {args.author}', content) with open("LICENSE", "w") as f: f.write(content) return 0 From 7336577a323f8886d13abcd1bf66f07be0dc7bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Gince?= Date: Thu, 10 Jul 2025 15:31:06 -0400 Subject: [PATCH 5/6] Fix typo in copyright holder's name in LICENSE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrected the spelling of 'Jérémie Gince' to 'Jeremie Gince' in the LICENSE file to ensure consistency and accuracy. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 7565321..82f0038 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 Jérémie Gince + Copyright 2024 Jeremie Gince Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 6b18f17e1a599eaa0e73d6768d8e8357cd07c83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Gince?= Date: Thu, 10 Jul 2025 15:36:35 -0400 Subject: [PATCH 6/6] Remove slow test configuration and related code Eliminated the RUN_SLOW_TESTS flag, slow test marker, and pytest command-line option for running slow tests. This simplifies the test configuration by removing unused or unnecessary slow test handling logic. --- tests/__init__.py | 10 ---------- tests/configs.py | 3 --- tests/conftest.py | 46 --------------------------------------------- tests/test_dummy.py | 1 - 4 files changed, 60 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 95af403..3d946c3 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,15 +1,5 @@ import numpy as np -import pytest from .configs import TEST_SEED np.random.seed(TEST_SEED) - - -def get_slow_test_mark(): - from .configs import RUN_SLOW_TESTS - - return pytest.mark.skipif( - not RUN_SLOW_TESTS, - reason=f"Only run when configs.{RUN_SLOW_TESTS} is True.", - ) diff --git a/tests/configs.py b/tests/configs.py index 7a174da..481253d 100644 --- a/tests/configs.py +++ b/tests/configs.py @@ -1,4 +1,3 @@ -N_RANDOM_TESTS_PER_CASE = 10 TEST_SEED = 42 ATOL_MATRIX_COMPARISON = 1e-7 @@ -12,5 +11,3 @@ ATOL_SHAPE_COMPARISON = 0 RTOL_SHAPE_COMPARISON = 0 - -RUN_SLOW_TESTS = True diff --git a/tests/conftest.py b/tests/conftest.py index b458970..e69de29 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,46 +0,0 @@ -import pytest - -from .configs import RUN_SLOW_TESTS - -RUN_SLOW_ARG_NAME = "run_slow" - - -@pytest.hookimpl() -def pytest_sessionstart(session): - pass - - -# @pytest.hookimpl() -# def pytest_sessionfinish(session, exitstatus): -# reporter = session.config.pluginmanager.get_plugin('terminalreporter') -# print('passed amount:', len(reporter.stats['passed'])) - - -def pytest_addoption(parser): - r""" - Add options to the pytest command. - - See: https://jwodder.github.io/kbits/posts/pytest-mark-off/. - - :param parser: The pytest parser. - :return: None - """ - parser.addoption( - f"--{RUN_SLOW_ARG_NAME}", - action="store_true", - default=RUN_SLOW_TESTS, - help="Run slow tests", - ) - - -def pytest_collection_modifyitems(config, items): - if config.getoption(f"--{RUN_SLOW_ARG_NAME}"): - # if RUN_SLOW_TESTS: - # print("Running slow tests") - pass - else: - # print("Skipping slow tests") - skipper = pytest.mark.skip(reason=f"Only run when '--{RUN_SLOW_ARG_NAME}=True' is given") - for item in items: - if "slow" in item.keywords: - item.add_marker(skipper) diff --git a/tests/test_dummy.py b/tests/test_dummy.py index bfaa4dc..9893101 100644 --- a/tests/test_dummy.py +++ b/tests/test_dummy.py @@ -1,5 +1,4 @@ import argparse -import runpy import pytest