Skip to content
Merged
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
16 changes: 16 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Linter

on: [pull_request]

jobs:
lint-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Lint
uses: chartboost/ruff-action@v1
- name: Check Format
uses: chartboost/ruff-action@v1
with:
args: 'format --check'
62 changes: 62 additions & 0 deletions .github/workflows/publish_package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and Publish Package

on:
push:
tags: ['*']

jobs:
build-and-publish:
runs-on: ubuntu-latest
name: Build and Publish Package
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: pip install twine build
- name: Build the package
run: python -m build
- name: Upload package to artifact
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Add PyPI Config
run: echo ${{ secrets.PYRC_CONFIG }} | base64 -d > ~/.pypirc
- name: Publish package to PyPI
run: twine upload --repository forwarder dist/*

sign-release:
runs-on: ubuntu-latest
name: Sign and Release the Package to GitHub
needs: build-and-publish

permissions:
contents: write
id-token: write

steps:
- name: Download the package distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs:
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --generate-notes
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release upload '${{ github.ref_name }}' --repo '${{ github.repository }}' dist/**
134 changes: 134 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so
/.idea
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

.vscode/settings.json
.vscode

data
.env
assets
__pycache__
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: requirements-txt-fixer
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.13.0
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
85 changes: 85 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
[project]
name = "mem-db-utils"
version = "0.1.0"
description = "Python package for in memory database to be used for cache, fast-access storages."
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"pydantic>=2.11.7",
"pydantic-settings>=2.10.1",
"python-dotenv>=1.1.1",
"redis>=6.2.0",
]
authors = [{ name = "Faizan Azim", email = "faizanazim11@gmail.com" }]

[[tool.uv.index]]
name = "prismatica-pypi"
url = "https://readUser:hh(iBaf71$icV63@pypi.prismatica.in/simple"

[build-system]
requires = ["uv_build>=0.8.0,<0.9"]
build-backend = "uv_build"

[dependency-groups]
dev = [
"coverage>=7.10.2",
"pre-commit>=4.2.0",
"pytest>=8.4.1",
"pytest-cov>=6.2.1",
"pytest-dotenv>=0.5.2",
]

[tool.pytest.ini_options]
pythonpath = ["src", "."]
env_files = [".env"]

[tool.ruff]
lint.select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
]
lint.ignore = [
# "E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"E402",
"B904",
"B905",
"B009",
"C417",

]
line-length = 120
target-version = "py312"

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]

[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true

[tool.coverage.report]
precision = 2
fail_under = 50
show_missing = true
skip_covered = true
exclude_lines = [
"pragma: no cover",
"pragma: nocover",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
"raise NotImplementedError",
]

[tool.coverage.run]
omit = [
"*/tests/*",
"*/src/constants/*",
"*/src/db/*",
"app.py",
"main.py",
]
Loading