Skip to content

Commit

Permalink
Merge branch 'release/0.8.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
jenskeiner committed Dec 11, 2024
2 parents 93498e1 + e8b1146 commit 8946aef
Show file tree
Hide file tree
Showing 17 changed files with 1,034 additions and 966 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "monthly"
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "monthly"
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ on:
- main
- develop

env:
PACKAGE_VERSION: "0"

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies.
run: poetry install
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Run tests.
run: poetry run pytest
run: uv run pytest
73 changes: 38 additions & 35 deletions .github/workflows/publish-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ on:

env:
PACKAGE_NAME: exchange-calendars-extensions
MODULE_NAME: exchange_calendars_extensions.core
MODULE_NAME: exchange_calendars_extensions
PYTHON_VERSION: "3.12"

jobs:
build-and-publish:
Expand All @@ -19,53 +20,55 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install poetry.
run: pipx install poetry
- name: Set up Python.
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.11"
cache: 'poetry'
- name: Determine version number.
enable-cache: true
- name: Set up Python ${{ env.PYTHON_VERSION }}
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Determine package version.
run: |
export VERSION=$(echo ${{ github.ref_name }} | sed -e 's/^\(release\|hotfix\|support\)\///')rc${{ github.run_number }}
echo "RC version is $VERSION."
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set poetry package version.
run: poetry version ${{ env.VERSION }}
- name: Determine path to version.py from module name.
run: |
export VERSION_PATH=$(echo ${{ env.MODULE_NAME }} | sed 's/\./\//g')/version.py
echo "VERSION_PATH is $VERSION_PATH."
echo "VERSION_PATH=$VERSION_PATH" >> $GITHUB_ENV
- name: Generate version.py
run: |
echo "version = '${{ env.VERSION }}'" > ${{ env.VERSION_PATH }}
- name: Generate requirements.txt.
run: poetry export -f requirements.txt --without-hashes > requirements.txt
- name: Build package with poetry.
run: poetry build
export PACKAGE_VERSION=$(echo ${{ github.ref_name }} | sed -e 's/^\(release\|hotfix\|support\)\///')rc${{ github.run_number }}
echo "RC version is $PACKAGE_VERSION."
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: Build package
run: uv build
- name: Publish package to Test PyPI.
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Install from testpypi and import.
- name: Test that the package can be installed and imported (Test PyPI).
run: |
i=0
n=60
max=10
exists=0
while [ $i -lt $n ] && [ $exists -eq 0 ]; do
while [ $i -lt $max ] && [ $exists -eq 0 ]; do
i=$(expr $i + 1)
if curl -f -s https://test.pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -e ".releases | has(\"${{ env.VERSION }}\")" &> /dev/null; then
echo "$i/$n Package exists in index."
if curl -f -s https://test.pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -e ".releases | has(\"${{ env.PACKAGE_VERSION }}\")" &> /dev/null; then
echo "$i/$max Package has appeared in index."
exists=1
else
echo "$i/$n Package has not appeared in index yet. Sleeping 5s."
echo "$i/$max Package has not appeared in index yet. Sleeping 5s."
sleep 5s
fi
done
sleep 15s
pip install --no-cache-dir --index-url https://test.pypi.org/simple ${{ env.PACKAGE_NAME }}==${{ env.VERSION }} --no-deps
pip install -r requirements.txt
python -c 'import ${{ env.MODULE_NAME }};print(${{ env.MODULE_NAME }}.__version__)'
if [ $exists -ne 0 ]; then
sleep 5s
i=0
max=3
while [ $i -lt $max ]; do
if uv run -n --refresh --default-index https://test.pypi.org/simple --index https://pypi.org/simple --index-strategy unsafe-best-match --with "${{ env.PACKAGE_NAME }}==${{ env.PACKAGE_VERSION }}" --no-project -- python -c 'from importlib.metadata import version;print(version("${{ env.MODULE_NAME }}"))'; then
exit 0
else
echo "The command failed. Retrying $i/$max."
i=$(expr $i + 1)
sleep 5s
fi
done
echo "The command failed $i/$max times. Failing the job."
exit 1
else
echo "The package was not found in the package index. Test installation and import failed."
exit 1
fi
113 changes: 66 additions & 47 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:

env:
PACKAGE_NAME: exchange_calendars_extensions
MODULE_NAME: exchange_calendars_extensions.core
MODULE_NAME: exchange_calendars_extensions
PYTHON_VERSION: "3.12"

