Skip to content

Enh/uv pyproject #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Nov 18, 2024
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
20 changes: 0 additions & 20 deletions .flake8

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CICD

on:
push:
branches-ignore:
- main

jobs:

test:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
experimental: [false]
include:
- python-version: "3.13"
experimental: true
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make dev
- name: Lint with flake8
run: make lint
- name: Test with pytest
run: make test
5 changes: 2 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Build documentation
run: |
make venv
make dev
make pages
- name: Deploy documentation
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read

jobs:

release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup venv
if: github.event_name == 'release' && github.event.action == 'created'
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: make install
- name: Build package
if: github.event_name == 'release' && github.event.action == 'created'
run: make build
- name: Publish package
if: github.event_name == 'release' && github.event.action == 'created'
# uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
54 changes: 0 additions & 54 deletions .github/workflows/python-package.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
# this assumes that you have created a personal access token
# (PAT) and configured it as a GitHub action secret named
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
token: ${{ secrets.GH_TOKEN }}
# this is a built-in strategy in release-please, see "Action Inputs"
# for more options
# https://github.com/googleapis/release-please-action?tab=readme-ov-file#how-should-i-write-my-commits
release-type: simple
24 changes: 0 additions & 24 deletions .github/workflows/test.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .readthedocs.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

56 changes: 32 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,45 +1,53 @@


##@ Utility
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)


.PHONY: venv
venv:
pip install -U pip setuptools wheel pipenv
uv: ## Install uv
@command -v uv >/dev/null 2>&1 || curl -LsSf https://astral.sh/uv/install.sh | sh

.PHONY: dev
dev:
pipenv install --dev
dev: uv ## Install dev dependencies
uv sync --dev

.PHONY: install
install:
pipenv install --skip-lock
install: uv ## Install dependencies
uv sync

.PHONY: test
test:
pipenv run pytest
test: ## Run tests
uv run pytest

.PHONY: lint
lint:
pipenv run flake8 src
pipenv run pydocstyle --match='(?!test_|_version).*\.py' --convention=numpy src
lint: ## Run linters
uv run ruff check ./src ./tests

.PHONY: fix
fix:
pipenv run black -l79 ./ineqpy/
fix: ## Fix lint errors
uv run ruff check ./src ./tests --fix

.PHONY: cov
cov: ## Run tests with coverage
uv run pytest --cov=src --cov-report=term-missing

.PHONY: pages
pages: doc
pages: doc ## Build documentation and push to gh-pages
mkdir gh-pages
touch gh-pages/.nojekyll
cp -r docs/build/html/* gh-pages/

.PHONY: doc
doc:
cd docs && pipenv run make html

.PHONY: vim
vim:
pipenv run nvim .
doc: ## Build documentation
cd docs && uv run make html

.PHONY: build
build:
python setup.py sdist bdist_wheel
build: ## Build package
uv build

docker:
docker run -v ${PWD}:/git/$(shell basename ${PWD}) -w /git/$(shell basename ${PWD}) -it python:3.9 /bin/bash
.PHONY: dbash
dbash: ## Run docker
docker run -v ${PWD}:/git/$(shell basename ${PWD}) -w /git/$(shell basename ${PWD}) -it python:3.12 /bin/bash
30 changes: 0 additions & 30 deletions Pipfile

This file was deleted.

Loading
Loading