diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 61e12f64..844bafbe 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,19 +1,19 @@ -[bumpversion] -current_version = 0.14.4 -commit = False -tag = False -parse = (?P\d+)\.(?P\d+)\.(?P\d+)(-(?P[a-z]+)(?P\d+))? -serialize = - {major}.{minor}.{patch}-{release}{num} - {major}.{minor}.{patch} +# [bumpversion] +# current_version = 0.14.4 +# commit = False +# tag = False +# parse = (?P\d+)\.(?P\d+)\.(?P\d+)(-(?P[a-z]+)(?P\d+))? +# serialize = +# {major}.{minor}.{patch}-{release}{num} +# {major}.{minor}.{patch} -[bumpversion:part:release] -optional_value = alpha -values = - alpha - beta - pre-release +# [bumpversion:part:release] +# optional_value = alpha +# values = +# alpha +# beta +# pre-release -[bumpversion:file:pyproject.toml] +# [bumpversion:file:pyproject.toml] -[bumpversion:file:dsg_lib/__init__.py] +# [bumpversion:file:dsg_lib/__init__.py] diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d6759665..932d6f9c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -24,7 +24,7 @@ jobs: max-parallel: 10 matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.12","3.9", "3.10", "3.11"] + python-version: ["3.12","3.11", "3.10", "3.9"] steps: - uses: actions/checkout@v4 - name: Wait for PostgreSQL to become ready @@ -39,10 +39,15 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Clear pip cache + run: pip cache purge + - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt --use-deprecated=legacy-resolver + run: pip install --no-cache-dir -r requirements.txt + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt --use-deprecated=legacy-resolver - name: Test with pytest run: | pip install pytest diff --git a/README.md b/README.md index f882bb04..77283bc2 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ Support Python Versions ![Static Badge](https://img.shields.io/badge/Python-3.12%20%7C%203.11%20%7C%203.10%20%7C%203.9-blue) [![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) +[![Coverage Status](./coverage-badge.svg?dummy=8484744)](./reports/coverage/index.html) +[![Tests Status](./tests-badge.svg?dummy=8484744)](./reports/coverage/index.html) CI/CD Pipeline: diff --git a/coverage-badge.svg b/coverage-badge.svg index d60829f4..05796758 100644 --- a/coverage-badge.svg +++ b/coverage-badge.svg @@ -1,22 +1 @@ - - coverage: 100.00% - - - - - - - - - - - - - - - coverage - - 100.00% - - +coverage: 100.00%coverage100.00% diff --git a/coverage.xml b/coverage.xml index cc426c46..0880fee9 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,9 +1,9 @@ - - + + - /github/workspace + /workspaces/devsetgo_lib @@ -25,7 +25,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -50,15 +50,15 @@ - - + + - - - - - - + + + + + + @@ -103,7 +103,7 @@ - + @@ -118,21 +118,21 @@ - - - + + + - - - - + + + + - + @@ -142,219 +142,219 @@ - - - - - - - - - + + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + @@ -365,46 +365,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -418,166 +418,166 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - + @@ -589,50 +589,50 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -646,68 +646,68 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + @@ -719,7 +719,7 @@ - + @@ -727,8 +727,8 @@ - - + + @@ -744,7 +744,7 @@ - + @@ -766,33 +766,33 @@ - - + + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/dsg_lib/__init__.py b/dsg_lib/__init__.py index 50ced766..3209b01e 100644 --- a/dsg_lib/__init__.py +++ b/dsg_lib/__init__.py @@ -8,7 +8,7 @@ """ from datetime import date -__version__ = "0.14.4" +__version__ = "2024.10.20.1" __author__ = "Mike Ryan" __license__ = "MIT" __copyright__ = f"Copyright© 2021-{date.today().year}" diff --git a/makefile b/makefile index 1e0730a2..342d7aba 100644 --- a/makefile +++ b/makefile @@ -30,14 +30,9 @@ black: ## Reformat Python code to follow the Black code style black $(TESTS_PATH) black $(EXAMPLE_PATH) -bump-minor: ## Bump the minor version number x.1.0 - bump2version minor +bump: ## Bump the version of the project + bumpcalver --build -bump-release: ## Bump the release version number x.x.x-beta.1 - bump2version release - -bump-patch: ## Bump the patch version number x.x.1 - bump2version patch cleanup: isort ruff autoflake ## Run isort, ruff, autoflake @@ -83,8 +78,9 @@ test: ## Run the project's tests pytest sed -i 's|/workspaces/$(REPONAME)|/github/workspace|' /workspaces/$(REPONAME)/coverage.xml genbadge coverage -i /workspaces/$(REPONAME)/coverage.xml - flake8 --tee . > htmlcov/_flake8Report.txt + genbadge tests -i /workspaces/$(REPONAME)/report.xml +tests: test ## Run the project's tests build: ## Build the project python -m build diff --git a/pyproject.toml b/pyproject.toml index d52eecad..37926d19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,25 +1,30 @@ -# [build-system] -# requires = ["setuptools", "wheel"] -# build-backend = "setuptools.build_meta:__legacy__" - [build-system] requires = ["hatchling"] build-backend = "hatchling.build" [project] name = "devsetgo_lib" -version = "0.14.4" +version = "2024.10.20.1" requires-python = ">=3.9" description = """ DevSetGo Library is a Python library offering reusable functions for efficient coding. It includes file operations, calendar utilities, pattern matching, advanced logging with loguru, FastAPI endpoints, async database handling, and email validation. Designed for ease of use and versatility, it's a valuable tool for Python developers. """ -keywords = ["python", "library", "reusable functions", "file operations", "calendar utilities", "pattern matching", "logging", "loguru", "FastAPI", "async database", "CRUD operations", "email validation", "development tools"] -readme = "README.md" -authors = [{ name = "Mike Ryan", email = "mikeryan56@gmail.com" }] -maintainers = [ - { name = "Mike Ryan", email = "mikeryan56@gmail.com" }, # Optional +keywords = [ + "python", + "library", + "reusable functions", + "file operations", + "calendar utilities", + "pattern matching", + "logging", + "loguru", + "FastAPI", + "async database", + "CRUD operations", + "email validation", + "development tools", ] -license = { file = "LICENSE" } +readme = "README.md" classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", @@ -28,114 +33,59 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + # "Programming Language :: Python :: 3.13", "Operating System :: POSIX :: Linux", "Operating System :: POSIX", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", ] - dependencies = [ "loguru>=0.7.0", "packaging>=20.0", - "email-validator>=2.1.1" + "email-validator>=2.1.1", ] -# loguru = ">=0.7.0" -# packaging = ">=20.0" +[[project.authors]] +name = "Mike Ryan" +email = "mikeryan56@gmail.com" +[[project.maintainers]] +name = "Mike Ryan" +email = "mikeryan56@gmail.com" +[project.license] +file = "LICENSE" [project.urls] - Homepage = "https://github.com/devsetgo/devsetgo_lib" - Documentation = "https://devsetgo.github.io/devsetgo_lib/" - Repository = "https://github.com/devsetgo/devsetgo_lib" - +Homepage = "https://github.com/devsetgo/devsetgo_lib" +Documentation = "https://devsetgo.github.io/devsetgo_lib/" +Repository = "https://github.com/devsetgo/devsetgo_lib" [project.optional-dependencies] -postgres = ["asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99"] -sqlite = ["aiosqlite>=0.17.0", "sqlalchemy>=2.0.10,<2.0.99"] -oracle = ["oracledb>=2.4.1,<2.5.0", "sqlalchemy>=2.0.10,<2.0.99"] -mssql = ["aioodbc>=0.4.1", "sqlalchemy>=2.0.10,<2.0.99"] -fastapi = ["fastapi>=0.100.0", "pydantic[email]>=2.0"] -all = [ - "asyncpg>=0.21.0", - "sqlalchemy>=2.0.10,<2.0.99", - "aiosqlite>=0.17.0", - "oracledb>=2.4.1,<2.5.0", - "fastapi>=0.100.0", - "pydantic[email]>=2.0", - "aioodbc>=0.4.1", -] +postgres = [ "asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99",] +sqlite = [ "aiosqlite>=0.17.0", "sqlalchemy>=2.0.10,<2.0.99",] +oracle = [ "oracledb>=2.4.1,<2.5.0", "sqlalchemy>=2.0.10,<2.0.99",] +mssql = [ "aioodbc>=0.4.1", "sqlalchemy>=2.0.10,<2.0.99",] +fastapi = [ "fastapi>=0.100.0", "pydantic[email]>=2.0",] +all = [ "asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99", "aiosqlite>=0.17.0", "oracledb>=2.4.1,<2.5.0", "fastapi>=0.100.0", "pydantic[email]>=2.0", "aioodbc>=0.4.1",] [project.scripts] -# Add your scripts here if any - -[tool.hatch.build.targets.sdist] -include = [ - "/dsg_lib", -# "/tests", -] -exclude = [ - "*.json", - "pkg/_compat.py", -] - -[tool.hatch.build.targets.wheel] -packages = ["dsg_lib"] [tool.ruff] -# Same as Black. line-length = 100 indent-width = 4 unsafe-fixes = true -# Assume Python 3.8 target-version = "py312" -src = ["dsg_lib", "test"] -exclude = ["unreleased/*","scripts/*","coverage.xml","coverage-badge.svg"] #,"examples/*" - -[tool.ruff.lint] -select = [ - "C", # mccabe rules - "F", # pyflakes rules - "E", # pycodestyle error rules - "W", # pycodestyle warning rules - "B", # flake8-bugbear rules -] -ignore = [ - "C901", # max-complexity-10 - "E501", # line-too-long - "B017", - "B904", - "B008", - "I", # isort rules -] - -[tool.ruff.format] -indent-style = "space" -quote-style = "single" - - +src = [ "dsg_lib", "test",] +exclude = [ "unreleased/*", "scripts/*", "coverage.xml", "coverage-badge.svg",] [tool.flake8] max-line-length = 100 max-doc-length = 100 -ignore = ["E302", "E501","E303"] # Keeping the ignores the same as before since ruff's specific ignores aren't directly transferable -exclude = [ - ".git", - "__pycache__", - "docs", - "build", - "tests", - "_venv", - "htmlcov", - "scripts", - ".pytest_cache", - ".vscode", - "dist", - "*.egg-info", -] +ignore = [ "E302", "E501", "E303",] +exclude = [ ".git", "__pycache__", "docs", "build", "tests", "_venv", "htmlcov", "scripts", ".pytest_cache", ".vscode", "dist", "*.egg-info",] [tool.isort] -src_paths = ["dsg_lib", "test"] +src_paths = [ "dsg_lib", "test",] force_single_line = false multi_line_output = 3 include_trailing_comma = true @@ -143,29 +93,47 @@ force_grid_wrap = 0 use_parentheses = true line_length = 100 +[tool.bumpcalver] +version_format = "{current_date}-{build_count:03}" +timezone = "America/New_York" +git_tag = true +auto_commit = true +[[tool.bumpcalver.file]] +path = "pyproject.toml" +file_type = "toml" +variable = "project.version" +version_standard = "python" + +[[tool.bumpcalver.file]] +path = "dsg_lib/__init__.py" +file_type = "python" +variable = "__version__" +version_standard = "python" + +[tool.ruff.lint] +select = [ "C", "F", "E", "W", "B",] +ignore = [ "C901", "E501", "B017", "B904", "B008", "I",] + +[tool.ruff.format] +indent-style = "space" +quote-style = "single" + [tool.coverage.run] -source = ["dsg_lib"] -omit = ["setup.py", "_venv/*", "tests/*", "examples/*"] +source = [ "dsg_lib",] +omit = [ "setup.py", "_venv/*", "tests/*", "examples/*",] [tool.coverage.report] -exclude_lines = [ - "pragma: no cover", - "if __name__", - "def main", - "import_sqlalchemy", -] +exclude_lines = [ "pragma: no cover", "if __name__", "def main", "import_sqlalchemy",] [tool.pytest.ini_options] -# pythonpath = "dsg_lib" -norecursedirs = ["/tests"] -testpaths = ["tests"] -python_files = ["test_*.py", "*_test.py"] -addopts = [ - "--cov=./", - "--cov-report=html", - "--cov-report=xml", - "-ra", - "--strict-markers", - "--tb=short", - "-p pytester", -] +norecursedirs = [ "/tests",] +testpaths = [ "tests",] +python_files = [ "test_*.py", "*_test.py",] +addopts = [ "--cov=./", "--cov-report=html", "--cov-report=xml", "--junitxml=report.xml", "-ra", "--strict-markers", "--tb=short", "-p pytester",] + +[tool.hatch.build.targets.sdist] +include = [ "/dsg_lib",] +exclude = [ "*.json", "pkg/_compat.py",] + +[tool.hatch.build.targets.wheel] +packages = [ "dsg_lib",] diff --git a/report.xml b/report.xml new file mode 100644 index 00000000..b62497ac --- /dev/null +++ b/report.xml @@ -0,0 +1 @@ + diff --git a/requirements.txt b/requirements.txt index bc612412..616afdf4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,41 +3,40 @@ aiosqlite==0.20.0 # Vulnerabilities: None asyncpg==0.29.0 # Vulnerabilities: None autoflake==2.3.1 # Vulnerabilities: None autopep8==2.3.1 # Vulnerabilities: None -black==24.8.0 # Vulnerabilities: None -bump2version==1.0.1 # Vulnerabilities: None +black==24.10.0 # Vulnerabilities: None +bumpcalver==2024.10.20.4 # Vulnerabilities: None click==8.1.7 # Vulnerabilities: None -fastapi[all]==0.115.0 # From 0.112.2 | Vulnerabilities: None +fastapi[all]==0.115.2 # Vulnerabilities: None flake8==7.1.1 # Vulnerabilities: None genbadge[all]==1.1.1 # Vulnerabilities: None hatchling==1.25.0 # Vulnerabilities: None loguru==0.7.2 # Vulnerabilities: None mike==2.1.3 # Vulnerabilities: None -mkdocs-material==9.5.34 # From 9.5.33 | Vulnerabilities: None -mkdocs-print-site-plugin==2.6.0 # From 2.5.0 | Vulnerabilities: None -mkdocstrings[python,shell]==0.26.1 # From 0.25.2 | Vulnerabilities: None -oracledb==2.4.1 # From none | Vulnerabilities: None +mkdocs-material==9.5.41 # Vulnerabilities: None +mkdocs-print-site-plugin==2.6.0 # Vulnerabilities: None +mkdocstrings[python,shell]==0.26.2 # Vulnerabilities: None +oracledb==2.4.1 # Vulnerabilities: None packaging==24.1 # Vulnerabilities: None -pre-commit==3.8.0 # Vulnerabilities: None -psycopg2==2.9.9 # Vulnerabilities: None +pre-commit==4.0.1 # Vulnerabilities: None +psycopg2==2.9.10 # Vulnerabilities: None Pygments==2.18.0 # Vulnerabilities: None -pylint==3.3.1 # From 3.2.6 | Vulnerabilities: None -pymdown-extensions==10.9 # Vulnerabilities: None -pytest==8.3.3 # From 8.3.2 | Vulnerabilities: None +pylint==3.3.1 # Vulnerabilities: None +pymdown-extensions==10.11.2 # Vulnerabilities: None +pytest==8.3.3 # Vulnerabilities: None pytest-asyncio==0.24.0 # Vulnerabilities: None pytest-cov==5.0.0 # Vulnerabilities: None pytest-mock==3.14.0 # Vulnerabilities: None pytest-runner==6.0.1 # Vulnerabilities: None pytest-xdist==3.6.1 # Vulnerabilities: None python-json-logger==2.0.7 # Vulnerabilities: None -pytz==2024.2 # From 2024.1 | Vulnerabilities: None PyYAML==6.0.2 # Vulnerabilities: None -ruff==0.6.8 # From 0.6.3 | Vulnerabilities: None -SQLAlchemy==2.0.34 # From 2.0.32 | Vulnerabilities: None +ruff==0.7.0 # Vulnerabilities: None +SQLAlchemy==2.0.36 # Vulnerabilities: None structlog==24.4.0 # Vulnerabilities: None toml==0.10.2 # Vulnerabilities: None -tox==4.23.0 # From 4.18.0 | Vulnerabilities: None +tox==4.23.0 # Vulnerabilities: None tqdm==4.66.5 # Vulnerabilities: None twine==5.1.1 # Vulnerabilities: None -watchdog==5.0.3 # From 5.0.0 | Vulnerabilities: None +watchdog==5.0.3 # Vulnerabilities: None wheel==0.44.0 # Vulnerabilities: None -xmltodict==0.13.0 # Vulnerabilities: None +xmltodict==0.14.2 # Vulnerabilities: None diff --git a/scripts/changelog.py b/scripts/changelog.py index 58698d70..07e0cf17 100644 --- a/scripts/changelog.py +++ b/scripts/changelog.py @@ -2,7 +2,7 @@ import httpx import json from datetime import datetime -import pytz +from zoneinfo import ZoneInfo import asyncio async def get_github_releases(): @@ -14,8 +14,8 @@ async def get_github_releases(): def set_date_time(published_at): published_at = datetime.strptime(published_at, "%Y-%m-%dT%H:%M:%SZ") - published_at = pytz.utc.localize(published_at) # Make it aware in UTC - published_at = published_at.astimezone(pytz.timezone("US/Eastern")) # Convert to US Eastern Time + published_at = published_at.replace(tzinfo=ZoneInfo("UTC")) # Make it aware in UTC + published_at = published_at.astimezone(ZoneInfo("US/Eastern")) # Convert to US Eastern Time return published_at.strftime("%Y %B %d, %H:%M") # Format it to a more human-readable format async def main(): diff --git a/tests-badge.svg b/tests-badge.svg new file mode 100644 index 00000000..80231369 --- /dev/null +++ b/tests-badge.svg @@ -0,0 +1 @@ +tests: 117tests117