Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Nov 15, 2023
1 parent 6ec71dc commit a1884b7
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d4b30a88
509f3865
2 changes: 1 addition & 1 deletion 04_dependencies_ci.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<!-- margin-sidebar -->
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">

<div class="quarto-alternate-formats"><h2>Other Formats</h2><ul><li><a href="04-dependencies_ci_slides.html"><i class="bi bi-file-slides"></i>RevealJS</a></li></ul></div></div>
<div class="quarto-alternate-formats"><h2>Other Formats</h2><ul><li><a href="04_dependencies_ci_slides.html"><i class="bi bi-file-slides"></i>RevealJS</a></li></ul></div></div>
<!-- main -->
<main class="content" id="quarto-document-content">

Expand Down
2 changes: 1 addition & 1 deletion 04_dependencies_ci.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Dependencies and Continuous Integration"
format:
html: default
revealjs:
output-file: 04-dependencies_ci_slides.html
output-file: 04_dependencies_ci_slides.html
slide-number: true
footer: Python package development
logo: academy_logo.png
Expand Down
File renamed without changes.
6 changes: 5 additions & 1 deletion group_work/module_04.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@

<section id="module-04" class="level2">
<h2 class="anchored" data-anchor-id="module-04">Module 04</h2>
<p>In progress…</p>
<ul>
<li>Q1: In your course project homework from last module, you separated the classes into separate files, how did it go? In some programming language, the convention is to put each class into a separate file, it this always a good practice?</li>
<li>Q2: One of the goals with this course is to be able to create software in a collaborative way, have you experienced or can you image any challenges with creating software in a collaborative way? What could be done to mitigate these challenges?</li>
<li>Q3: Have you have problems with conflicting dependencies in the past? (E.g. some library needs a specific version of another library, but you need a different version of the same library for another part of your code.) How did you solve it?</li>
</ul>
<p><a href="../group_work/index.html">Back to overview</a></p>


Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ <h2 class="anchored" data-anchor-id="learning-modules">Learning modules</h2>
<li><a href="./04_dependencies_ci.html">Dependencies and GitHub actions</a> <a href="04_dependencies_ci_slides.html">🛝</a>
<ul>
<li><a href="./projects/data_cleaning/Project_module_04.html">Homework</a></li>
<li><a href="./group_work/module_04.html">Discussion</a></li>
</ul></li>
<li><a href="./05_oop.html">Object oriented design in Python</a> <a href="05_oop_slides.html">🛝</a>
<ul>
Expand Down
70 changes: 35 additions & 35 deletions search.json
Original file line number Diff line number Diff line change
Expand Up @@ -1544,14 +1544,14 @@
"href": "group_work/module_04.html",
"title": "Python package development",
"section": "",
"text": "In progress…\nBack to overview"
"text": "Q1: In your course project homework from last module, you separated the classes into separate files, how did it go? In some programming language, the convention is to put each class into a separate file, it this always a good practice?\nQ2: One of the goals with this course is to be able to create software in a collaborative way, have you experienced or can you image any challenges with creating software in a collaborative way? What could be done to mitigate these challenges?\nQ3: Have you have problems with conflicting dependencies in the past? (E.g. some library needs a specific version of another library, but you need a different version of the same library for another part of your code.) How did you solve it?\n\nBack to overview"
},
{
"objectID": "group_work/module_04.html#module-04",
"href": "group_work/module_04.html#module-04",
"title": "Python package development",
"section": "",
"text": "In progress…\nBack to overview"
"text": "Q1: In your course project homework from last module, you separated the classes into separate files, how did it go? In some programming language, the convention is to put each class into a separate file, it this always a good practice?\nQ2: One of the goals with this course is to be able to create software in a collaborative way, have you experienced or can you image any challenges with creating software in a collaborative way? What could be done to mitigate these challenges?\nQ3: Have you have problems with conflicting dependencies in the past? (E.g. some library needs a specific version of another library, but you need a different version of the same library for another part of your code.) How did you solve it?\n\nBack to overview"
},
{
"objectID": "group_work/index.html",
Expand Down Expand Up @@ -2174,7 +2174,7 @@
"href": "index.html#learning-modules",
"title": "Python package development",
"section": "Learning modules",
"text": "Learning modules\n\nGit, Pull Requests, and code reviews 🛝\n\nDiscussion\nHomework\n\nPython functions, classes, and modules 🛝\n\nDiscussion\nHomework\n\nTesting and auto-formatting 🛝\n\nDiscussion\nHomework\n\nDependencies and GitHub actions 🛝\n\nHomework\n\nObject oriented design in Python 🛝\n\nHomework\n\nDocumentation 🛝\n\nHomework\n\nDistributing your package 🛝\n\nHomework\n\n\n©️ DHI 2023"
"text": "Learning modules\n\nGit, Pull Requests, and code reviews 🛝\n\nDiscussion\nHomework\n\nPython functions, classes, and modules 🛝\n\nDiscussion\nHomework\n\nTesting and auto-formatting 🛝\n\nDiscussion\nHomework\n\nDependencies and GitHub actions 🛝\n\nHomework\nDiscussion\n\nObject oriented design in Python 🛝\n\nHomework\n\nDocumentation 🛝\n\nHomework\n\nDistributing your package 🛝\n\nHomework\n\n\n©️ DHI 2023"
},
{
"objectID": "07_packaging_slides.html#packaging",
Expand Down Expand Up @@ -2674,113 +2674,113 @@
"text": "Thank you!"
},
{
"objectID": "04-dependencies_ci_slides.html#section",
"href": "04-dependencies_ci_slides.html#section",
"objectID": "04_dependencies_ci_slides.html#section",
"href": "04_dependencies_ci_slides.html#section",
"title": "Dependencies and Continuous Integration",
"section": "",
"text": "Application\nA program that is run by a user\n\ncommand line tool\nscript\nweb application\n\nPin versions to ensure reproducibility, e.g. numpy==1.11.0\n\nLibrary\nA program that is used by another program\n\nPython package\nLow level library (C, Fortran, Rust, …)\n\nMake the requirements as loose as possible, e.g. numpy&gt;=1.11.0\n\n\n\nMake the requirements loose, to avoid conflicts with other packages."
},
{
"objectID": "04-dependencies_ci_slides.html#dependency-management",
"href": "04-dependencies_ci_slides.html#dependency-management",
"objectID": "04_dependencies_ci_slides.html#dependency-management",
"href": "04_dependencies_ci_slides.html#dependency-management",
"title": "Dependencies and Continuous Integration",
"section": "Dependency management",
"text": "Dependency management\nExample of pinning versions:\n\n\nrequirements.txt\n\nnumpy==1.11.0\nscipy==0.17.0\nmatplotlib==1.5.1\n\n\nOr using a range of versions:\n\n\nrequirements.txt\n\nnumpy&gt;=1.11.0\nscipy&gt;=0.17.0\nmatplotlib&gt;=1.5.1,&lt;=2.0.0\n\n\n\nInstall dependencies:\n$ pip install -r requirements.txt\n\nA common way to declare dependencies is to use a requirements.txt file."
},
{
"objectID": "04-dependencies_ci_slides.html#creating-an-installable-package",
"href": "04-dependencies_ci_slides.html#creating-an-installable-package",
"objectID": "04_dependencies_ci_slides.html#creating-an-installable-package",
"href": "04_dependencies_ci_slides.html#creating-an-installable-package",
"title": "Dependencies and Continuous Integration",
"section": "Creating an installable package",
"text": "Creating an installable package"
},
{
"objectID": "04-dependencies_ci_slides.html#setup.py-vs-pyproject.toml",
"href": "04-dependencies_ci_slides.html#setup.py-vs-pyproject.toml",
"objectID": "04_dependencies_ci_slides.html#setup.py-vs-pyproject.toml",
"href": "04_dependencies_ci_slides.html#setup.py-vs-pyproject.toml",
"title": "Dependencies and Continuous Integration",
"section": "setup.py vs pyproject.toml",
"text": "setup.py vs pyproject.toml\nsetup.py\n\nTraditional approach to defining package configuration and dependencies.\nDefines metadata, dependencies, and entry points in a Python script.\nUses setuptools to generate packages and install the package.\n\n\npyproject.toml\n\nModern approach to defining package configuration and dependencies.\nDefines metadata, dependencies, build tools, and packaging config in a TOML file.\nUses poetry or hatchling to generate packages and install the package."
},
{
"objectID": "04-dependencies_ci_slides.html#install-with-optional-dependencies",
"href": "04-dependencies_ci_slides.html#install-with-optional-dependencies",
"objectID": "04_dependencies_ci_slides.html#install-with-optional-dependencies",
"href": "04_dependencies_ci_slides.html#install-with-optional-dependencies",
"title": "Dependencies and Continuous Integration",
"section": "Install with optional dependencies",
"text": "Install with optional dependencies\n\n\npyproject.toml\n\n[project.optional-dependencies]\ndev = [\"pytest\",\n \"black==22.3.0\",\n \"sphinx\",\n \"sphinx-rtd-theme\",\n \"myst-parser\",\n ]\n\ntest = [\"pytest\", \"pytest-cov\"]\n\n \n$ pip install mini[test]"
},
{
"objectID": "04-dependencies_ci_slides.html#creating-an-installable-package-1",
"href": "04-dependencies_ci_slides.html#creating-an-installable-package-1",
"objectID": "04_dependencies_ci_slides.html#creating-an-installable-package-1",
"href": "04_dependencies_ci_slides.html#creating-an-installable-package-1",
"title": "Dependencies and Continuous Integration",
"section": "Creating an installable package",
"text": "Creating an installable package\nInstall package in editable mode:\n$ pip install -e .\n\nStart a Python session:\n&gt;&gt;&gt; import mini\n&gt;&gt;&gt; mini.foo()\n42\n\n\nRun tests:\n$ pytest\n...\n\ntests/test_foo.py . [100%]\n\n=============== 1 passed in 0.01s ==============="
},
{
"objectID": "04-dependencies_ci_slides.html#virtual-environments",
"href": "04-dependencies_ci_slides.html#virtual-environments",
"objectID": "04_dependencies_ci_slides.html#virtual-environments",
"href": "04_dependencies_ci_slides.html#virtual-environments",
"title": "Dependencies and Continuous Integration",
"section": "Virtual environments",
"text": "Virtual environments\n\n\nCreates a clean environment for each project\nAllows different versions of a package to coexist on your machine\nCan be used to create a reproducible environment for a project\nTo achieve complete isolation, use Docker containers (not covered in this course)"
},
{
"objectID": "04-dependencies_ci_slides.html#virtual-environments-1",
"href": "04-dependencies_ci_slides.html#virtual-environments-1",
"objectID": "04_dependencies_ci_slides.html#virtual-environments-1",
"href": "04_dependencies_ci_slides.html#virtual-environments-1",
"title": "Dependencies and Continuous Integration",
"section": "Virtual environments",
"text": "Virtual environments\n$ which python\n/usr/bin/python\n$ python -m venv venv\n$ source venv/bin/activate # for 🐧 or venv\\Scripts\\activate.bat 🪟\n(venv)$ which python\n/home/user/src/myproj/venv/bin/python\n(venv)$ pip install -r requirements.txt\n\n\nBack in the days, when disk space was limited, it was a good idea to have a separate environment for each project.\nToday, disk space is cheap, and it is a good idea to have a separate environment for each project."
},
{
"objectID": "04-dependencies_ci_slides.html#condamamba-environments",
"href": "04-dependencies_ci_slides.html#condamamba-environments",
"objectID": "04_dependencies_ci_slides.html#condamamba-environments",
"href": "04_dependencies_ci_slides.html#condamamba-environments",
"title": "Dependencies and Continuous Integration",
"section": "Conda/mamba environments",
"text": "Conda/mamba environments\nConda/mamba is a package manager that can be used to create virtual environments.\n$ where python\nC:\\Users\\JAN\\AppData\\Local\\miniforge3\\python.exe\n$ conda create -n myproj -f requirements.txt\n$ conda activate myproj\n(myproj)$ where python\nC:\\Users\\JAN\\AppData\\Local\\miniforge3\\envs\\myproj\\python.exe"
},
{
"objectID": "04-dependencies_ci_slides.html#continuous-integration",
"href": "04-dependencies_ci_slides.html#continuous-integration",
"objectID": "04_dependencies_ci_slides.html#continuous-integration",
"href": "04_dependencies_ci_slides.html#continuous-integration",
"title": "Dependencies and Continuous Integration",
"section": "Continuous Integration",
"text": "Continuous Integration\nRunning tests on every commit in a well defined environment ensures that the code is working as expected.\nIt solves the “it works on my machine” problem.\nExecuting code on a remote server is a good way to ensure that the code is working as expected.\nThere are many CI services available, e.g.:\n\nGitHub Actions\nAzure Pipelines\nTravis CI\nCircle CI\n\n\nGitHub Actions was forked from Azure Pipelines and runs on the same type of infrastructure, thus are very similar technologies."
},
{
"objectID": "04-dependencies_ci_slides.html#github-actions",
"href": "04-dependencies_ci_slides.html#github-actions",
"objectID": "04_dependencies_ci_slides.html#github-actions",
"href": "04_dependencies_ci_slides.html#github-actions",
"title": "Dependencies and Continuous Integration",
"section": "GitHub Actions",
"text": "GitHub Actions\n\n\n\nWorkflow are stored in the .github/workflows folder.\nWorkflow is described in a YAML file.\nYAML is whitespace sensitive (like Python).\nYAML can contain lists, dictionaries and strings, and can be nested.\n\n\n$ tree mikeio/.github/\nmikeio/.github/\n└── workflows\n ├── docs.yml\n ├── downstream_test.yml\n ├── full_test.yml\n ├── notebooks_test.yml\n ├── perf_test.yml\n ├── python-publish.yml\n └── quick_test.yml"
},
{
"objectID": "04-dependencies_ci_slides.html#benefits-of-ci",
"href": "04-dependencies_ci_slides.html#benefits-of-ci",
"objectID": "04_dependencies_ci_slides.html#benefits-of-ci",
"href": "04_dependencies_ci_slides.html#benefits-of-ci",
"title": "Dependencies and Continuous Integration",
"section": "Benefits of CI",
"text": "Benefits of CI\n\n\nRun tests on every commit\nTest on different operating systems\nTest on different Python versions\nCreate API documentation (next week)\nPublish package to PyPI or similar package repository (two weeks from now)"
},
{
"objectID": "04-dependencies_ci_slides.html#triggers",
"href": "04-dependencies_ci_slides.html#triggers",
"objectID": "04_dependencies_ci_slides.html#triggers",
"href": "04_dependencies_ci_slides.html#triggers",
"title": "Dependencies and Continuous Integration",
"section": "Triggers",
"text": "Triggers\n\npush and pull_request are the most common triggers\nschedule can be used to run the workflow on a schedule\nworkflow_dispatch can be used to trigger the workflow manually\n\non:\n push:\n branches: [ main ]\n pull_request:\n branches: [ main ]\n schedule:\n - cron: '0 0 * * 0'\n workflow_dispatch:"
},
{
"objectID": "04-dependencies_ci_slides.html#jobs",
"href": "04-dependencies_ci_slides.html#jobs",
"objectID": "04_dependencies_ci_slides.html#jobs",
"href": "04_dependencies_ci_slides.html#jobs",
"title": "Dependencies and Continuous Integration",
"section": "Jobs",
"text": "Jobs\n\nOperating system\nPython version\n\n\n{.yaml\"} ... jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest] python-version: [3.8, 3.9, \"3.10\",\"3.11\"] ..."
},
{
"objectID": "04-dependencies_ci_slides.html#github-releases",
"href": "04-dependencies_ci_slides.html#github-releases",
"objectID": "04_dependencies_ci_slides.html#github-releases",
"href": "04_dependencies_ci_slides.html#github-releases",
"title": "Dependencies and Continuous Integration",
"section": "GitHub Releases",
"text": "GitHub Releases\n\n\n\nGitHub releases are a way to publish software releases.\nYou can upload files, write release notes and tag the release.\nAs a minimum, the release will contain the source code at the time of the release.\nCreating a release can trigger other workflows, e.g. publishing a package to PyPI.\n\n\n\n\n\nhttps://github.com/pydata/xarray/releases/tag/v2022.12.0"
},
{
"objectID": "04-dependencies_ci_slides.html#summary",
"href": "04-dependencies_ci_slides.html#summary",
"objectID": "04_dependencies_ci_slides.html#summary",
"href": "04_dependencies_ci_slides.html#summary",
"title": "Dependencies and Continuous Integration",
"section": "Summary",
"text": "Summary\n\n\nApplication vs library\nPrefer pyproject.toml over setup.py\nUse a separate virtual environment for each project\nUse GitHub Actions to run tests on every commit\nUse GitHub Releases to publish software releases\n\n\n\n\n\nPython package development"
Expand Down
Loading

0 comments on commit a1884b7

Please sign in to comment.