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 8, 2023
1 parent cd1dc47 commit 87383ec
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 62 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": "c0546b905c2e56b316eb7b0bd7348fc7b46bcb60",
"commit": "2118176ad585467dd6385e9f7f4de1b420b51f54",
"context": {
"cookiecutter": {
"full_name": "Markus Binsteiner",
Expand Down
83 changes: 29 additions & 54 deletions .github/workflows/build-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,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 @@ -109,63 +108,40 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: install kiara_plugin.tabular package
run: pip install -U .[all,dev_documentation]
- run: git config --global user.email "Markus Binsteiner"
- run: git config --global user.name "markus@frkl.io"
- 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 11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/checkout@v3
- name: Retrieve build distributions
uses: actions/download-artifact@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 @@ -196,11 +172,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
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", "pyproject.toml", "--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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ classifiers = [
"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",
"duckdb>=0.9.0,<0.10.0",
"pandas>=1.4.0",
"polars>=0.18.0",
Expand Down
6 changes: 3 additions & 3 deletions src/kiara_plugin/tabular/__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 87383ec

Please sign in to comment.