From e165b65737fef0eb759e6cd7e0a7023a331fb867 Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Thu, 15 Aug 2024 12:31:36 +0530 Subject: [PATCH 1/7] Update installation page in tardis docs --- docs/installation.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index b3fc1a886dc..8e3c8def306 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -51,7 +51,7 @@ this method by following the steps described below. $ git remote add upstream git@github.com:tardis-sn/tardis.git $ git fetch upstream $ git checkout upstream/master - $ python setup.py develop + $ pip install -e . .. note:: @@ -124,7 +124,8 @@ We highly recommend deleting your existing environment and creating a new one us Use the following ``conda`` command to remove your current ``tardis`` environment: :: - $ conda remove --name tardis --all + + $ conda remove --name tardis --all Now, you can create a new environment by following the steps given `here `_. From 940b5b90053f3c32c89c20130b37d1231feb57de Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Thu, 15 Aug 2024 12:34:39 +0530 Subject: [PATCH 2/7] Remove deprecated setup.py --- setup.py | 83 -------------------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100755 setup.py diff --git a/setup.py b/setup.py deleted file mode 100755 index dd5a522af29..00000000000 --- a/setup.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python -# Licensed under a 3-clause BSD style license - see LICENSE.rst - -# NOTE: The configuration for the package, including the name, version, and -# other information are set in the setup.cfg file. - -import os -import sys - -from setuptools import setup - - -# First provide helpful messages if contributors try and run legacy commands -# for tests or docs. - -TEST_HELP = """ -Note: running tests is no longer done using 'python setup.py test'. Instead -you will need to run: - - tox -e test - -If you don't already have tox installed, you can install it with: - - pip install tox - -If you only want to run part of the test suite, you can also use pytest -directly with:: - - pip install -e .[test] - pytest - -For more information, see: - - http://docs.astropy.org/en/latest/development/testguide.html#running-tests -""" - -if 'test' in sys.argv: - print(TEST_HELP) - sys.exit(1) - -DOCS_HELP = """ -Note: building the documentation is no longer done using -'python setup.py build_docs'. Instead you will need to run: - - tox -e build_docs - -If you don't already have tox installed, you can install it with: - - pip install tox - -You can also build the documentation with Sphinx directly using:: - - pip install -e .[docs] - cd docs - make html - -For more information, see: - - http://docs.astropy.org/en/latest/install.html#builddocs -""" - -if 'build_docs' in sys.argv or 'build_sphinx' in sys.argv: - print(DOCS_HELP) - sys.exit(1) - -VERSION_TEMPLATE = """ -# Note that we need to fall back to the hard-coded version if either -# setuptools_scm can't be imported or setuptools_scm can't determine the -# version, so we catch the generic 'Exception'. -try: - from setuptools_scm import get_version - version = get_version(root='..', relative_to=__file__) -except Exception: - version = '{version}' -""".lstrip() - -# Pure Python scripts that are not entry points, required for `pip install`. -scripts = ['tardis/scripts/tardis'] - -setup(scripts=scripts, - use_scm_version={'write_to': os.path.join('tardis', 'version.py'), - 'write_to_template': VERSION_TEMPLATE, - 'version_scheme': 'calver-by-date'},) From ba2a3f5ff5809590759f7d7ebf073955c53beedd Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Thu, 15 Aug 2024 15:02:30 +0530 Subject: [PATCH 3/7] Remove doctest flag from make file --- docs/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index c32622e3bb4..0015d588f1f 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -128,7 +128,3 @@ linkcheck: @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - @echo "Run 'python setup.py test' in the root directory to run doctests " \ - @echo "in the documentation." From 53144aada86bb97859d6cdf920a48845fbcc1b8a Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Thu, 15 Aug 2024 15:36:42 +0530 Subject: [PATCH 4/7] Removing setup.py from ruff config --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 529a9d9300a..ceb1c365ee6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,7 +134,6 @@ lint.ignore = [ # NOTE: non-permanent exclusions should be added to `.ruff.toml ] [tool.ruff.lint.extend-per-file-ignores] -"setup.py" = ["INP001"] # Part of configuration, not a package. ".github/workflows/*.py" = ["INP001"] "test_*.py" = [ "B018", # UselessExpression From eae714bc58a6349330c65ffc938228e1b7ea1b88 Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Thu, 15 Aug 2024 17:58:03 +0530 Subject: [PATCH 5/7] Replacing setup.py commands in the codebase --- asv.conf.json | 2 +- docs/conf.py | 3 +-- .../development/documentation_guidelines.rst | 2 +- docs/contributing/development/git_workflow.rst | 4 ++-- docs/contributing/development/running_tests.rst | 6 ++---- pyproject.toml | 3 +-- tardis/tests/integration_tests/runner.py | 12 ++++++------ 7 files changed, 14 insertions(+), 18 deletions(-) diff --git a/asv.conf.json b/asv.conf.json index 235171c5480..9e94b591c60 100644 --- a/asv.conf.json +++ b/asv.conf.json @@ -6,7 +6,7 @@ "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"], "uninstall_command": ["return-code=any python -mpip uninstall -y {project}"], "build_command": [ - "python setup.py build", + "pip install -e .", "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" ], "branches": ["origin/master", "HEAD"], diff --git a/docs/conf.py b/docs/conf.py index f8a6d2e6371..ef2cc4d153f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,8 +20,7 @@ # commented out with this explanation to make it clear why this should not be # done. If the sys.path entry above is added, when the astropy.sphinx.conf # import occurs, it will import the *source* version of astropy instead of the -# version installed (if invoked as "make html" or directly with sphinx), or the -# version in the build directory (if "python setup.py build_sphinx" is used). +# version installed (if invoked as "make html" or directly with sphinx). # Thus, any C-extensions that are needed to build the documentation will *not* # be accessible, and the documentation will not build correctly. diff --git a/docs/contributing/development/documentation_guidelines.rst b/docs/contributing/development/documentation_guidelines.rst index 49e40822edd..b8b040db8cf 100644 --- a/docs/contributing/development/documentation_guidelines.rst +++ b/docs/contributing/development/documentation_guidelines.rst @@ -57,7 +57,7 @@ To build TARDIS documentation locally, use the following commands: .. note:: - - If you're working on a fresh local copy of the TARDIS repository, you might need to do ``python setup.py develop`` before executing these commands. + - If you're working on a fresh local copy of the TARDIS repository, you might need to do ``pip install -e .`` before executing these commands. - Use ``DISABLE_NBSPHINX=1 make html`` to disable notebook rendering (fast mode). - Use ``make html NCORES=`` to have the documentation build in parallel. Using ``make html NCORES=auto`` instructs Sphinx to use all of your device's cores. - Use ``make html SPHINXOPTS=""`` to include additional sphinx options, which can be found `here `_. diff --git a/docs/contributing/development/git_workflow.rst b/docs/contributing/development/git_workflow.rst index b94710ad5e6..1ffd4d85808 100644 --- a/docs/contributing/development/git_workflow.rst +++ b/docs/contributing/development/git_workflow.rst @@ -143,7 +143,7 @@ TARDIS repository clone. #. Install TARDIS_ in develop mode:: - $ python setup.py develop + $ pip install -e . This semi-permanently installs TARDIS on your path in such a way that ``tardis`` is always imported from your repository clone regardless of your @@ -281,7 +281,7 @@ In more detail If you have `Sphinx `_ installed, you can also check that the documentation builds and looks correct:: - python setup.py build_sphinx + make html The last line should just state ``build succeeded``, and should not mention any warnings. (For more details, see the Astropy diff --git a/docs/contributing/development/running_tests.rst b/docs/contributing/development/running_tests.rst index 5ae85734861..b344468c97a 100644 --- a/docs/contributing/development/running_tests.rst +++ b/docs/contributing/development/running_tests.rst @@ -115,13 +115,11 @@ TARDIS prints out the progress: .. code-block:: shell - > python setup.py test --args="--integration=integration.yml -m integration - --generate-reference --less-packets" + > pytest --integration=integration.yml -m integration --generate-reference --less-packets To run the test after having run the ``--generate-references``, all that is needed is: .. code-block:: shell - > python setup.py test --args="--integration=integration.yml -m integration - --less-packets" --remote-data + > pytest --integration=integration.yml -m integration --less-packets --remote-data diff --git a/pyproject.toml b/pyproject.toml index ceb1c365ee6..aa2774b32ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,6 @@ exclude = ''' | build | dist )/ - | setup.py | docs/conf.py | _astropy_init.py ) @@ -56,7 +55,7 @@ exclude = ''' [tool.interrogate] color = true -#exclude = ["setup.py", "docs", "build"] +#exclude = ["docs", "build"] #fail-under = 90 ignore-init-method = true ignore-init-module = true diff --git a/tardis/tests/integration_tests/runner.py b/tardis/tests/integration_tests/runner.py index ccd11b136a8..0902e2996f2 100644 --- a/tardis/tests/integration_tests/runner.py +++ b/tardis/tests/integration_tests/runner.py @@ -22,17 +22,17 @@ help="Run integration tests with less packets.", ) - def run_tests(): args = parser.parse_args() less_packets = "--less-packets" if args.less_packets else "" test_command = [ - "python", - "setup.py", - "test", + "pytest", "--test-path=tardis/tests/integration_tests/test_integration.py", - "--args", - f"--capture=no --integration-tests={args.yaml_filepath} --tardis-refdata={args.tardis_refdata} --remote-data " + "--capture=no", + f"--integration-tests={args.yaml_filepath}", + f"--tardis-refdata={args.tardis_refdata}", + "--remote-data", f"{less_packets}", ] subprocess.call(test_command) + From 2c2bfd8880a6b69b6f1568a1c57eaf8ffc07b00c Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Fri, 16 Aug 2024 19:49:38 +0530 Subject: [PATCH 6/7] updating docs command --- docs/contributing/development/git_workflow.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing/development/git_workflow.rst b/docs/contributing/development/git_workflow.rst index 1ffd4d85808..94a0a7dfce4 100644 --- a/docs/contributing/development/git_workflow.rst +++ b/docs/contributing/development/git_workflow.rst @@ -281,7 +281,7 @@ In more detail If you have `Sphinx `_ installed, you can also check that the documentation builds and looks correct:: - make html + cd docs && make html The last line should just state ``build succeeded``, and should not mention any warnings. (For more details, see the Astropy From c49bf268794cbf6a859056d6af4e4cd761c61d2a Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Mon, 19 Aug 2024 10:51:10 +0530 Subject: [PATCH 7/7] Run black formatter --- tardis/tests/integration_tests/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tardis/tests/integration_tests/runner.py b/tardis/tests/integration_tests/runner.py index 0902e2996f2..0590263f058 100644 --- a/tardis/tests/integration_tests/runner.py +++ b/tardis/tests/integration_tests/runner.py @@ -22,6 +22,7 @@ help="Run integration tests with less packets.", ) + def run_tests(): args = parser.parse_args() less_packets = "--less-packets" if args.less_packets else "" @@ -35,4 +36,3 @@ def run_tests(): f"{less_packets}", ] subprocess.call(test_command) -