Skip to content

Commit

Permalink
Merge branch 'main' into get-events-rows
Browse files Browse the repository at this point in the history
* main:
  docs: replace rye with uv
  misc: remove deprecated lockfiles
  fix(ci): wrap make for docs in 'uv run'
  fix(docs): wrap make in 'uv run'
  feat!(uv): replace rye with uv
  chore(deps): update actions/checkout action to v4.2.2 (#857)
  • Loading branch information
MichaelSasser committed Dec 19, 2024
2 parents 7588a43 + 0d65581 commit 8a49dee
Show file tree
Hide file tree
Showing 16 changed files with 1,776 additions and 1,810 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,33 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2

- name: "Set Python Version ${{ matrix.python-version }}"
run: echo '${{ matrix.python-version }}' > .python-version
# - name: "Set Python Version ${{ matrix.python-version }}"
# run: echo '${{ matrix.python-version }}' > .python-version

- name: Setup Rye
id: setup-rye
uses: eifinger/setup-rye@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.41.0"
enable-cache: true
cache-prefix: python-${{ matrix.python-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
cache-dependency-glob: "uv.lock"

- name: Install Project Dependencies
run: |
rye pin --no-update-requires-python '${{ matrix.python-version }}'
rye sync --all-features
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install the project
run: uv sync --all-extras --dev

- name: Run pre-commit
run: |
. .venv/bin/activate
pre-commit run --all-files
run: uv run pre-commit run --all-files

- name: Sphinx Build
- name: Build docs
working-directory: ./docs
run: |
. ../.venv/bin/activate
make html
run: uv run make html

- name: Test with pytest
run: |
. .venv/bin/activate
rye test
run: uv run pytest tests
25 changes: 10 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,23 @@ jobs:
working-directory: ./docs
steps:
- name: Checkout code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2

- name: "Set Python Version ${{ matrix.python-version }}"
run: echo '${{ matrix.python-version }}' > .python-version

- name: Setup Rye
id: setup-rye
uses: eifinger/setup-rye@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
version: "0.41.0"
cache-dependency-glob: "uv.lock"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install 3.13

- name: Install Project Dependencies
run: |
rye pin --no-update-requires-python '3.12'
rye sync --all-features
- name: Install the project
run: uv sync --all-extras --dev

- name: Make docs
working-directory: ${{env.working-directory}}
run: |
source ../.venv/bin/activate
make html
run: uv run make html

- name: Deploy
uses: peaceiris/actions-gh-pages@v4.0.0
Expand Down
46 changes: 18 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2

- name: "Set Python Version ${{ matrix.python-version }}"
run: echo '${{ matrix.python-version }}' > .python-version

- name: Setup Rye
id: setup-rye
uses: eifinger/setup-rye@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.41.0"
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}
cache-dependency-glob: "uv.lock"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install 3.13

- name: Install Project Dependencies
run: |
rye pin --no-update-requires-python '3.12'
rye sync --all-features
- name: Install the project
run: uv sync --all-extras --dev

- name: Build project
run: rye build --all --clean
run: uv build

- name: Generate Changelog
run: uv run git cliff > CHANGELOG.md

- name: Zip project
run: zip --junk-paths matrixctl.zip dist/* README.md LICENSE.txt
run: zip --junk-paths matrixctl.zip dist/* README.md LICENSE.txt CHANGELOG.md

- name: Generate changelog_latest.md
run: git cliff --latest > changelog_latest.md
run: uv run git cliff --latest > changelog_latest.md

- name: Get the version
id: get_version
Expand All @@ -70,15 +69,6 @@ jobs:
run: rm -rf matrixctl.zip changelog_latest.md

- name: Publish
run: rye publish --token <your_token> --yes --skip-existing
# - name: pypi-publish
# uses: pypa/gh-action-pypi-publish@v1.10.2
# with:
# # PyPI user
# # user: # optional, default is __token__
# # Password for your PyPI user or an access token
# password: ${{ secrets.pypi_token }}
# # The repository URL to use
# # repository_url: # optional
# # The target directory for distribution
# # packages_dir: # optional, default is dist
env:
UV_PUBLISH_TOKEN: ${{ secrets.pypi_token }}
run: uv publish
22 changes: 18 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ minimum_pre_commit_version: 2.13.0

exclude: ^requirements.*\.lock$
repos:
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.10
hooks:
# Update the uv lockfile
- id: uv-lock

- repo: meta
hooks:
- id: check-hooks-apply
Expand Down Expand Up @@ -75,15 +82,15 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.9
rev: v0.8.3
hooks:
- id: ruff # Linter
args: [--fix]
- id: ruff-format # Formatter

# static type checking with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies:
Expand All @@ -99,11 +106,11 @@ repos:
hooks:
- id: interrogate
args: [tests]
language_version: python3.10
# language_version: python3.10

# vulture
- repo: https://github.com/jendrikseipp/vulture
rev: "v2.13"
rev: "v2.14"
hooks:
- id: vulture

Expand All @@ -113,3 +120,10 @@ repos:
hooks:
- id: pycln
args: [--config=pyproject.toml]

# # basedpyright
# - repo: https://github.com/DetachHead/basedpyright-pre-commit-mirror
# rev: 1.23.0
# hooks:
# - id: basedpyright
# args: [--venvpath=.venv]
89 changes: 89 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
.PHONY: all

all: help


##@
##@ Build Commands
##@

update: ##@ Update the dependencies to the ones defined
##@ in the pyproject.toml [alias: u]
uv sync --all-extras --upgrade

u: update

build: ##@ Build the application [alias: b]
uv build

b: build

run: ##@ Build and run the application [alias: r]
uv run matrixctl

r: run

##@
##@ Check Commands
##@


check: fmt lint test ##@ Format, lint, run tests
##@ [alias: c]

c: check

test: ##@ Run tests [alias: t]
uv run coverage run -m pytest --doctest-modules

t: test

fmt: ##@ Format the project
ruff format

lint: lint-toml lint-python lint-type ##@ Lint the the source code (Rust, TOML)

lint-toml: ##@ Lint all TOML files
taplo lint --colors always

lint-python: ##@ Run ruff
uv run ruff check

lint-type: ##@ Run basedpyright
uv run basedpyright

tox: ##@ Run tox
uv tool run tox

##@
##@ Documentation Related Commands
##@

doc: ##@ Build the documentation [alias: d]
cargo doc --color always --bins --no-deps --frozen --examples --open --verbose --release

d: docs

changelog-unreleased: ##@ Preview the unreleased changes
git cliff --unreleased

##@
##@ Misc commands
##@

lines: ##@ Show lines of code
tokei

help: ##@ This help message
@printf "\nUsage: make <command>\n"
@grep -F -h "##@" $(MAKEFILE_LIST) | grep -F -v grep -F | sed -e 's/\\$$//' | awk 'BEGIN {FS = ":*[[:space:]]*##@[[:space:]]*"}; \
{ \
if($$2 == "") \
pass; \
else if($$0 ~ /^#/) \
printf "\n\n\033[1m%s\033[0m\n", $$2; \
else if($$1 == "") \
printf " %-25s%s\n", "", $$2; \
else \
printf "\n \033[34m%-25s\033[0m %s\n", $$1, $$2; \
}'
8 changes: 4 additions & 4 deletions docs/source/contributer_documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Add a feature
you are about to change and why you want to change anything.

1. Make sure you have at least ``Python 3.10``,
`rye <https://https://rye.astral.sh//>`_, and
`pre-commit <https://pre-commit.com/>`_ installed.
`uv <https://docs.astral.sh/uv/>`_, and the plugin
`tox-uv <https://github.com/tox-dev/tox-uv/>`_ installed.
2. Create a fork of MatrixCtl.
3. Clone the fork (``origin``) to your local machine.
4. Add the original repository as a remote named ``upstream``.
Expand All @@ -59,13 +59,13 @@ Add a feature
For example:
Let's say your issue was issue ``#42`` and you want to create a feature.
Your branch name would be ``feature/#42`` or ``feature/#42-my-cool-feature``.
#. Install the required tools with ``rye sync --all-features``
#. Install the required tools with ``rye sync --all-extras --dev``
#. Implement your feature or fix the bug you described in your issue.
#. Create a ``Pull Request`` as soon as possible as ``draft``, so other
contributors are able to help you and follow your progress.
#. Make sure to add/alter the documentation.
#. Add/alter tests, to test your code.
#. Run ``tox``. If everything is green with no errors, you are good to go.
#. Run ``make tox``. If everything is green with no errors, you are good to go.
#. Describe your changes using
`Conventional Commits <https://www.conventionalcommits.org/en/>`_.
#. Publish your branch to your fork (``origin``).
Expand Down
Loading

0 comments on commit 8a49dee

Please sign in to comment.