Skip to content

Commit 1a24af2

Browse files
committed
Merge organized commits from temp-commit-organization
2 parents 3ef2df5 + ac4a4b0 commit 1a24af2

File tree

335 files changed

+26018
-6093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

335 files changed

+26018
-6093
lines changed

.coveragerc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[run]
2+
source = cosmotech.coal
3+
omit =
4+
*/tests/*
5+
*/site-packages/*
6+
*/__pycache__/*
7+
8+
[report]
9+
exclude_lines =
10+
pragma: no cover
11+
def __repr__
12+
raise NotImplementedError
13+
raise ImportError
14+
precision = 2
15+
skip_covered = true
16+
17+
[html]
18+
directory = coverage_html_report
19+
skip_covered = false
20+
skip_empty = true
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Check Untested Functions
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
check-untested-functions:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e ".[test]"
25+
26+
- name: Run untested functions check
27+
run: |
28+
python find_untested_functions.py
29+
# This is informational only for now, will not fail the build
30+
# In the future, we can make this fail the build by adding:
31+
# exit $(python find_untested_functions.py | grep "Total untested functions:" | awk '{print $4}')

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.11'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install -r requirements.dev.txt
22+
- name: Check code formatting with Black
23+
run: |
24+
black --check .

.github/workflows/linter.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e ".[test]"
25+
26+
- name: Run tests with coverage
27+
run: |
28+
pytest tests/unit/coal/ --cov=cosmotech.coal --cov-report=term

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-added-large-files
8+
9+
- repo: https://github.com/psf/black
10+
rev: 23.3.0
11+
hooks:
12+
- id: black
13+
14+
- repo: local
15+
hooks:
16+
- id: pytest-check
17+
name: pytest-check
18+
entry: pytest tests/unit/coal/ --cov=cosmotech.coal --cov-report=term-missing --cov-fail-under=90
19+
language: system
20+
pass_filenames: false
21+
always_run: true
22+
- id: check-untested-functions
23+
name: check-untested-functions
24+
entry: python find_untested_functions.py
25+
language: system
26+
pass_filenames: false
27+
always_run: true

.vscode/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# VSCode Configuration for CosmoTech-Acceleration-Library
2+
3+
This directory contains VSCode-specific settings to enhance the development experience for this project.
4+
5+
## settings.json
6+
7+
The `settings.json` file configures VSCode to:
8+
9+
1. Use Black as the Python formatter
10+
2. Format Python files automatically on save
11+
3. Set the line length to 88 characters (Black's default)
12+
4. Organize imports automatically on save
13+
14+
## Usage
15+
16+
These settings will be applied automatically when you open this project in VSCode. Make sure you have the following extensions installed:
17+
18+
- [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
19+
20+
## Installing Black
21+
22+
To use the Black formatter, you need to install it:
23+
24+
```bash
25+
pip install -r requirements.dev.txt
26+
```
27+
28+
Or install Black directly:
29+
30+
```bash
31+
pip install black==23.3.0

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"python.formatting.provider": "black",
3+
"editor.formatOnSave": true,
4+
"python.formatting.blackArgs": [
5+
"--line-length",
6+
"120"
7+
],
8+
"[python]": {
9+
"editor.defaultFormatter": "ms-python.python",
10+
"editor.formatOnSave": true,
11+
"editor.codeActionsOnSave": {
12+
"source.organizeImports": "explicit"
13+
}
14+
}
15+
}

BLACK_SETUP.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Black Code Formatter Setup
2+
3+
This project uses [Black](https://github.com/psf/black) for code formatting to ensure consistent code style across the codebase.
4+
5+
## Configuration
6+
7+
Black is configured in the `pyproject.toml` file with the following settings:
8+
9+
```toml
10+
[tool.black]
11+
line-length = 120
12+
target-version = ["py311"]
13+
include = '\.pyi?$'
14+
exclude = '''
15+
/(
16+
\.git
17+
| \.hg
18+
| \.mypy_cache
19+
| \.tox
20+
| \.venv
21+
| _build
22+
| buck-out
23+
| build
24+
| dist
25+
| generated
26+
| __pycache__
27+
)/
28+
'''
29+
```
30+
31+
## Installation
32+
33+
Install Black and other development tools:
34+
35+
```bash
36+
pip install -r requirements.dev.txt
37+
```
38+
39+
Or install Black directly:
40+
41+
```bash
42+
pip install black==23.3.0
43+
```
44+
45+
## Usage
46+
47+
### Manual Usage
48+
49+
Run Black on your codebase:
50+
51+
```bash
52+
# Format all Python files in the project
53+
python -m black .
54+
55+
# Format a specific directory
56+
python -m black cosmotech/coal/
57+
58+
# Check if files would be reformatted without actually changing them
59+
python -m black --check .
60+
61+
# Show diff of changes without writing files
62+
python -m black --diff .
63+
```
64+
65+
### Pre-commit Hooks
66+
67+
This project uses pre-commit hooks to automatically run Black before each commit. To set up pre-commit:
68+
69+
1. Install pre-commit:
70+
71+
```bash
72+
pip install pre-commit
73+
```
74+
75+
2. Install the git hooks:
76+
77+
```bash
78+
pre-commit install
79+
```
80+
81+
Now Black will run automatically on the files you've changed when you commit.
82+
83+
### VSCode Integration
84+
85+
If you use VSCode, the included settings in `.vscode/settings.json` will automatically format your code with Black when you save a file. Make sure you have the Python extension installed.
86+
87+
## CI Integration
88+
89+
To enforce Black formatting in your CI pipeline, add a step to run Black in check mode:
90+
91+
```yaml
92+
- name: Check code formatting with Black
93+
run: |
94+
python -m pip install black==23.3.0
95+
python -m black --check .
96+
```
97+
98+
## Migrating Existing Code
99+
100+
When first applying Black to an existing codebase, you might want to:
101+
102+
1. Run Black with `--diff` first to see the changes
103+
2. Consider running it on one module at a time
104+
3. Make the formatting change in a separate commit from functional changes
105+
106+
## Benefits of Using Black
107+
108+
- Eliminates debates about formatting
109+
- Consistent code style across the entire codebase
110+
- Minimal configuration needed
111+
- Widely adopted in the Python community

0 commit comments

Comments
 (0)