Skip to content

Commit c064b5b

Browse files
committed
Merge branch 'AFOS/1.0.0-ReleaseCandidate'
2 parents 2d30092 + 1fbd8c7 commit c064b5b

File tree

345 files changed

+24496
-6139
lines changed

Some content is hidden

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

345 files changed

+24496
-6139
lines changed

.coveragerc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
precision = 2
13+
skip_covered = true
14+
15+
[html]
16+
directory = coverage_html_report
17+
skip_covered = false
18+
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

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,8 @@ dmypy.json
131131
tmp/
132132
.idea/
133133

134-
generated/
134+
generated/
135+
.vscode/
136+
137+
# sonarcube folders
138+
.scannerwork/

.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

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)