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
47 changes: 19 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:

env:
PYTHON_VERSION: '3.10'
POETRY_VERSION: '1.8.3'

jobs:
build-reference-documentation:
Expand All @@ -27,17 +26,15 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: $POETRY_VERSION
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Install dependencies
run: poetry install
run: uv sync --python ${{ env.PYTHON_VERSION }}
- name: "Run Reference Documentation Generation"
run: |
echo "documentation" > dependencies_documentation.txt
poetry run pipdeptree >> dependencies_documentation.txt
poetry run poe docsWithTutorials
uv run pipdeptree >> dependencies_documentation.txt
uv run poe docsWithTutorials
- name: Archive documentation version artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -58,14 +55,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: $POETRY_VERSION
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Install dependencies
run: poetry install
run: uv sync --python ${{ env.PYTHON_VERSION }}
- name: Run Format Check
run: poetry run poe static_checks
run: uv run poe static_checks
test-coverage:
runs-on: ubuntu-latest
steps:
Expand All @@ -74,14 +69,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: $POETRY_VERSION
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Install dependencies
run: poetry install
run: uv sync --python ${{ env.PYTHON_VERSION }}
- name: Run Test Coverage
run: poetry run poe coverage
run: uv run poe coverage
unit-and-doc-test:
runs-on: ${{matrix.os}}
strategy:
Expand All @@ -95,21 +88,19 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python_version}}
- name: Install Poetry
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: $POETRY_VERSION
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Install dependencies
run: poetry install
run: uv sync --python ${{ matrix.python_version }}
- name: Run Unit Tests and Doctests Python ${{matrix.python_version}} ${{matrix.os}}
run: poetry run poe tests
run: uv run poe tests
- name: Run mypy type check Python ${{matrix.python_version}} ${{matrix.os}}
run: poetry run poe type_check
run: uv run poe type_check
- name: Generate dependency tree
run: |
export DEPS='dependencies_${{matrix.python_version}}_${{matrix.os}}.txt'
echo "${{matrix.python_version}} ${{matrix.os}}" > $DEPS
poetry run pipdeptree >> $DEPS
uv run pipdeptree >> $DEPS
shell: bash
- name: Archive dependency tree
uses: actions/upload-artifact@v4
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: graspologic Publish
on:
#
# When a release tag is created (e.g. v1.0.0), this workflow will be triggered. The `poetry dynamic-version` plugin will use the correct version tag.
# When a release tag is created (e.g. v1.0.0), this workflow will be triggered. Hatch's VCS versioning will use the correct version tag.
#
release:
types: [created]
Expand All @@ -17,7 +17,6 @@ on:
- 'dev'
env:
PYTHON_VERSION: '3.10'
POETRY_VERSION: '1.8.3'
jobs:
build:
uses: ./.github/workflows/build.yml
Expand All @@ -26,6 +25,8 @@ jobs:
needs: build
permissions:
id-token: write
outputs:
version: ${{ steps.export-version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -35,18 +36,15 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: $POETRY_VERSION
- name: Add poetry-dynamic-versioning plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Install dependencies
run: poetry install
run: uv sync --python ${{ env.PYTHON_VERSION }}
- name: Export Publication Version
run: echo "version=`poetry version --short`" >> $GITHUB_OUTPUT
id: export-version
run: echo "version=$(uvx hatch version)" >> "$GITHUB_OUTPUT"
- name: Build Artifacts
run: poetry build
run: uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ follow these guidelines! This will make it a lot faster for us to respond to you

## Prerequisites
* [Python 3.9+](https://www.python.org/)
* [Poetry 1.8.2+](https://python-poetry.org/docs/)
* [uv 0.4+](https://docs.astral.sh/uv/) (handles dependency installation and locking)

## Setting up for development

Expand All @@ -91,7 +91,7 @@ branch using a virtual environment. Steps:
Always use a `feature` branch. Pull requests directly to either `dev` or `main` will be rejected
until you create a feature branch based on `dev`.

4. From the project root, run `poetry install`, which will create a virtual environment and install necessary dependencies.
4. From the project root, run `uv sync`, which will create the project virtual environment (in `.venv/`) and install all required dependencies.

## Code Changes

Expand Down Expand Up @@ -122,25 +122,25 @@ tools to help make sure your changes meet the standards for our repository.
#### Code formatting
Please use `black` and `isort` so that the format of your code is compatible with our project. Format your code prior to committing using one of the following methods:
```bash
poetry run poe format
uv run poe format
```

#### Type checking
Validate your typehinting by running:
```bash
poetry run poe type_check
uv run poe type_check
```

#### Unit testing
To check if your code runs correctly, we recommend using unit testing that locally tests your code by implementing test cases. Execute these unit tests by running:
```bash
poetry run poe tests
uv run poe tests
```

#### Creating documentation
Build the documentation with the use of [sphinx](https://www.sphinx-doc.org/en/master/usage/index.html) by running:
```bash
poetry run poe docs
uv run poe docs
```
Please verify that the built documentation looks appropriate. You can view the `html`
from the `docs/_build/html` folder; click on `index.html` to see what the homepage would
Expand All @@ -150,7 +150,7 @@ If you have made any changes that could affect the tutorials, please also build
This can take a bit longer because the code in each notebook actually needs to execute.
You can build the documentation and tutorials by running:
```bash
poetry run poe docsWithTutorials
uv run poe docsWithTutorials
```

## Publishing Changes
Expand Down
23 changes: 18 additions & 5 deletions graspologic/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# This version placeholder will be replaced during package build.
# Do not commit this file.
__version__ ="0.0.0"#
#
"""Utilities for exposing the package version."""

from importlib import metadata


def __version() -> str:
return __version__
"""Return the installed graspologic version.

Falls back to a sensible default when the distribution metadata is
unavailable (for example when running directly from a source checkout).
"""

try:
return metadata.version("graspologic")
except metadata.PackageNotFoundError:
return "0.0.0"


__version__ = __version()
Loading