Skip to content

Commit

Permalink
Merge branch 'develop' into oxidationstates24
Browse files Browse the repository at this point in the history
  • Loading branch information
AntObi authored Nov 19, 2024
2 parents 9125edb + 1636ad7 commit 99acd4e
Show file tree
Hide file tree
Showing 136 changed files with 109,056 additions and 7,919 deletions.
7 changes: 3 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] Test B

**Test Configuration**:
* Python version:
* Operating System:

- Python version:
- Operating System:

## Reviewers

@mention individuals who you specifically want to involve in the discussion for this pull request and mention why they are needed in the discussion/why they are needed to review the pull request.


## Checklist:
## Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
Expand Down
2 changes: 1 addition & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ changelog:
- title: 🏥 Package Health
labels: [pkg]
- title: 🤷‍♂️ Other Changes
labels: ["*"]
labels: ["*"]
50 changes: 23 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
- master

jobs:

qa:
runs-on: ubuntu-latest
steps:
Expand All @@ -19,31 +18,28 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9","3.10","3.11","3.12"]
os: [ubuntu-latest,macos-latest,windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -e .
pip install pytest-cov
- name: Run tests and collect coverage
run: python -m pytest --cov=smact --cov-report=xml -v
- name: Upload coverage reports to CodeCov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
#files: ./coverage.xml
fail_ci_if_error: False
env_vars: OS,PYTHON
verbose: true



- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -e .
pip install pytest-cov
- name: Run tests and collect coverage
run: python -m pytest --cov=smact --cov-report=xml -v
- name: Upload coverage reports to CodeCov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
#files: ./coverage.xml
fail_ci_if_error: False
env_vars: OS,PYTHON
verbose: true
22 changes: 11 additions & 11 deletions .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
name: 'Combine PRs'
name: "Combine PRs"

# Controls when the action will run - in this case triggered manually
on:
workflow_dispatch:
inputs:
branchPrefix:
description: 'Branch prefix to find combinable PRs based on'
description: "Branch prefix to find combinable PRs based on"
required: true
default: 'dependabot'
default: "dependabot"
mustBeGreen:
description: 'Only combine PRs that are green (status is success)'
description: "Only combine PRs that are green (status is success)"
required: true
default: true
combineBranchName:
description: 'Name of the branch to combine PRs into'
description: "Name of the branch to combine PRs into"
required: true
default: 'combine-prs-branch'
default: "combine-prs-branch"
ignoreLabel:
description: 'Exclude PRs with this label'
description: "Exclude PRs with this label"
required: true
default: 'nocombine'
default: "nocombine"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?');
return;
}
let combinedPRs = [];
let mergeFailedPRs = [];
for(const { branch, prString } of branchesAndPRStrings) {
Expand All @@ -133,7 +133,7 @@ jobs:
mergeFailedPRs.push(prString);
}
}
console.log('Creating combined PR');
const combinedPRsString = combinedPRs.join('\n');
let body = '✅ This PR was created by the Combine PRs action by combining the following PRs:\n' + combinedPRsString;
Expand All @@ -148,4 +148,4 @@ jobs:
head: '${{ github.event.inputs.combineBranchName }}',
base: baseBranch,
body: body
});
});
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish SMACT distributions to PyPI
on:
push:
tags:
- 'v*'
- "v*"

jobs:
build-n-publish:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,4 @@ $RECYCLE.BIN/

*.swp

*.bak
*.bak
89 changes: 66 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,67 @@
repos:
- repo: https://github.com/timothycrosley/isort
rev: "5.12.0"
hooks:
- id: isort
additional_dependencies: [toml]
args: ["--profile", "black", "--filter-files","--line-length=80"]
- repo: https://github.com/psf/black
rev: "23.1.0"
hooks:
- id: black-jupyter
args: [--line-length=80]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/nbQA-dev/nbQA
rev: "1.6.1"
hooks:
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==3.3.1]
args: [--py38-plus]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
hooks:
# Run the linting tool
- id: ruff
types_or: [python, pyi]
args: [--fix]
# Run the formatter
- id: ruff-format
types_or: [python, pyi] # TODO: Fix notebooks to remove this
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint
# MD013: line too long
# MD024: Multiple headings with the same content
# MD033: no inline HTML
# MD041: first line in a file should be a top-level heading
# MD025: single title
args:
[
--ignore,
"dev_docs/design_docs/*",
--disable,
MD013,
MD024,
MD025,
MD033,
MD041,
"--",
]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args: [--write] # edit files in-place
additional_dependencies:
- prettier
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args: [--drop-empty-cells, --keep-output]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
stages: [commit, commit-msg]
args: [--toml, pyproject.toml]
additional_dependencies:
- tomli
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.376
hooks:
- id: pyright
args: [--level, error]
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.18.0
hooks:
- id: blacken-docs
8 changes: 4 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: 2

build:
os: "ubuntu-20.04"
os: "ubuntu-22.04"
tools:
python: "3.8"
python: "3.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
configuration: docs/conf.py

# Explicitly set the version of Python and its requirements
python:
install:
- requirements: docs/requirements.txt
- requirements: docs/requirements.txt
50 changes: 50 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contributing

This is a quick guide on how to follow best practice and contribute smoothly to `SMACT`.

## Workflow

We follow the [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow), using
branches for new work and pull requests for verifying the work.

The steps for a new piece of work can be summarised as follows:

1. Push up or create [an issue](https://github.com/WMD-group/SMACT/issues).
2. Create a branch from main, with a sensible name that relates to the issue.
3. Do the work and commit changes to the branch. Push the branch
regularly to GitHub to make sure no work is accidentally lost.
4. Write or update unit tests for the code you work on.
5. When you are finished with the work, ensure that all of the unit
tests pass on your own machine.
6. Open a pull request [on the pull request page](https://github.com/WMD-group/SMACT/pulls).
7. If nobody acknowledges your pull request promptly, feel free to poke one of the main developers into action.

## Pull requests

For a general overview of using pull requests on GitHub look [in the GitHub docs](https://help.github.com/en/articles/about-pull-requests).

When creating a pull request you should:

- Ensure that the title succinctly describes the changes so it is easy to read on the overview page
- Reference the issue which the pull request is closing

Recommended reading: [How to Write the Perfect Pull Request](https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/)

## Dev requirements

When developing locally, it is recommended to install the python packages in `requirements-dev.txt`.

```bash
pip install -r requirements-dev.txt
```

This will allow you to run the tests locally with pytest as described in the main README,
as well as run pre-commit hooks to automatically format python files with isort and black.
To install the pre-commit hooks (only needs to be done once):

```bash
pre-commit install
pre-commit run --all-files # optionally run hooks on all files
```

Pre-commit hooks will check all files when you commit changes, automatically fixing any files which are not formatted correctly. Those files will need to be staged again before re-attempting the commit.
Loading

0 comments on commit 99acd4e

Please sign in to comment.