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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* sofar version:
* Python version:
* Operating System:
* Did you install pyfar via pip:
* Did you install sofar via pip:

## Description

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Check Label for version Label
name: pull_request label

on:
pull_request:
Expand All @@ -12,17 +12,15 @@ jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- name: Check for version label
- name: pull_request label
run: |
echo "Checking for version label on pull request..."
echo "Checking for label on pull request..."
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
LABEL_NAMES=$(echo "$PR_DATA" | jq -r '.labels[].name')
echo "Labels: $LABEL_NAMES"

REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
MATCHES=$(echo "$LABEL_NAMES" | grep -E "$REGEX")
if [ -z "$MATCHES" ]; then
echo "Error: No version label found on this pull request. Please add a label in the format vX.Y.Z."
if [ -z "$LABEL_NAMES" ]; then
echo "Error: No label found on this pull request. Please add a label."
exit 1
fi
env:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/has_version_milestone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: pull_request version milestone

on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize

jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- name: pull_request version milestone
run: |
echo "Checking for version milestone on pull request..."
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
MILESTONE_NAME=$(echo "$PR_DATA" | jq -r '.milestone.title')
echo "Milestone: $MILESTONE_NAME"

REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
MATCHES=$(echo "$MILESTONE_NAME" | grep -E "$REGEX")
if [ -z "$MATCHES" ]; then
echo "Error: No version milestone found on this pull request. Please add a milestone in the format vX.Y.Z."
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 changes: 40 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
import urllib3
import shutil
import numpy as np
sys.path.insert(0, os.path.abspath('..'))

import sofar
Expand Down Expand Up @@ -117,7 +118,8 @@
"navbar_start": ["navbar-logo"],
"navbar_end": ["navbar-icon-links", "theme-switcher"],
"navbar_align": "content",
"header_links_before_dropdown": 8,
"header_links_before_dropdown": None, # will be automatically set later based on headers.rst
"header_dropdown_text": "Packages", # Change dropdown name from "More" to "Packages"
"icon_links": [
{
"name": "GitHub",
Expand Down Expand Up @@ -152,16 +154,44 @@
'_static/header.rst',
'resources/logos/pyfar_logos_fixed_size_sofar.png',
]
c = urllib3.PoolManager()
for file in folders_in:
url = link + file
filename = file
os.makedirs(os.path.dirname(filename), exist_ok=True)
with c.request('GET', url, preload_content=False) as res, open(filename, 'wb') as out_file:
shutil.copyfileobj(res, out_file)

def download_files_from_gallery(link, folders_in):
c = urllib3.PoolManager()
for file in folders_in:
url = link + file
filename = file
os.makedirs(os.path.dirname(filename), exist_ok=True)
with c.request('GET', url, preload_content=False) as res:
if res.status == 200:
with open(filename, 'wb') as out_file:
shutil.copyfileobj(res, out_file)

download_files_from_gallery(link, folders_in)
# if logo does not exist, use pyfar logo
if not os.path.exists(html_logo):
download_files_from_gallery(
link, ['resources/logos/pyfar_logos_fixed_size_pyfar.png'])
shutil.copyfile(
'resources/logos/pyfar_logos_fixed_size_pyfar.png', html_logo)

# replace sofar hard link to internal link
with open("_static/header.rst", "rt") as fin:
with open("header.rst", "wt") as fout:
for line in fin:
fout.write(line.replace(f'https://{project}.readthedocs.io', project))
lines = [line.replace(f'https://{project}.readthedocs.io', project) for line in fin]
contains_project = any(project in line for line in lines)

fout.writelines(lines)

# add project to the list of projects if not in header
if not contains_project:
fout.write(f' {project} <{project}>\n')

# count the number of gallery headings
count_gallery_headings = np.sum(
['https://pyfar-gallery.readthedocs.io' in line for line in lines])


# set dropdown header after gallery headings
html_theme_options['header_links_before_dropdown'] = count_gallery_headings+1


2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
'netCDF4',
Expand Down Expand Up @@ -122,6 +123,7 @@ lint.select = [
[tool.ruff.lint.pydocstyle]
convention = "numpy"


[tool.bumpversion]
current_version = "1.2.1"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
Expand Down