Skip to content

Commit

Permalink
Chore: Update DevOps tooling from central repository [skip ci] (#90)
Browse files Browse the repository at this point in the history
* Chore: Update DevOps tooling from central repository [skip ci]

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Chore: pre-commit autoupdate

---------

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
1 parent cf5cfa1 commit f1db3d2
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ jobs:
git branch -D "$AUTOMATION_BRANCH" || :
git checkout -b "$AUTOMATION_BRANCH"
else
# The -B flag swaps branch and creates it if NOT present
git checkout -B "$AUTOMATION_BRANCH"
git fetch origin "$AUTOMATION_BRANCH"
git switch -c "$AUTOMATION_BRANCH" "origin/$AUTOMATION_BRANCH"
fi
# Only if NOT running in GitHub
Expand Down
41 changes: 2 additions & 39 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
ci:
autofix_commit_msg: "Chore: pre-commit autoupdate"
skip:
# pre-commit.ci cannot install WGET, so tomlint must be disabled
- tomllint

exclude: |
(?x)^(
Expand All @@ -13,21 +10,10 @@ exclude: |
repos:

- repo: local
hooks:
- id: tomllint
name: "Script: scripts/tomllint.sh"
language: script
# pass_filenames: false
files: \^*.toml
types: [file]
entry: scripts/tomllint.sh .

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
Expand All @@ -38,7 +24,6 @@ repos:
# - id: detect-aws-credentials
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
Expand All @@ -48,7 +33,6 @@ repos:
- id: no-commit-to-branch
# - id: pretty-format-json
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
Expand Down Expand Up @@ -78,25 +62,13 @@ repos:
rev: v0.10.0.1
hooks:
- id: shellcheck

- repo: https://github.com/pycqa/pydocstyle.git
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: ["tomli"]
args: ["-x"] # Check external files

- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.7.1.15
hooks:
- id: actionlint

- repo: https://github.com/pycqa/flake8
rev: "7.1.0"
hooks:
- id: flake8
additional_dependencies:
- pep8-naming

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
Expand All @@ -107,10 +79,8 @@ repos:
rev: v0.5.0
hooks:
- id: ruff
files: ^(scripts|tests|custom_components)/.+\.py$
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --config=ruff.toml]
- id: ruff-format
files: ^(scripts|tests|custom_components)/.+\.py$

- repo: local
hooks:
Expand All @@ -134,13 +104,6 @@ repos:
# hooks:
# - id: codespell

# To embrace black styles, even in docs
# - repo: https://github.com/asottile/blacken-docs
# rev: v1.13.0
# hooks:
# - id: blacken-docs
# additional_dependencies: [black]

# Automatically upgrade Python syntax for newer versions
# - repo: https://github.com/asottile/pyupgrade
# rev: v3.15.0
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
> On June 26 2024, Linux Foundation announced the merger of its financial services umbrella, the Fintech Open Source Foundation ([FINOS](https://finos.org)), with OS-Climate, an open source community dedicated to building data technologies, modeling, and analytic tools that will drive global capital flows into climate change mitigation and resilience; OS-Climate projects are in the process of transitioning to the [FINOS governance framework](https://community.finos.org/docs/governance); read more on [finos.org/press/finos-join-forces-os-open-source-climate-sustainability-esg](https://finos.org/press/finos-join-forces-os-open-source-climate-sustainability-esg)
<!-- prettier-ignore-end -->
<!-- markdownlint-enable -->
# ITR Data Pipeline

The OS-Climate project is building a suite of Portfolio Alignment tools, the first of which is an [Implied Temperature Rise (ITR)](https://github.com/os-climate/ITR) tool. The need for climate-aligned investment tools has been obvious for some time and is articulated clearly in this [Manifesto](https://www.bankofengland.co.uk/news/2019/april/open-letter-on-climate-related-financial-risks) published by Governor of Bank of England Mark Carney, Governor of Banque de France François Villeroy de Galhau and Chair of the Network for Greening the Financial Services Frank Elderson. Subsequently a working group developed methodology for creating a Temperature Alignment score based on a company's usage of their fair (or not) share of the remaining global carbon budget. The ITR tool calculates those scores based on sector benchmarks, corporate production, emissions, emissions targets, and other factors.
Expand Down
18 changes: 14 additions & 4 deletions notebooks/common_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,19 @@
ureg.define("quadrillion = 1e15")

i7y = Context("intensity")
i7y.add_transformation("Mscf CH4", "kg CO2e", lambda ureg, x: x * ureg("54.87 kg CO2") / ureg("Mscf CH4"))
i7y.add_transformation("g CH4", "g CO2e", lambda ureg, x: x * ureg("44 g CO2e") / ureg("16 g CH4"))
i7y.add_transformation("t Coal", "MJ", lambda ureg, x: x * ureg("29288 MJ") / ureg("t Coal"))
i7y.add_transformation("t Coal", "t CO2e", lambda ureg, x: x * ureg("2.86 t CO2e") / ureg("t Coal"))
i7y.add_transformation(
"Mscf CH4",
"kg CO2e",
lambda ureg, x: x * ureg("54.87 kg CO2") / ureg("Mscf CH4"),
)
i7y.add_transformation(
"g CH4", "g CO2e", lambda ureg, x: x * ureg("44 g CO2e") / ureg("16 g CH4")
)
i7y.add_transformation(
"t Coal", "MJ", lambda ureg, x: x * ureg("29288 MJ") / ureg("t Coal")
)
i7y.add_transformation(
"t Coal", "t CO2e", lambda ureg, x: x * ureg("2.86 t CO2e") / ureg("t Coal")
)
ureg.add_context(i7y)
ureg.enable_contexts("intensity")
28 changes: 28 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[lint]
extend-fixable = [
#Instead of trailing-whitespace
"W291", "W293"
]

extend-select = [
# Instead of pydocstyle
"D",
#Instead of flake8
"E", "F","B",
# Instead of pep8-naming
"N",
# Instead of flake8-debugger or debug-statements
"T10",
]

ignore = [
"E203",
"E501",

# Avoid incompatible rules
"D203",
"D213",
]

[lint.pycodestyle]
max-line-length = 160

0 comments on commit f1db3d2

Please sign in to comment.