Skip to content

Commit

Permalink
Switch build system to pyproject.toml (that was painful)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlesbre committed Feb 16, 2024
1 parent 891c214 commit 8f10b9a
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 141 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ jobs:
python-version: "3.11"
- name: Install dependencies
run: make setup-dev
- name: Lint with flake8
run: make flake8
- name: Run formatters
run: make format-check
- name: Lint and check formatting
run: make check
- name: Typecheck with mypy
run: make mypy
- name: Check script
Expand Down
39 changes: 17 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: mypy
name: mypy
entry: mypy --strict
language: system
types: [python]
- id: black
name: black
entry: black
language: system
types: [python]
- id: isort
name: isort
entry: isort
language: system
types: [python]
- id: flake8
name: flake8
entry: flake8
language: system
types: [python]
- repo: local
hooks:
- id: mypy
name: mypy
entry: mypy --strict
language: system
types: [python]
- id: ruff-check
name: ruff check
entry: ruff check --fix
language: system
types: [python]
- id: ruff-format
name: ruff format
entry: ruff format
language: system
types: [python]
2 changes: 1 addition & 1 deletion bibtexautocomplete/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
URL = "https://github.com/dlesbre/bibtex-autocomplete"
ISSUES_URL = URL + "/issues"
LICENSE = "MIT"
DESCRIPTION = "Module to complete bibtex files by polling online databases"
DESCRIPTION = "Script to autocomplete bibtex files by polling online databases"

VERSION_MAJOR = 1
VERSION_MINOR = 3
Expand Down
30 changes: 12 additions & 18 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,19 @@ mypy: ## Typecheck all files
$(call print,Running mypy)
$(MYPY) --strict ./bibtexautocomplete/ ./tests ./setup.py

.PHONY: flake8
flake8: ## Run flake8 on all files
$(call print,Running flake8)
find bibtexautocomplete -type f -name "*.py" -exec flake8 {} ';'
find tests -type f -name "*.py" -exec flake8 {} ';'

.PHONY: format
format: ## Format files with black and isort
$(call print,Running black)
black ./bibtexautocomplete/ ./tests/
$(call print,Running isort)
isort ./bibtexautocomplete/ ./tests/
$(call print,Running ruff format)
ruff format
$(call print,Running ruff check and fix)
ruff check --fix

.PHONY: format-check
format-check: ## Check that all files are formatted
$(call print,Running black)
black ./bibtexautocomplete/ ./tests/ --check
$(call print,Running isort)
isort ./bibtexautocomplete/ ./tests/ --check
check: ## Check that all files are formatted and lint
$(call print,Running ruff format)
ruff format --check
$(call print,Running ruff check)
ruff check

# =================================================
# Installation
Expand Down Expand Up @@ -143,15 +137,15 @@ clean: ## Remove package
.PHONY: clean-all
clean-all: ## Remove package and venv
$(call print,Removing package and dependencies and virtual environment)
rm -rf build bibtexautocomplete.egg-info
rm -rf build bibtexautocomplete.egg-info htmlcov
rm -rf venv

.PHONY: deploy
deploy: ## Build and deploys the package
$(call print,Removing previous dist)
rm -rf dist/*
rm -rf dist/* bibtexautocomplete.egg-info build
$(call print,Building package)
$(PYTHON) setup.py sdist bdist_wheel
$(PYTHON) -m build
$(call print,Deploying package)
twine upload dist/*

Expand Down
71 changes: 71 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[project]
name = "bibtexautocomplete"
authors = [{ name = "Dorian Lesbre", email = "dorian.lesbre@gmail.com" }]
maintainers = [{ name = "Dorian Lesbre", email = "dorian.lesbre@gmail.com" }]
dynamic = ["version"]
description = "Script to autocomplete bibtex files by polling online databases"
requires-python = ">= 3.8"
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["bibtex", "biblatex", "latex", "autocomplete", "btac"]
dependencies = [
"bibtexparser<2.0.0",
"alive-progress>=3.0.0",
]
classifiers = [
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 5 - Production/Stable",
# Indicate who your project is intended for
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Environment :: Console",
"Natural Language :: English",
# Pick your license as you wish (should match "license" above)
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
"Topic :: Text Processing :: Markup :: LaTeX",
"Topic :: Utilities",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]

[project.urls]
Homepage = "https://github.com/dlesbre/bibtex-autocomplete"
Repository = "https://github.com/dlesbre/bibtex-autocomplete/spam.git"
Issues = "https://github.com/dlesbre/bibtex-autocomplete/issues"
Changelog = "https://github.com/dlesbre/bibtex-autocomplete/blob/master/CHANGELOG.md"

[project.scripts]
btac = "bibtexautocomplete.core:main"

[project.optional-dependencies]
dev = [
"pre-commit",
"pytest",
"mypy",
"ruff",
"coverage",
"pytest-cov",
]

[tool.ruff]
line-length = 120

[tool.ruff.lint]
select = ["E", "F", "B", "W", "I"]

[tool.mypy]
strict = true

[[tool.mypy.overrides]]
module = "bibtexparser.*"
ignore_missing_imports = true
25 changes: 0 additions & 25 deletions setup.cfg

This file was deleted.

71 changes: 0 additions & 71 deletions setup.py

This file was deleted.

0 comments on commit 8f10b9a

Please sign in to comment.