Skip to content

Commit

Permalink
support python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
ITProKyle committed Sep 24, 2024
1 parent 863eb5d commit df89489
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ instance/
lib/
lib64/
local_settings.py
node_modules/
nosetests.xml
parts/
pip-delete-this-directory.txt
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"**/__pycache__": true
},
"files.insertFinalNewline": true,
"python.analysis.typeCheckingMode": "strict",
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.testing.pytestArgs": [
"tests",
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ build: ## build the PyPi release

.PHONY: docs
docs: ## delete build artifacts, start sphinx-autobuild server, & open browser window
@if [[ -z "$${CI}" ]]; then \
$(MAKE) --no-print-directory -C docs docs; \
else \
$(MAKE) --no-print-directory docs-changes; \
fi
$(MAKE) --no-print-directory -C docs docs;

docs-changes: ## build HTML docs; only builds changes detected by Sphinx
@$(MAKE) --no-print-directory -C docs html
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
[![pypi](https://img.shields.io/pypi/v/f-lib?style=flat)](https://pypi.org/project/f-lib/)
[![renovate](https://img.shields.io/badge/enabled-brightgreen?logo=renovatebot&logoColor=%2373afae&label=renovate)](https://developer.mend.io/github/finleyfamily/f-lib)

A library of useful functions and classes for python projects.
A library of useful functions and classes for Python projects.
4 changes: 3 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ SPHINXBUILD = poetry run sphinx-build
SOURCEDIR = source
BUILDDIR = build

SHELL := /bin/bash

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Expand All @@ -18,7 +20,7 @@ clean:
docs: clean html-watch ## remove old build artifacts & start sphinx-autobuild server

html-watch: ## start sphinx-autobuild server & open a browser window
@poetry run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) --open-browser
poetry run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) --watch ../f_lib --open-browser

open:
@open build/html/index.html
Expand Down
12 changes: 8 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
"""

import os
import tomllib
import sys
from datetime import date
from pathlib import Path
from typing import Any, cast

from pkg_resources import get_distribution
if sys.version_info < (3, 11):
import tomli as tomllib # pyright: ignore[reportMissingImports]
else:
import tomllib

ROOT_DIR = Path(__file__).parent.parent.parent
DOC_SRC = ROOT_DIR / "docs" / "source"

PYPROJECT_TOML = tomllib.loads((ROOT_DIR / "pyproject.toml").read_text())
PYPROJECT_TOML = cast(dict[str, Any], tomllib.loads((ROOT_DIR / "pyproject.toml").read_text()))
"""Read in the contents of ``../../pyproject.toml`` to reuse it's values."""

# -- Project information -----------------------------------------------------
project = PYPROJECT_TOML["tool"]["poetry"]["name"]
copyright = f"{date.today().year}, Kyle Finley" # noqa: A001, DTZ011
author = PYPROJECT_TOML["tool"]["poetry"]["authors"][0]
version = get_distribution(project).version
version = PYPROJECT_TOML["tool"]["poetry"]["version"]
release = ".".join(version.split(".")[:2]) # short X.Y version


Expand Down
7 changes: 6 additions & 1 deletion f_lib/_environment.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
"""Environment object class."""

from __future__ import annotations

import json
import logging
import os
from pathlib import Path
from typing import Self
from typing import TYPE_CHECKING

from ._system_info import SystemInfo

if TYPE_CHECKING:
from typing_extensions import Self

LOGGER = logging.getLogger(__name__)


Expand Down
4 changes: 3 additions & 1 deletion f_lib/logging/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import logging
from typing import TYPE_CHECKING, Any, Self, TypeAlias, cast
from typing import TYPE_CHECKING, Any, TypeAlias, cast

from pydantic import BaseModel, ConfigDict

Expand All @@ -13,6 +13,8 @@
from collections.abc import Mapping
from types import TracebackType

from typing_extensions import Self

_SysExcInfoType: TypeAlias = (
"tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None]"
)
Expand Down
7 changes: 4 additions & 3 deletions f_lib/mixins/_cli_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ def _run_command(
capture_output: Whether to capture output.
This can be used when not wanting to suppress output but still needing
to process the contents. The output will be buffered and returned as a
string. If ``suppress_output`` is ``True``, this will be ignored.
string. If ``suppress_output`` is :data`True`, this will be ignored.
env: Environment variables.
suppress_output: If ``True``, the output of the subprocess written
to ``sys.stdout`` and ``sys.stderr`` will be captured and
suppress_output: Whether to suppress output.
If :data`True`, the output of the subprocess written
to :data:`sys.stdout` and :data:`sys.stderr` will be captured and
returned as a string instead of being being written directly.
timeout: Number of seconds to wait before terminating the child process.
Internally passed on to :meth:`~subprocess.Popen.communicate`.
Expand Down
41 changes: 39 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Utilities",
"Typing :: Typed",
]
description = "Python library created by Kyle Finley, for Kyle Finley."
description = "A library of useful functions and classes for Python projects."
documentation = "https://f-lib.readthedocs.io"
homepage = "https://f-lib.readthedocs.io"
keywords = []
Expand All @@ -27,7 +28,7 @@ readme = "README.md"
repository = "https://github.com/finleyfamily/f-lib"

[tool.poetry.dependencies]
python = "^3.11"
python = "^3.10"
platformdirs = "^4.1.0"
pydantic = "^2.7.4"
pydantic-settings = "^2.3.4"
Expand Down Expand Up @@ -81,7 +82,7 @@ force-exclude = '''
'''
include = '\.pyi?$'
line-length = 100
target-version = ["py311", "py312"]
target-version = ["py310", "py311", "py312"]

[tool.coverage.report]
exclude_lines = [
Expand Down Expand Up @@ -126,7 +127,7 @@ exclude = [
"**/typings",
]
pythonPlatform = "All"
pythonVersion = "3.11"
pythonVersion = "3.10"
reportDuplicateImport = "none"
reportImportCycles = "none"
reportIncompatibleMethodOverride = "warning"
Expand Down Expand Up @@ -161,7 +162,7 @@ testpaths = ["tests"]
force-exclude = true
line-length = 120
show-fixes = true
target-version = "py311"
target-version = "py310"

[tool.ruff.lint] # https://docs.astral.sh/ruff/settings/#lint
ignore = [
Expand Down

0 comments on commit df89489

Please sign in to comment.