diff --git a/.nojekyll b/.nojekyll index 5e5f840..3fcfcd5 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -8cba712b \ No newline at end of file +ef1b4c86 \ No newline at end of file diff --git a/03_testing.html b/03_testing.html index eac024d..8af3133 100644 --- a/03_testing.html +++ b/03_testing.html @@ -598,6 +598,37 @@

Profiling - +
+

Makefiles

+
+
    +
  • Makefiles simplify running complex commands.
  • +
  • They act as a single source of truth for how to run your tools.
  • +
  • Self documenting, making it easier to onboard new team members.
  • +
  • Run ‘make <command>’ to run a command from the Makefile.
  • +
  • On Linux by default, for Windows install with MSYS2 or Chocolatey (or use WSL).
  • +
+
+

. . .

+

Example

+
+
+
Makefile
+
+
LIB = my_library
+
+check: lint typecheck test
+
+lint:
+    ruff check $(LIB)
+
+format:
+    ruff format $(LIB)
+
+test:
+    pytest --disable-warnings
+
+

Summary

@@ -612,6 +643,7 @@

Summary

  • Ruff is a fast linter that checks for common errors and style issues.
  • Ruff is also an automatic code formatter that enforces a consistent style.
  • Profiling is a way to measure the performance of your code.
  • +
  • Makefiles simplify project related commands for everyone.
  • diff --git a/03_testing_slides.html b/03_testing_slides.html index 9f60e6f..70ba680 100644 --- a/03_testing_slides.html +++ b/03_testing_slides.html @@ -879,6 +879,38 @@

    Profiling - output

    19 1 500.0 500.0 0.0 return points
    +
    +

    Makefiles

    +
    +
      +
    • Makefiles simplify running complex commands.
    • +
    • They act as a single source of truth for how to run your tools.
    • +
    • Self documenting, making it easier to onboard new team members.
    • +
    • Run ‘make <command>’ to run a command from the Makefile.
    • +
    • On Linux by default, for Windows install with MSYS2 or Chocolatey (or use WSL).
    • +
    +
    +
    +

    Example

    +
    +
    +
    Makefile
    +
    +
    LIB = my_library
    +
    +check: lint typecheck test
    +
    +lint:
    +    ruff check $(LIB)
    +
    +format:
    +    ruff format $(LIB)
    +
    +test:
    +    pytest --disable-warnings
    +
    +
    +

    Summary

    @@ -893,6 +925,7 @@

    Summary

  • Ruff is a fast linter that checks for common errors and style issues.
  • Ruff is also an automatic code formatter that enforces a consistent style.
  • Profiling is a way to measure the performance of your code.
  • +
  • Makefiles simplify project related commands for everyone.
  • diff --git a/search.json b/search.json index bbc1f07..86d7beb 100644 --- a/search.json +++ b/search.json @@ -2372,12 +2372,19 @@ "section": "Profiling - output", "text": "Profiling - output\nInvoking the jupyter magic command lprun with:\n\nfunction to profile - top_neighbors\ncode to run - main()\n\n%lprun -f top_neighbors main()\n\n\nLine # Hits Time Per Hit % Time Line Contents\n==============================================================\n 3 def top_neighbors(points, radius=\"0.1\"):\n 4 \"\"\"Don't use this function, it's only purpose is to be profiled.\"\"\"\n 5 1 2800.0 2800.0 0.0 n = len(points)\n 6 1 353300.0 353300.0 0.0 idx = np.array([int(x) for x in str.split(\"0 \"* n)])\n 7 \n 8 1001 345100.0 344.8 0.0 for i in range(n):\n 9 1001000 378191701.0 377.8 2.2 for j in range(n):\n 10 1000000 328387205.0 328.4 1.9 if i != j:\n 11 999000 1e+10 14473.0 83.8 d = np.sqrt(np.sum((points[i] - points[j])**2))\n 12 999000 933778605.0 934.7 5.4 if d < float(radius): \n 13 28952 57010001.0 1969.1 0.3 idx[i] += 1\n 14 1001 367100.0 366.7 0.0 for i in range(n):\n 15 500500 144295203.0 288.3 0.8 for j in range(n - i - 1):\n 16 499500 302166901.0 604.9 1.8 if idx[j] < idx[j + 1]:\n 17 240227 212070500.0 882.8 1.2 idx[j], idx[j + 1] = idx[j + 1], idx[j]\n 18 240227 437538803.0 1821.4 2.5 points[j], points[j + 1] = points[j + 1], points[j]\n 19 1 500.0 500.0 0.0 return points" }, + { + "objectID": "03_testing_slides.html#makefiles", + "href": "03_testing_slides.html#makefiles", + "title": "Testing, linting and formatting", + "section": "Makefiles", + "text": "Makefiles\n\n\nMakefiles simplify running complex commands.\nThey act as a single source of truth for how to run your tools.\nSelf documenting, making it easier to onboard new team members.\nRun ‘make <command>’ to run a command from the Makefile.\nOn Linux by default, for Windows install with MSYS2 or Chocolatey (or use WSL).\n\n\n\nExample\n\n\nMakefile\n\nLIB = my_library\n\ncheck: lint typecheck test\n\nlint:\n ruff check $(LIB)\n\nformat:\n ruff format $(LIB)\n\ntest:\n pytest --disable-warnings" + }, { "objectID": "03_testing_slides.html#summary", "href": "03_testing_slides.html#summary", "title": "Testing, linting and formatting", "section": "Summary", - "text": "Summary\n\n\nTesting is a way to verify that your code is working as expected.\nUnit tests are small, isolated tests that verify a single logical concept in your code.\nRegression tests are used to verify that your code is still working after changes.\nIntegration tests are used to verify that your code works with other code.\nExceptions are a way to handle errors in your code.\nWarnings are a way to alert users of your code to potential issues or usage errors.\nLinting is a way to check your code for common errors and style issues.\nRuff is a fast linter that checks for common errors and style issues.\nRuff is also an automatic code formatter that enforces a consistent style.\nProfiling is a way to measure the performance of your code.\n\n\n\n\n\n\nPython package development" + "text": "Summary\n\n\nTesting is a way to verify that your code is working as expected.\nUnit tests are small, isolated tests that verify a single logical concept in your code.\nRegression tests are used to verify that your code is still working after changes.\nIntegration tests are used to verify that your code works with other code.\nExceptions are a way to handle errors in your code.\nWarnings are a way to alert users of your code to potential issues or usage errors.\nLinting is a way to check your code for common errors and style issues.\nRuff is a fast linter that checks for common errors and style issues.\nRuff is also an automatic code formatter that enforces a consistent style.\nProfiling is a way to measure the performance of your code.\nMakefiles simplify project related commands for everyone.\n\n\n\n\n\n\nPython package development" }, { "objectID": "03_testing.html", @@ -2582,12 +2589,19 @@ "section": "Profiling - output", "text": "Profiling - output\nInvoking the jupyter magic command lprun with:\n\nfunction to profile - top_neighbors\ncode to run - main()\n\n%lprun -f top_neighbors main()\n. . .\n\nLine # Hits Time Per Hit % Time Line Contents\n==============================================================\n 3 def top_neighbors(points, radius=\"0.1\"):\n 4 \"\"\"Don't use this function, it's only purpose is to be profiled.\"\"\"\n 5 1 2800.0 2800.0 0.0 n = len(points)\n 6 1 353300.0 353300.0 0.0 idx = np.array([int(x) for x in str.split(\"0 \"* n)])\n 7 \n 8 1001 345100.0 344.8 0.0 for i in range(n):\n 9 1001000 378191701.0 377.8 2.2 for j in range(n):\n 10 1000000 328387205.0 328.4 1.9 if i != j:\n 11 999000 1e+10 14473.0 83.8 d = np.sqrt(np.sum((points[i] - points[j])**2))\n 12 999000 933778605.0 934.7 5.4 if d < float(radius): \n 13 28952 57010001.0 1969.1 0.3 idx[i] += 1\n 14 1001 367100.0 366.7 0.0 for i in range(n):\n 15 500500 144295203.0 288.3 0.8 for j in range(n - i - 1):\n 16 499500 302166901.0 604.9 1.8 if idx[j] < idx[j + 1]:\n 17 240227 212070500.0 882.8 1.2 idx[j], idx[j + 1] = idx[j + 1], idx[j]\n 18 240227 437538803.0 1821.4 2.5 points[j], points[j + 1] = points[j + 1], points[j]\n 19 1 500.0 500.0 0.0 return points" }, + { + "objectID": "03_testing.html#makefiles", + "href": "03_testing.html#makefiles", + "title": "Testing, linting and formatting", + "section": "Makefiles", + "text": "Makefiles\n\n\nMakefiles simplify running complex commands.\nThey act as a single source of truth for how to run your tools.\nSelf documenting, making it easier to onboard new team members.\nRun ‘make <command>’ to run a command from the Makefile.\nOn Linux by default, for Windows install with MSYS2 or Chocolatey (or use WSL).\n\n\n. . .\nExample\n\n\nMakefile\n\nLIB = my_library\n\ncheck: lint typecheck test\n\nlint:\n ruff check $(LIB)\n\nformat:\n ruff format $(LIB)\n\ntest:\n pytest --disable-warnings" + }, { "objectID": "03_testing.html#summary", "href": "03_testing.html#summary", "title": "Testing, linting and formatting", "section": "Summary", - "text": "Summary\n\n\nTesting is a way to verify that your code is working as expected.\nUnit tests are small, isolated tests that verify a single logical concept in your code.\nRegression tests are used to verify that your code is still working after changes.\nIntegration tests are used to verify that your code works with other code.\nExceptions are a way to handle errors in your code.\nWarnings are a way to alert users of your code to potential issues or usage errors.\nLinting is a way to check your code for common errors and style issues.\nRuff is a fast linter that checks for common errors and style issues.\nRuff is also an automatic code formatter that enforces a consistent style.\nProfiling is a way to measure the performance of your code." + "text": "Summary\n\n\nTesting is a way to verify that your code is working as expected.\nUnit tests are small, isolated tests that verify a single logical concept in your code.\nRegression tests are used to verify that your code is still working after changes.\nIntegration tests are used to verify that your code works with other code.\nExceptions are a way to handle errors in your code.\nWarnings are a way to alert users of your code to potential issues or usage errors.\nLinting is a way to check your code for common errors and style issues.\nRuff is a fast linter that checks for common errors and style issues.\nRuff is also an automatic code formatter that enforces a consistent style.\nProfiling is a way to measure the performance of your code.\nMakefiles simplify project related commands for everyone." }, { "objectID": "01_version_control_slides.html#why-use-version-control", diff --git a/sitemap.xml b/sitemap.xml index 7de6bc7..6ca94c4 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,142 +2,142 @@ https://DHI.github.io/python-package-development/projects/data_cleaning/03_Project_module.html - 2024-10-04T10:08:50.713Z + 2024-10-04T10:58:44.835Z https://DHI.github.io/python-package-development/projects/data_cleaning/notebook_A.html - 2024-10-04T10:08:50.714Z + 2024-10-04T10:58:44.836Z https://DHI.github.io/python-package-development/projects/data_cleaning/07_Project_module.html - 2024-10-04T10:08:50.714Z + 2024-10-04T10:58:44.835Z https://DHI.github.io/python-package-development/projects/data_cleaning/01_Project_module.html - 2024-10-04T10:08:50.713Z + 2024-10-04T10:58:44.835Z https://DHI.github.io/python-package-development/projects/data_cleaning/clean_project_data_v4_final2.html - 2024-10-04T10:08:50.714Z + 2024-10-04T10:58:44.836Z https://DHI.github.io/python-package-development/06_documentation.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.826Z https://DHI.github.io/python-package-development/06_documentation_slides.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.826Z https://DHI.github.io/python-package-development/05_oop.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.826Z https://DHI.github.io/python-package-development/05_oop_slides.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.826Z https://DHI.github.io/python-package-development/02_function_classes.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/02_function_classes_slides.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/group_work/05_module.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.827Z https://DHI.github.io/python-package-development/group_work/04_module.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.827Z https://DHI.github.io/python-package-development/group_work/02_module.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.827Z https://DHI.github.io/python-package-development/group_work/index.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.827Z https://DHI.github.io/python-package-development/04_dependencies_ci.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/04_dependencies_ci_slides.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/index.html - 2024-10-04T10:08:50.713Z + 2024-10-04T10:58:44.835Z https://DHI.github.io/python-package-development/07_packaging_slides.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.826Z https://DHI.github.io/python-package-development/07_packaging.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.826Z https://DHI.github.io/python-package-development/00_introduction.html - 2024-10-04T10:08:50.703Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/group_work/07_module.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.827Z https://DHI.github.io/python-package-development/group_work/01_module.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.827Z https://DHI.github.io/python-package-development/group_work/03_module.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.827Z https://DHI.github.io/python-package-development/group_work/06_module.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.827Z https://DHI.github.io/python-package-development/course_structure.html - 2024-10-04T10:08:50.705Z + 2024-10-04T10:58:44.826Z https://DHI.github.io/python-package-development/03_testing_slides.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/03_testing.html - 2024-10-04T10:08:50.704Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/01_version_control_slides.html - 2024-10-04T10:08:50.703Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/01_version_control.html - 2024-10-04T10:08:50.703Z + 2024-10-04T10:58:44.825Z https://DHI.github.io/python-package-development/projects/data_cleaning/02_Project_module.html - 2024-10-04T10:08:50.713Z + 2024-10-04T10:58:44.835Z https://DHI.github.io/python-package-development/projects/data_cleaning/index.html - 2024-10-04T10:08:50.714Z + 2024-10-04T10:58:44.836Z https://DHI.github.io/python-package-development/projects/data_cleaning/06_Project_module.html - 2024-10-04T10:08:50.714Z + 2024-10-04T10:58:44.835Z https://DHI.github.io/python-package-development/projects/data_cleaning/05_Project_module.html - 2024-10-04T10:08:50.714Z + 2024-10-04T10:58:44.835Z https://DHI.github.io/python-package-development/projects/data_cleaning/04_Project_module.html - 2024-10-04T10:08:50.713Z + 2024-10-04T10:58:44.835Z