Skip to content

Commit

Permalink
chore: sync project template
Browse files Browse the repository at this point in the history
  • Loading branch information
makkus committed Nov 10, 2023
1 parent a8b38bc commit a5d24cb
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/DHARPA-Project/kiara_plugin.develop.git",
"commit": "00d3cccc6d2239d8f5b701fd4e7526bca82a609f",
"commit": "2118176ad585467dd6385e9f7f4de1b420b51f54",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: macos-11
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v4
Expand Down
91 changes: 34 additions & 57 deletions .github/workflows/build-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v4
Expand Down Expand Up @@ -53,20 +53,22 @@ jobs:
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}""


# Uncomment this if you want to run mypy
mypy-linux:
name: mypy check on linux
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python_version }}"
- uses: actions/checkout@v3
- name: install kiara_plugin.onboarding
run: pip install -U --extra-index-url https://pypi.fury.io/dharpa/ .[all,dev_testing]
run: pip install -U .[all,dev_testing]
- name: Test with mypy
run: make mypy

Expand All @@ -87,14 +89,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
pip install -U ruff
# Include `--format=github` to enable automatic inline annotations.
- name: Run Ruff
run: ruff --format=github src/
run: ruff --output-format=github src/

build-docs:
name: build documentation
if: ${{ github.ref == 'refs/heads/develop' }} || ${{ github.ref == 'refs/heads/main' }} || startsWith(github.ref, 'refs/tags/')
build_python_package:
name: build python package
runs-on: ubuntu-latest
needs:
- test-linux
Expand All @@ -108,63 +109,40 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: install kiara_plugin.onboarding package
run: pip install -U --extra-index-url https://pypi.fury.io/dharpa/ .[all,dev_documentation]
- run: git config --global user.email "Markus Binsteiner"
- run: git config --global user.name "[email protected]"
- name: create latest documentation
if: ${{ ( github.ref == 'refs/heads/develop') }}
run: FAIL_DOC_BUILD_ON_ERROR=true mike deploy --push latest && mike set-default --push latest
- name: extract tag name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: create stable documentation
if: startsWith(github.ref, 'refs/tags')
run: FAIL_DOC_BUILD_ON_ERROR=true mike deploy --push --update-alias --title "v ${RELEASE_VERSION}" "${RELEASE_VERSION}" stable
- name: install pip
run: pip install -U pip setuptools setuptools_scm build
- name: create packages
run: python -m build
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: build-dists
path: dist/

release_package:
name: publish python package
if: ${{ github.ref == 'refs/heads/develop' }} || ${{ github.ref == 'refs/heads/main' }} || startsWith(github.ref, 'refs/tags/')
release_python_package:
name: publish python package to pypi
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs:
- test-linux
- mypy-linux
- linting-linux
- build_python_package
env:
GEMFURY_PUSH_TOKEN: ${{ secrets.GEMFURY_PUSH_TOKEN }}
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
- name: Retrieve build distributions
uses: actions/download-artifact@v3
with:
python-version: "3.11"
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: install pip
run: pip install pip==21.2.4 setuptools==57.4.0
- name: install kiara
run: pip install -U -e .[all]
- name: install 'build' package
run: pip install -U build
- name: create packages
run: python -m build
- name: upload source package
run: curl -F package=@$(ls dist/kiara*.tar.gz) https://${GEMFURY_PUSH_TOKEN}@dharpa.fury.land:443/pypi/
- name: upload wheel
run: curl -F package=@$(ls dist/kiara*.whl) https://${GEMFURY_PUSH_TOKEN}@dharpa.fury.land:443/pypi/
- name: publish to PyPI
if: startsWith(github.ref, 'refs/tags')
name: build-dists
path: dist/
- name: publish to PyPI # make sure you have pypi trusted publishing configured for this repo
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: "${{ secrets.PYPI_API_TOKEN }}"

conda_package_build:
build_and_release_conda_package:
name: conda package build (and upload if release)
runs-on: ubuntu-latest
needs:
- test-linux
- mypy-linux
- linting-linux
- build_python_package
steps:
- name: "Set up Python 3.11"
uses: actions/setup-python@v4
Expand Down Expand Up @@ -195,11 +173,10 @@ jobs:
merge_tag_to_main:
name: merge current tag to main branch
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags') }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- test-linux
- mypy-linux
- linting-linux
- release_python_package
- build_and_release_conda_package
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v4
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ repos:
- id: mypy
files: "^src/"
pass_filenames: true
args: ["--config-file", "setup.cfg", "--ignore-missing-imports", "--explicit-package-bases"]
args: ["--config-file", "pyproject.toml", "--ignore-missing-imports"]
additional_dependencies: [pydantic>=2.0.0, rich>=10.0.0, ruamel.yaml, anyio>=3.0.0, pyzmq>=22.0.3, bidict, sqlalchemy-stubs, types-python-slugify, types-setuptools, types-python-dateutil, dag_cbor, multiformats, textual, regex, types-pytz, types-orjson]

- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.272'
rev: 'v0.1.4'
hooks:
- id: ruff

Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"
]
dependencies = [
"kiara>=0.4.46",
"kiara_plugin.core_types>=0.4.20",
"kiara>=0.5.0,<0.6.0",
"kiara_plugin.core_types>=0.5.0,<0.6.0",
"httpx>=0.23.0",
"pyzenodo3>=1.0.2",
"PyGithub>=1.58.0",
Expand Down
57 changes: 0 additions & 57 deletions setup.py

This file was deleted.

6 changes: 3 additions & 3 deletions src/kiara_plugin/onboarding/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@


def get_version():
from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import PackageNotFoundError, version

try:
# Change here if project is renamed and does not equal the package name
dist_name = __name__
__version__ = get_distribution(dist_name).version
except DistributionNotFound:
__version__ = version(dist_name)
except PackageNotFoundError:

try:
version_file = os.path.join(os.path.dirname(__file__), "version.txt")
Expand Down

0 comments on commit a5d24cb

Please sign in to comment.