jobs:
build-and-publish:
Expand All @@ -16,77 +17,95 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install poetry.
run: pipx install poetry
- name: Set up Python.
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.11"
cache: 'poetry'
enable-cache: true
- name: Set up Python ${{ env.PYTHON_VERSION }}
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Determine version number.
run: |
export VERSION=${{ github.ref_name }}
echo "Version is $VERSION."
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set poetry package version.
run: poetry version ${{ env.VERSION }}
- name: Determine path to version.py from module name.
run: |
export VERSION_PATH=$(echo ${{ env.MODULE_NAME }} | sed 's/\./\//g')/version.py
echo "VERSION_PATH is $VERSION_PATH."
echo "VERSION_PATH=$VERSION_PATH" >> $GITHUB_ENV
- name: Generate version.py
run: |
echo "version = '${{ env.VERSION }}'" > ${{ env.VERSION_PATH }}
- name: Generate requirements.txt.
run: poetry export -f requirements.txt --without-hashes > requirements.txt
- name: Build package with poetry.
run: poetry build
export PACKAGE_VERSION=${{ github.ref_name }}
echo "Version is $PACKAGE_VERSION."
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: Build package
run: uv build
- name: Publish package to Test PyPI.
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Install from testpypi and import.
- name: Test that the package can be installed and imported (Test PyPI).
run: |
i=0
n=60
max=10
exists=0
while [ $i -lt $n ] && [ $exists -eq 0 ]; do
while [ $i -lt $max ] && [ $exists -eq 0 ]; do
i=$(expr $i + 1)
if curl -f -s https://test.pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -e ".releases | has(\"${{ env.VERSION }}\")" &> /dev/null; then
echo "$i/$n Package exists in index."
if curl -f -s https://test.pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -e ".releases | has(\"${{ env.PACKAGE_VERSION }}\")" &> /dev/null; then
echo "$i/$max Package has appeared in index."
exists=1
else
echo "$i/$n Package has not appeared in index yet. Sleeping 5s."
echo "$i/$max Package has not appeared in index yet. Sleeping 5s."
sleep 5s
fi
done
sleep 15s
pip install --no-cache-dir --index-url https://test.pypi.org/simple ${{ env.PACKAGE_NAME }}==${{ env.VERSION }} --no-deps
pip install -r requirements.txt
python -c 'import ${{ env.MODULE_NAME }};print(${{ env.MODULE_NAME }}.__version__)'
- name: Clean pip
run: |
pip uninstall -y ${{ env.PACKAGE_NAME }}
pip cache purge
if [ $exists -ne 0 ]; then
sleep 5s
i=0
max=3
while [ $i -lt $max ]; do
if uv run -n --refresh --default-index https://test.pypi.org/simple --index https://pypi.org/simple --index-strategy unsafe-best-match --with "${{ env.PACKAGE_NAME }}==${{ env.PACKAGE_VERSION }}" --no-project -- python -c 'from importlib.metadata import version;print(version("${{ env.MODULE_NAME }}"))'; then
exit 0
else
echo "The command failed. Retrying $i/$max."
i=$(expr $i + 1)
sleep 5s
fi
done
echo "The command failed $i/$max times. Failing the job."
exit 1
else
echo "The package was not found in the package index. Test installation and import failed."
exit 1
fi
- name: Delete distribution files.
run: rm -rf dist
- name: Build package
run: uv build
- name: Publish package to PyPI.
uses: pypa/gh-action-pypi-publish@release/v1
- name: Install and import.
- name: Test that the package can be installed and imported (PyPI).
run: |
i=0
n=60
max=10
exists=0
while [ $i -lt $n ] && [ $exists -eq 0 ]; do
while [ $i -lt $max ] && [ $exists -eq 0 ]; do
i=$(expr $i + 1)
if curl -f -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -e ".releases | has(\"${{ env.VERSION }}\")" &> /dev/null; then
echo "$i/$n Package exists in index."
if curl -f -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -e ".releases | has(\"${{ env.PACKAGE_VERSION }}\")" &> /dev/null; then
echo "$i/$max Package has appeared in index."
exists=1
else
echo "$i/$n Package has not appeared in index yet. Sleeping 5s."
echo "$i/$max Package has not appeared in index yet. Sleeping 5s."
sleep 5s
fi
done
sleep 15s
pip install --no-cache-dir --index-url https://pypi.org/simple ${{ env.PACKAGE_NAME }}==${{ env.VERSION }}
python -c 'import ${{ env.MODULE_NAME }};print(${{ env.MODULE_NAME }}.__version__)'
if [ $exists -ne 0 ]; then
sleep 5s
i=0
max=3
while [ $i -lt $max ]; do
if uv run -n --refresh --default-index https://pypi.org/simple --index https://pypi.org/simple --with "${{ env.PACKAGE_NAME }}==${{ env.PACKAGE_VERSION }}" --no-project -- python -c 'from importlib.metadata import version;print(version("${{ env.MODULE_NAME }}"))'; then
exit 0
else
echo "The command failed. Retrying $i/$max."
i=$(expr $i + 1)
sleep 5s
fi
done
echo "The command failed $i/$max times. Failing the job."
exit 1
else
echo "The package was not found in the package index. Test installation and import failed."
exit 1
fi
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,12 @@ dmypy.json
# Pyre type checker
.pyre/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# Ruff linter cache
.ruff_cache
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
rev: v3.15.2
hooks:
- id: pyupgrade
args: ["--py39-plus"]
args: ["--py310-plus"]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.2
Expand Down
Loading

0 comments on commit 8946aef

Please sign in to comment.