Skip to content

Commit

Permalink
Merge pull request #19 from gouline/pyproject-build
Browse files Browse the repository at this point in the history
Migrate to uv/pyproject.toml
  • Loading branch information
gouline authored Aug 30, 2024
2 parents 371bdf7 + f1afda1 commit 0e2005d
Show file tree
Hide file tree
Showing 10 changed files with 826 additions and 96 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: "3.8.18"
python-version: "3.8"

- name: Requirements
run: make requirements
- name: Install uv
run: pipx install uv

- name: Dependencies
run: make dependencies

- name: Build
run: make build
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ jobs:
with:
python-version: "3.8"

- uses: actions/cache@v3
- name: Install uv
run: pipx install uv

- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-test.txt') }}
restore-keys: |
${{ runner.os }}-pip-
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/uv.lock') }}

- name: Requirements
run: make requirements
- name: Dependencies
run: make dependencies

- name: Build
run: make build
Expand Down
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

56 changes: 27 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,53 +1,51 @@
build: clean
python3 -m build
.PHONY: dependencies
dependencies:
uv sync --frozen --no-install-project --all-extras

.PHONY: build
build: clean
uv run python3 -m build

.PHONY: clean
clean:
rm -rf build dist
.PHONY: clean

requirements:
python3 -m pip install \
-r requirements.txt \
-r requirements-test.txt
.PHONY: requirements

fix:
ruff format .
ruff check --fix .
.PHONY: fix
fix:
uv run ruff format .
uv run ruff check --fix .

check-lint:
ruff format --check .
ruff check .
.PHONY: check-lint
check-lint:
uv run ruff format --check .
uv run ruff check .

check-type:
mypy molot
.PHONY: check-type
check-type:
uv run mypy molot

check: check-lint check-type
.PHONY: check
check: check-lint check-type

test:
pytest tests
.PHONY: test
test:
uv run pytest tests

pre: fix check test
.PHONY: pre
pre: fix check test

dist-check: build
twine check dist/*
.PHONY: dist-check
dist-check: build
uv run twine check dist/*

dist-upload: check
twine upload dist/*
.PHONY: dist-upload
dist-upload: check
uv run twine upload dist/*

dev-uninstall:
python3 -m pip uninstall -y molot
.PHONY: dev-uninstall
dev-uninstall:
uv pip uninstall molot

dev-install: build dev-uninstall
python3 -m pip install dist/molot-*-py3-none-any.whl
.PHONY: dev-install
dev-install: build dev-uninstall
uv pip install dist/molot-*-py3-none-any.whl
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

[![GitHub Actions](https://github.com/gouline/molot/actions/workflows/master.yml/badge.svg)](https://github.com/gouline/molot/actions/workflows/master.yml)
[![PyPI](https://img.shields.io/pypi/v/molot)](https://pypi.org/project/molot/)
[![Downloads](https://pepy.tech/badge/molot)](https://pepy.tech/project/molot)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/gouline/molot/blob/master/LICENSE)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)

Simple execution orchestrator.

## Requirements

Molot requires Python 3.8 or above.

For development, you will need [uv](https://docs.astral.sh/uv/getting-started/installation/) installed.

## Usage

Create a new orchestration file, e.g. `build.py` for a build orchestration. Make it executable `chmod +x build.py` to make it easier to run.
Expand Down
41 changes: 40 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=60", "setuptools-scm"]

[project]
name = "molot"
description = "Simple execution orchestrator."
readme = "README.md"
requires-python = ">=3.8"
dependencies = ["python-dotenv>=1.0.0"]
dynamic = ["version"]
license = { text = "MIT License" }
authors = [{ name = "Mike Gouline" }]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
]

[project.optional-dependencies]
test = [
"build>=1.0.3",
"twine>=4.0.2",
"ruff>=0.5.5",
"mypy>=1.7.1",
"pytest>=8.3.1",
]

[project.urls]
Homepage = "https://github.com/gouline/molot"

[tool.setuptools]
packages = ["molot"]

[tool.setuptools_scm]
version_file = "molot/_version.py"
Expand Down
6 changes: 0 additions & 6 deletions requirements-test.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

44 changes: 0 additions & 44 deletions setup.py

This file was deleted.

Loading

0 comments on commit 0e2005d

Please sign in to comment.