Skip to content
Open
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
47 changes: 11 additions & 36 deletions .github/workflows/bump-version-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,28 @@ on:

jobs:
build:
if: (! contains(github.event.head_commit.message, '[no bump]'))

name: Bump version
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: '3.9'

- name: Set env variables
run: |
# The next line is very important, otherwise the line after triggers
# git to track the permission change, which breaks bump2version API (needs clean git folder)
git config core.filemode false
chmod +x .github/workflows/utils.sh
echo "VERSION_FILE=openpnm/__version__.py" >> $GITHUB_ENV
echo "SETUP_CFG_FILE=setup.cfg" >> $GITHUB_ENV
echo "${{ github.event.head_commit.message }}"
python-version: '3.12'

- name: Install dependencies
run: |
pip install bump2version
pip install bump-my-version==1.2.4
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"

- name: Bump version (build)
shell: bash
run: |
source .github/workflows/utils.sh
bump_version build $VERSION_FILE
# Note that we don't want to create a new tag for "builds"

# - name: Commit files
# run: |
# REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
# remote_repo="https://${GITHUB_ACTOR}:${{ secrets.PUSH_ACTION_TOKEN }}@github.com/${REPOSITORY}.git"

# git config --local user.email "[email protected]"
# git config --local user.name "GitHub Action"

# # Commit version bump to dev ([no ci] to avoid infinite loop)
# git commit -m "Bump version number (build) [no ci]" -a
# git push "${remote_repo}" dev

- name: Commit files
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Bump version number (build part)
commit_author: Author <[email protected]>
bump-my-version bump pre_n --commit --message "Bump version number on dev"
git push origin HEAD:dev
git push --tags

60 changes: 60 additions & 0 deletions .github/workflows/bump-version-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Bump Version (release)

on:
push:
branches:
- release

jobs:
build:

name: Bump version
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'

- name: Install dependencies
run: |
pip install bump-my-version==1.2.4
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"

- name: Bump version (patch)
if: contains(github.event.head_commit.message, '#patch')
run: |
bump-my-version bump patch --commit --message "Bump version number on release"
git push origin HEAD:release
git push --tags

- name: Bump version (minor)
if: contains(github.event.head_commit.message, '#minor')
run: |
bump-my-version bump minor --commit --message "Bump version number on release"
git push origin HEAD:release
git push --tags

- name: Bump version (major)
if: contains(github.event.head_commit.message, '#major')
run: |
bump-my-version bump major --commit --message "Bump version number on release"
git push origin HEAD:release
git push --tags

- name: Create Pull Request to merge back release into dev
uses: repo-sync/pull-request@v2
with:
source_branch: "release" # If blank, default: triggered branch
destination_branch: "dev" # If blank, default: master
pr_title: "Merge release branch back into dev"
pr_body: "Changes made to the release branch (if any), plus the version bump."
pr_assignee: "jgostick" # Comma-separated list (no spaces)
pr_label: "high priority" # Comma-separated list (no spaces)
pr_draft: false # Creates pull request as draft
pr_allow_empty: true # Creates pull request even if there are no changes
github_token: ${{ secrets.GITHUB_TOKEN }}
113 changes: 0 additions & 113 deletions .github/workflows/bump-version.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/cleanup-tags.yml

This file was deleted.

1 change: 0 additions & 1 deletion openpnm/__version__.py

This file was deleted.

37 changes: 32 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openpnm"
dynamic = ["version"]
version = "3.5.5-dev3"
description = "A framework for conducting pore network modeling simulations of multiphase transport in porous materials"
authors = [{ name = "OpenPNM Team", email = "[email protected]" }]
maintainers = [
Expand Down Expand Up @@ -95,8 +95,35 @@ dev = [
requires = ["setuptools>=80"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["openpnm"]
[tool.bumpversion]
current_version = "3.5.5-dev3"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
(?P<patch>0|[1-9]\\d*)
(?:
- # dash separator for pre-release section
(?P<pre_l>[a-zA-Z-]+) # pre-release label
(?P<pre_n>0|[1-9]\\d*) # pre-release version number
)? # pre-release section is optional
"""
serialize = [
"{major}.{minor}.{patch}-{pre_l}{pre_n}",
"{major}.{minor}.{patch}",
]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
tag = true
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
commit = false
message = "Bump version: {current_version} → {new_version}"
commit_args = ""

[tool.setuptools.dynamic]
version = {attr = "openpnm.__version__.__version__"}
[tool.bumpversion.parts.pre_l]
values = ["dev", "rc", "final"]
optional_value = "dev"
16 changes: 0 additions & 16 deletions setup.cfg

This file was deleted.

15 changes: 11 additions & 4 deletions openpnm/__init__.py → src/openpnm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@
"""

import logging

import importlib.metadata as _metadata
import tomllib as _toml
import numpy as _np
from rich.logging import RichHandler


# try:
# __version__ = _metadata.version(__package__ or __name__)
# except _metadata.PackageNotFoundError:
with open("./pyproject.toml", "rb") as f:
data = _toml.load(f)
__version__ = data["project"]["version"]

FORMAT = "%(message)s"
logging.basicConfig(
format=FORMAT, datefmt="[%X]", handlers=[RichHandler(rich_tracebacks=True)]
)

import numpy as _np

from . import (
_skgraph,
Expand All @@ -37,5 +46,3 @@
from .utils import Project, Workspace

_np.seterr(divide='ignore', invalid='ignore')

__version__ = utils._get_version()
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
'qupc_update',
'qupc_compress',
'qupc_reduce',
'qupc_union',
'qupc_find',
]


Expand Down Expand Up @@ -42,6 +44,20 @@ def qupc_reduce(arr):
arr[i] = arr[arr[i]]
return arr

@njit
def qupc_union(arr, ind, val):
indp=qupc_find(arr, ind)
valp=qupc_find(arr, val)
arr[indp]=valp
return arr

@njit
def qupc_find(arr, ind):
while arr[ind] != ind:
arr[ind] = arr[arr[ind]]
ind = arr[ind]
return ind


if __name__ == '__main__':
a = qupc_initialize(10)
Expand All @@ -60,4 +76,4 @@ def qupc_reduce(arr):
qupc_reduce(a)
qupc_compress(a)
assert np.all(a == [0, 0, 1, 2, 1, 1, 1, 1, 0, 3])
print(a)
print(a)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading