Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jkobject committed Oct 8, 2024
1 parent 17701dd commit 8a951b2
Show file tree
Hide file tree
Showing 4 changed files with 2,707 additions and 46 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install project
run: make install
run: make virtualenv
continue-on-error: false
- name: Run linter
run: make lint
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
- "*" # Push events to matching v*, i.e. v1.0, v20.15.10

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -38,12 +38,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Build and publish
run: |
poetry publish -u __token__ -p ${{ secrets.POETRY_TOKEN }} --build
uv build && uv publish -u __token__ -p ${{ secrets.POETRY_TOKEN }}
46 changes: 9 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,21 @@ show: ## Show the current environment.

.PHONY: install
install: ## Install the project in dev mode.
@if [ "$(USING_POETRY)" ]; then poetry install && exit; fi
@echo "Don't forget to run 'make virtualenv' if you got errors."
$(ENV_PREFIX)pip install -e '.[dev]'
$(ENV_PREFIX)uv sync --all-extras --dev

.PHONY: fmt
fmt: ## Format code using black & isort.
$(ENV_PREFIX)ruff check --fix grnndata/
$(ENV_PREFIX)ruff check --fix tests/
$(ENV_PREFIX)ruff format tests/
$(ENV_PREFIX)ruff format grnndata/
$(ENV_PREFIX)uv run ruff format grnndata/ tests/

.PHONY: lint
lint: ## Run pep8, black, mypy linters.
$(ENV_PREFIX)ruff check --fix grnndata/
$(ENV_PREFIX)ruff check --fix tests/
# $(ENV_PREFIX)mypy --ignore-missing-imports grnndata/
$(ENV_PREFIX)uv run ruff check --fix grnndata/ tests/

.PHONY: test
test: lint ## Run tests and generate coverage report.
$(ENV_PREFIX)pytest -v --cov-config .coveragerc --cov=grnndata -l --tb=short --maxfail=1 tests/
$(ENV_PREFIX)coverage xml
$(ENV_PREFIX)coverage html
$(ENV_PREFIX)uv run pytest -v --cov-config .coveragerc --cov=grnndata -l --tb=short --maxfail=1 tests/
$(ENV_PREFIX)uv run coverage xml
$(ENV_PREFIX)uv run coverage html

.PHONY: watch
watch: ## Run tests on every change.
Expand All @@ -65,14 +58,11 @@ clean: ## Clean unused files.

.PHONY: virtualenv
virtualenv: ## Create a virtual environment.
@if [ "$(USING_POETRY)" ]; then poetry install && exit; fi
@echo "creating virtualenv ..."
@rm -rf .venv
@python3 -m venv .venv
@./.venv/bin/pip install -U pip
@./.venv/bin/pip install -e .[test]
@echo
@echo "!!! Please run 'source .venv/bin/activate' to enable the environment !!!"
@uv venv
@source .venv/bin/activate
@make install

.PHONY: release
release: ## Create a new tag for release.
Expand All @@ -96,24 +86,6 @@ docs: ## Build the documentation.
@$(ENV_PREFIX)mkdocs build
URL="site/index.html"; xdg-open $$URL || sensible-browser $$URL || x-www-browser $$URL || gnome-open $$URL || open $$URL

.PHONY: switch-to-poetry
switch-to-poetry: ## Switch to poetry package manager.
@echo "Switching to poetry ..."
@if ! poetry --version > /dev/null; then echo 'poetry is required, install from https://python-poetry.org/'; exit 1; fi
@rm -rf .venv
@poetry init --no-interaction --name=a_flask_test --author=rochacbruno
@echo "" >> pyproject.toml
@echo "[tool.poetry.scripts]" >> pyproject.toml
@echo "grnndata = 'grnndata.__main__:main'" >> pyproject.toml
@cat requirements.txt | while read in; do poetry add --no-interaction "$${in}"; done
@cat requirements-test.txt | while read in; do poetry add --no-interaction "$${in}" --dev; done
@poetry install --no-interaction
@mkdir -p .github/backup
@mv requirements* .github/backup
@mv setup.py .github/backup
@echo "You have switched to https://python-poetry.org/ package manager."
@echo "Please run 'poetry shell' or 'poetry run grnndata'"

.PHONY: init
init: ## Initialize the project based on an application template.
@./.github/init.sh
Expand Down
Loading

0 comments on commit 8a951b2

Please sign in to comment.