Skip to content

Commit 658be9f

Browse files
authored
Merge pull request #16 from jdebacker/Day5
Add materials for Day 5
2 parents 09c19c1 + fc751a4 commit 658be9f

File tree

14 files changed

+2493
-38
lines changed

14 files changed

+2493
-38
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check Black formatting
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-python@v2
11+
- uses: psf/black@stable
12+
with:
13+
options: "-l 79 --check"
14+
src: "."

.github/workflows/run_tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
name: Build Package and Test Source Code [Python 3.11, 3.12]
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, windows-latest]
12+
python-version: ["3.11", "3.12"]
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
20+
- name: Setup Miniconda using Python ${{ matrix.python-version }}
21+
uses: conda-incubator/setup-miniconda@v3
22+
with:
23+
miniconda-version: "latest"
24+
auto-update-conda: true
25+
activate-environment: usitc-env
26+
environment-file: environment.yml
27+
python-version: ${{ matrix.python-version }}
28+
auto-activate-base: false
29+
30+
- name: Build
31+
shell: bash -l {0}
32+
run: |
33+
pip install pytest-cov
34+
pip install pytest-pycodestyle
35+
- name: Test
36+
shell: bash -l {0}
37+
working-directory: ./
38+
run: |
39+
pytest

SparseMatrices/SparseMatrices.ipynb

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -529,44 +529,6 @@
529529
"df_sparse = df.astype(pd.SparseDtype(\"float\", 0))\n",
530530
"df_sparse.info(memory_usage='deep')"
531531
]
532-
},
533-
{
534-
"cell_type": "code",
535-
"execution_count": 58,
536-
"metadata": {},
537-
"outputs": [
538-
{
539-
"data": {
540-
"text/plain": [
541-
"0 216.0\n",
542-
"1 172.0\n",
543-
"2 187.0\n",
544-
"3 188.0\n",
545-
"4 196.0\n",
546-
" ... \n",
547-
"9995 214.0\n",
548-
"9996 193.0\n",
549-
"9997 187.0\n",
550-
"9998 198.0\n",
551-
"9999 197.0\n",
552-
"Length: 10000, dtype: Sparse[float64, 0]"
553-
]
554-
},
555-
"execution_count": 58,
556-
"metadata": {},
557-
"output_type": "execute_result"
558-
}
559-
],
560-
"source": [
561-
"df_sparse.sum()"
562-
]
563-
},
564-
{
565-
"cell_type": "code",
566-
"execution_count": null,
567-
"metadata": {},
568-
"outputs": [],
569-
"source": []
570532
}
571533
],
572534
"metadata": {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import pytest
2+
import numpy as np
3+
4+
5+
# example_test.py
6+
def test_add_numbers():
7+
result = np.add(2, 3)
8+
assert result == 5
9+
10+
11+
def test_empty_list():
12+
my_list = []
13+
assert len(my_list) == 0
14+
assert not my_list
15+
16+
17+
@pytest.fixture
18+
def sample_data():
19+
return {"name": "Test", "value": 42}

Workflow/documenting_code.pdf

202 KB
Binary file not shown.

Workflow/workflow_basics.pdf

141 KB
Binary file not shown.

docs/USITC_logo.png

132 KB
Loading

docs/_config.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
# Book settings
3+
title: US-ITC Python Training
4+
author: Jason DeBacker
5+
logo: USITC_logo.png
6+
# exclude_patterns: [guide/make, guide/templates, recipes/md_src, '**/README.md']
7+
repository:
8+
url: https://github.com/OpenRG/US-ITC
9+
path_to_book: docs
10+
branch: master
11+
html:
12+
use_edit_page_button: true
13+
use_repository_button: true
14+
use_issues_button: true
15+
launch_buttons:
16+
colab_url: "https://colab.research.google.com"
17+
binderhub_url: "https://mybinder.org"
18+
notebook_interface: "classic" # or "jupyterlab"
19+
execute:
20+
execute_notebooks: 'off'
21+
22+
#######################################################################################
23+
# Advanced and power-user settings
24+
sphinx:
25+
extra_extensions : ['sphinx.ext.autodoc', 'sphinx.ext.mathjax',
26+
'sphinx.ext.viewcode', 'sphinx.ext.napoleon',
27+
'alabaster'] # A list of extra extensions to load by Sphinx.
28+
config : # key-value pairs to directly over-ride the Sphinx configuration

docs/_toc.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
format: jb-book
2+
root: index
3+
parts:
4+
- caption: Workflow
5+
chapters:
6+
- file: content/Workflow/README
7+
- caption: SMM with a Nested Fixed Point Algorithm
8+
chapters:
9+
- file: content/JobSearchSMM.ipynb
10+
- caption: Sparse matrices
11+
chapters:
12+
- file: content/sparse_matrices.md

0 commit comments

Comments
 (0)