Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
348 changes: 294 additions & 54 deletions .circleci/config.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ exclude_paths:
- '*.md'
- "examples/**"
- "getting_started/**"
- utils/**
52 changes: 52 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
import
omit =
# omit anything in a .local directory anywhere
*/.local/*
grid2op/data/*
grid2op/data_test/*
grid2op/data_grid2op/*
# omit this single file
grid2op/tests/*test*.py
grid2op/tests/*BaseBackendTest.py
grid2op/tests/*BaseRedispTest.py
*__init__.py
*config.py
dtypes.py

[run]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
import
omit =
# omit anything in a .local directory anywhere
*/.local/*
# omit everything in /usr
/usr/*
grid2op/data/*
grid2op/data_test/*
grid2op/data_grid2op/*
# omit this single file
grid2op/tests/*test*.py
grid2op/tests/*BaseBackendTest.py
grid2op/tests/*BaseRedispTest.py
*__init__.py

[coverage:report]
ignore_errors = True
28 changes: 19 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ on:
tags:
- 'v*.*.*'

permissions: {} # deny all by default

jobs:
manylinux_build:
name: Build linux ${{ matrix.python.name }} wheel
permissions:
contents: read
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
env:
Expand All @@ -18,11 +22,11 @@ jobs:
strategy:
matrix:
python:
- {
name: cp38,
abi: cp38,
version: '3.8',
}
# - {
# name: cp38,
# abi: cp38,
# version: '3.8',
# }
- {
name: cp39,
abi: cp39,
Expand Down Expand Up @@ -122,6 +126,8 @@ jobs:

macos_windows_build:
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel
permissions:
contents: read
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
Expand All @@ -135,10 +141,10 @@ jobs:
os: windows-2022,
}
python:
- {
name: cp38,
version: '3.8',
}
# - {
# name: cp38,
# version: '3.8',
# }
- {
name: cp39,
version: '3.9',
Expand Down Expand Up @@ -215,6 +221,8 @@ jobs:

source_build:
name: Build tar.gz grid2op file on ${{ matrix.config.name}}
permissions:
contents: read
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
Expand Down Expand Up @@ -271,6 +279,8 @@ jobs:

auto_class_in_file:
name: Test ${{ matrix.config.name }} OS can handle automatic class generation for python ${{matrix.python.version}}
permissions:
contents: read
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Publish to PyPI

on:
push:
tags:
- "v*" # triggers on v1.12.3, v2.0.0, etc.

# Least privilege by default: every job gets read-only contents and nothing
# else. The publish job re-declares the extra scopes it actually needs.
permissions:
contents: read

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 6.2.0
with:
python-version: "3.12"
- name: Install build
run: pip install build
- name: Build sdist and wheel
run: python -m build
- name: Upload build artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
with:
name: dist
path: dist/

sbom:
name: Generate SBOM
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 6.2.0
with:
python-version: "3.12"
- name: Download build artifacts
uses: actions/download-artifact@ad191675b41f6a5b46da9a048cb6893812da158b # 8.0.1
with:
name: dist
path: dist/
- name: Generate SBOM (Python dependencies)
run: |
# Install the freshly built wheel into an ISOLATED venv so the SBOM
# captures only the package's own resolved dependencies, and not the
# SBOM tool itself or anything else present on the runner.
python -m venv .sbom-venv
.sbom-venv/bin/pip install --upgrade pip
.sbom-venv/bin/pip install dist/*.whl

# Install cyclonedx-bom in the runner's default environment and point
# it at the isolated venv's interpreter. Because the tool lives in a
# different environment than the one being scanned, it never appears
# as a component in the generated bill of materials.
pip install cyclonedx-bom

TAG="${GITHUB_REF_NAME}" # e.g. v1.12.3
PKG="${GITHUB_REPOSITORY##*/}" # e.g. grid2op
cyclonedx-py environment .sbom-venv/bin/python \
--output-format json \
--outfile "${PKG}-${TAG}-sbom.cdx.json"
- name: Upload SBOM artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
with:
name: sbom
path: "*-sbom.cdx.json"

publish:
name: Publish to PyPI
needs: [build, sbom]
runs-on: ubuntu-latest
environment: pypi # must match the environment name from the Trusted Publisher config
permissions:
contents: write # needed to attach assets to the GitHub Release
id-token: write # needed for OIDC trusted publishing + Sigstore
steps:
- name: Download build artifacts
uses: actions/download-artifact@ad191675b41f6a5b46da9a048cb6893812da158b # 8.0.1
with:
name: dist
path: dist/
- name: Download SBOM
uses: actions/download-artifact@ad191675b41f6a5b46da9a048cb6893812da158b # 8.0.1
with:
name: sbom
path: sbom/
- name: Publish to PyPI (with Sigstore attestations)
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
with:
attestations: true # this is what triggers Sigstore signing
- name: Attach SBOM to GitHub Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda
with:
files: sbom/*-sbom.cdx.json
78 changes: 78 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

name: Scorecard supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '25 0 * * 5'
push:
branches: [ "master" ]

# Declare default permissions as read only.
permissions: {} # deny all by default

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
# `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write
# Uncomment the permissions below if installing in a private repository.
contents: read
actions: read

steps:
- name: "Checkout code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
with:
results_file: results.sarif
results_format: sarif
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecard on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
# repo_token: ${{ secrets.SCORECARD_TOKEN }}

# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories:
# - `publish_results` will always be set to `false`, regardless
# of the value entered here.
publish_results: true

# (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore
# file_mode: git

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
16 changes: 16 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Security checks

on: [push, pull_request]

jobs:
detect-secrets:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install detect-secrets
- run: detect-secrets scan --baseline .secrets.baseline
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,13 @@ celerybeat-schedule
# pipenv
Pipfile.lock

# dotenv
# dotenv, secrets etc.
.env
.env.*
*.key
*.pem
*.p12
*.pfx

# virtualenv
venv/
Expand Down Expand Up @@ -437,6 +442,12 @@ saved_setup.cfg
saved_setup.py
requirements_pp2.txt
requirements_pp3.txt
Grid2Op-*.tar.gz
*-py3-none-any.whl
grid2op/data/**/__init__.py
grid2op/tests/aux_test_baseAction_extended.py
release_digests.json


# profiling files
**.prof
5 changes: 5 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Canonical name <canonical email> <commit email>
Benjamin DONNOT <benjamin.donnot@rte-france.com>
BDonnot <benjamin.donnot@gmail.com>
Eva BOGUSLAWSKI <eva.boguslawski@gmail.com>
Xavier WEISS <xavierw@kth.se>
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/Yelp/detect-secrets
rev: 68e8b45440415753fff70a312ece8da92ba85b4a # v1.5.0 # latest stable on 2026-05-20
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
exclude: package.lock.json
stages: [pre-commit]

- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: check-mailmap
stages: [pre-commit]

- repo: local
hooks:
- id: dco-signoff
name: DCO Signed-off-by check
language: python
entry: python scripts/check_dco_msg.py
stages: [commit-msg]
Loading
Loading