Skip to content

#45 Migrate to a pyproject.toml file and add wheel builds. #47

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
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
30 changes: 20 additions & 10 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,41 @@ on:

jobs:
build:
name: Build source distribution
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Build the sdist
python-version: "3.9"
- name: Install build dependencies
run: |
python setup.py sdist
python -m pip install --upgrade pip
python -m pip install build
- name: Build sdist and wheel
run: |
python -m build
- name: Check the sdist installs and imports
run: |
mkdir -p test-sdist
cd test-sdist
python -m venv venv-sdist
venv-sdist/bin/python -m pip install ../dist/logical-unification-*.tar.gz
- uses: actions/upload-artifact@v2
venv-sdist/bin/python -m pip install ../dist/logical_unification-*.tar.gz
- name: Check the wheel installs and imports
run: |
mkdir -p test-wheel
cd test-wheel
python -m venv venv-wheel
venv-wheel/bin/python -m pip install ../dist/logical_unification-*.whl
- uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*

upload_pypi:
name: Upload to PyPI on release
name: Upload distributions to PyPI on release
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
Expand All @@ -44,7 +54,7 @@ jobs:
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@master
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_secret }}
69 changes: 35 additions & 34 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
outputs:
changes: ${{ steps.changes.outputs.src }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v2
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
Expand All @@ -29,9 +29,9 @@ jobs:
src:
- *python
- '.github/**/*.yml'
- 'pyproject.toml'
- 'setup.cfg'
- 'requirements.txt'
- '.coveragerc'
- '.pre-commit-config.yaml'

style:
Expand All @@ -40,11 +40,11 @@ jobs:
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.changes == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: pre-commit/action@v2.0.0
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- uses: pre-commit/action@v3.0.1

test:
needs:
Expand All @@ -55,29 +55,30 @@ jobs:
strategy:
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- '3.10'
- pypy3
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "pypy3.9"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
pytest -v tests/ --benchmark-skip --cov=unification --cov-report=xml:./coverage.xml
pytest -v tests/ --benchmark-only --benchmark-autosave --benchmark-group-by=group,param:size --benchmark-max-time=3
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: run-${{ matrix.python-version }}
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
pytest -v tests/ --benchmark-skip --cov=unification --cov-report=xml:./coverage.xml
pytest -v tests/ --benchmark-only --benchmark-autosave --benchmark-group-by=group,param:size --benchmark-max-time=3
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: run-${{ matrix.python-version }}

all-checks:
if: ${{ always() }}
Expand All @@ -95,7 +96,7 @@ jobs:
if: ${{ needs.changes.outputs.changes == 'true' && needs.all-checks.result == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@ tags

# End of https://www.gitignore.io/api/vim,emacs,python

.benchmarks/
.benchmarks/
41 changes: 31 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
exclude: |
(?x)^(
versioneer\.py|
unification/_version\.py|
doc/.*|
bin/.*
)$
(?x)^(
doc/.*|
bin/.*|
dist/.*|
\.?venv.*
)$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.7.0
hooks:
- id: black
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.5.2
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
exclude: |
(?x)^(
.*/?__init__\.py|
)$
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
]
45 changes: 43 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
include versioneer.py
include unification/_version.py
# File patterns to exclude globally
global-exclude .DS_Store
global-exclude __pycache__
global-exclude *.pyc
global-exclude *.pyo
global-exclude *.orig
global-exclude *.rej
global-exclude *~
global-exclude *.swp
global-exclude *.swo
global-exclude .coverage
global-exclude .python-version
global-exclude .gitignore
global-exclude .gitattributes
global-exclude .pre-commit-config.yaml
global-exclude tox.ini
global-exclude .pylintrc
global-exclude Makefile
global-exclude requirements.txt

# Directory trees to exclude completely
prune .git
prune .github
prune .vscode
prune .idea
prune .ropeproject
prune .pytest_cache
prune .tox
prune htmlcov
prune .nox
prune build
prune dist
prune .eggs
prune docs/_build
prune docs/.doctrees
prune .env
prune .venv
prune venv
prune env
prune tests

# Exclude egg-info directories but allow the current build's egg-info
global-exclude *.egg-info
84 changes: 84 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[build-system]
requires = ["setuptools>=80.0.0", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "logical-unification"
dynamic = ["version"]
description = "Logical unification in Python"
readme = "README.md"
license = "BSD-3-Clause"
authors = [
{ name = "Brandon T. Willard", email = "[email protected]" },
]
requires-python = ">=3.9"
dependencies = ["toolz", "multipledispatch"]
keywords = ["unification", "logic-programming", "dispatch"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
]

[project.urls]
Homepage = "https://github.com/pythological/unification"

[project.optional-dependencies]
test = ["pytest"]

[tool.setuptools.packages.find]
include = ["unification*"]
exclude = ["tests*"]

[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "dirty-tag"

[tool.pydocstyle]
add-ignore = [
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D202",
]
convention = "numpy"

[tool.pytest.ini_options]
python_functions = "test_*"
python_files = "test*.py"
testpaths = ["tests"]

[tool.coverage.run]
relative_files = true
omit = ["tests/*"]

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "raise NotImplementedError"]

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88


[tool.pylint]
max-line-length = 88

[tool.pylint.messages_control]
disable = ["C0330", "C0326"]
Loading