Skip to content

Commit

Permalink
Merge pull request #8 from tedivm/improvements
Browse files Browse the repository at this point in the history
cli fixes, ruff, remote setup.cfg/setup.py, setuptools_scm
  • Loading branch information
tedivm committed Feb 10, 2024
2 parents 0b1dadb + 8d5f976 commit d6dba49
Show file tree
Hide file tree
Showing 22 changed files with 152 additions and 858 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/black.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get Python Version from File
id: python_version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT

- uses: actions/setup-python@v5
with:
python-version: ${{ steps.python_version.outputs.version }}

- name: Install Dependencies
run: make install
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/dapperdata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get Python Version from File
id: python_version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT

- uses: actions/setup-python@v5
with:
python-version: ${{ steps.python_version.outputs.version }}

- name: Install Dependencies
run: make install
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/isort.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get Python Version from File
id: python_version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT

- uses: actions/setup-python@v5
with:
python-version: ${{ steps.python_version.outputs.version }}

- name: Install Dependencies
run: make install
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get Python Version from File
id: python_version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT

- uses: actions/setup-python@v5
with:
python-version: ${{ steps.python_version.outputs.version }}

- name: Install Dependencies
run: make install
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ env:
jobs:
pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4

- name: Get Python Version from File
id: python_version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT

- uses: actions/setup-python@v5
with:
python-version: ${{ steps.python_version.outputs.version }}
python-version: "${{ matrix.python_version }}"

- name: Install Dependencies
run: make install
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Ruff Validation

on:
push:

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5

- name: Install Dependencies
run: make install

- name: Test Formatting
run: make ruff_check
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,6 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/

quasiqueue/_version.py
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: local
hooks:
- id: pytest
name: pytest
entry: make pytest
language: system
pass_filenames: false
- id: ruff
name: ruff
entry: make ruff_check
language: system
pass_filenames: false
- id: black
name: black
entry: make black_check
language: system
pass_filenames: false
- id: mypy
name: mypy
entry: make mypy_check
language: system
pass_filenames: false
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.1
3.12
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,12 @@ This method is simple, but the downside is that you lose the environment variabl

```python
from quasiqueue import Settings, QuasiQueue
from pydantic_settings import SettingsConfigDict

class MySettings(Settings)
model_config = SettingsConfigDict(env_prefix="MY_QUEUE_")
lookup_block_size: int = 50

class Config:
prefix="MY_QUEUE_"

QuasiQueue(
"MyQueue",
reader=reader,
Expand Down
27 changes: 15 additions & 12 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,24 @@ pip: $(PYTHON_VENV)
$(PACKAGE_CHECK): $(PYTHON_VENV)
$(PYTHON) -m pip install -e .[dev]

.PHONY: pre-commit
pre-commit:
pre-commit install

#
# Formatting
#

.PHONY: pretty
pretty: black_fixes isort_fixes dapperdata_fixes
.PHONY: chores
chores: ruff_fixes black_fixes dapperdata_fixes

.PHONY: ruff_fixes
ruff_fixes:
$(PYTHON) -m ruff . --fix

.PHONY: black_fixes
black_fixes:
$(PYTHON) -m black .

.PHONY: isort_fixes
isort_fixes:
$(PYTHON) -m isort .
$(PYTHON) -m ruff format .

.PHONY: dapperdata_fixes
dapperdata_fixes:
Expand All @@ -69,7 +72,7 @@ dapperdata_fixes:
#

.PHONY: tests
tests: install pytest isort_check black_check mypy_check dapperdata_check
tests: install pytest ruff_check black_check mypy_check dapperdata_check

.PHONY: pytest
pytest:
Expand All @@ -79,13 +82,13 @@ pytest:
pytest_loud:
$(PYTHON) -m pytest -s --cov=./${PACKAGE_SLUG} --cov-report=term-missing tests

.PHONY: isort_check
isort_check:
$(PYTHON) -m isort --check-only .
.PHONY: ruff_check
ruff_check:
$(PYTHON) -m ruff check

.PHONY: black_check
black_check:
$(PYTHON) -m black . --check
$(PYTHON) -m ruff format . --check

.PHONY: mypy_check
mypy_check:
Expand Down
74 changes: 49 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,53 @@
[build-system]
requires = ["setuptools>=61.0", "versioneer>=0.25"]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=67.0", "setuptools_scm[toml]>=7.1"]

[tool.isort]
profile = "black"
skip = [".venv"]
src_paths = ["quasiqueue", "tests"]

[tool.black]
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| \.env
| _build
| buck-out
| build
| dist
)
)
'''
[project]
authors = [{"name" = "Robert Hafner"}]
dependencies = [
"psutil",
"pydantic~=2.0",
"pydantic-settings",
"typer>=0.9.0",
]
description = "A Simple High Performance Multiprocess Queue"
dynamic = ["version"]
license = {"file" = "LICENSE"}
name = "quasiqueue"
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.10"

[project.optional-dependencies]
dev = [
"build",
"dapperdata",
"glom",
"mypy",
"pytest",
"pytest-cov",
"pytest-pretty",
"ruamel.yaml",
"ruff",
"toml-sort",
"types-psutil",
]

[project.scripts]
quasiqueue = "quasiqueue.cli:app"

[tool.ruff]
exclude = [".venv", "./quasiqueue/_version.py"]
line-length = 120
target-version = ['py38', 'py39', 'py310', 'py311']

[tool.setuptools.dynamic]
readme = {file = ["README.md"]}

[tool.setuptools.package-data]
quasiqueue = ["py.typed"]

[tool.setuptools.packages]
find = {}

[tool.setuptools_scm]
fallback_version = "0.0.0-dev"
write_to = "quasiqueue/_version.py"
12 changes: 7 additions & 5 deletions quasiqueue/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from ._version import get_versions
try:
from . import _version

__version__ = get_versions()["version"]
del get_versions
__version__ = _version.__version__
except: # noqa: E722
__version__ = "0.0.0-dev"

from .runner import QueueRunner as QuasiQueue
from .settings import Settings
from .runner import QueueRunner as QuasiQueue # noqa: F401
from .settings import Settings # noqa: F401
Loading

0 comments on commit d6dba49

Please sign in to comment.