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
61 changes: 61 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright © 2025 Leviftas authors. All rights reserved.
#
# Licensed under the GNU General Public License v3.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.gnu.org/licenses/gpl-3.0.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# test.yml
#
# GitHub Actions workflow for automated testing on push and pull requests.
#
# - Author : FrostLeo <frostleo.dev@gmail.com>
# - Created : 2025/12/5
# - Modified : 2025/12/5

name: Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[all]"

- name: Run type checking
run: |
mypy src/leviftas

- name: Run tests with coverage
run: |
pytest --cov=src/leviftas --cov-report=xml --cov-report=term-missing

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,26 @@

- Author : FrostLeo <frostleo.dev@gmail.com>
- Created : 2025/10/31
- Modified : 2025/10/31
- Modified : 2025/12/5
-->

# ChangeLog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### [#1](https://github.com/Frost-Leo/Leviftas/issues/1) - Python package infrastructure setup

- ci: Add test workflow and Codecov config ([39d3974](https://github.com/Frost-Leo/Leviftas/commit/39d3974))
- build: Add dev optional dependencies ([e5920dc](https://github.com/Frost-Leo/Leviftas/commit/e5920dc))
- ci: Add Codecov configuration ([dfaa05f](https://github.com/Frost-Leo/Leviftas/commit/dfaa05f))
- build: Add mypy type checking configuration ([e8b121f](https://github.com/Frost-Leo/Leviftas/commit/e8b121f))
- feat: Add PEP 561 py.typed marker ([0014950](https://github.com/Frost-Leo/Leviftas/commit/0014950))
- build: Add pytest and coverage configuration ([7194fe8](https://github.com/Frost-Leo/Leviftas/commit/7194fe8))
- test: Add tests directory structure ([0dfb13a](https://github.com/Frost-Leo/Leviftas/commit/0dfb13a))
- build: Add pyproject.toml configuration ([453db1d](https://github.com/Frost-Leo/Leviftas/commit/453db1d))
- feat: Add src/leviftas package layout ([33860d6](https://github.com/Frost-Leo/Leviftas/commit/33860d6))
32 changes: 32 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright © 2025 Leviftas authors. All rights reserved.
#
# Licensed under the GNU General Public License v3.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.gnu.org/licenses/gpl-3.0.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# codecov.yml
#
# Codecov configuration for coverage reporting.
#
# - Author : FrostLeo <frostleo.dev@gmail.com>
# - Created : 2025/12/5
# - Modified : 2025/12/5

coverage:
status:
project:
default:
target: 87%
threshold: 5%
patch:
default:
target: 80%
threshold: 5%
241 changes: 241 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
# Copyright © 2025 Leviftas authors. All rights reserved.
#
# Licensed under the GNU General Public License v3.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.gnu.org/licenses/gpl-3.0.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# pyproject.toml
#
# Project configuration and build system setup for Leviftas SDK.
#
# Documentation
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
#
# - Author : FrostLeo <frostleo.dev@gmail.com>
# - Created : 2025/12/5
# - Modified : 2025/12/5

# Build system configuration - declares build backend and dependencies
[build-system]
requires = [
"setuptools>=80.9.0",
]
build-backend = "setuptools.build_meta"

# Project configuration - defines basic metadata and dependencies
[project]
name = "leviftas"
dynamic = [
"version",
]
description = "A distributed and modular SDK for centralized data platforms, built on Django REST Framework."
readme = {file = "README.md", content-type = "text/markdown"}
license = "GPL-3.0-or-later"
license-files = [
"LICEN[CS]E*",
]
authors = [
{name = "Frost Leo", email = "frostleo.dev@gmail.com"},
]
maintainers = [
{name = "Frost Leo", email = "frostleo.dev@gmail.com"},
]
keywords = [
"leviftas",
"data platform",
]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 5.2",
"Framework :: Pydantic",
"Framework :: Pydantic :: 2",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.13",
"Topic :: Database",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Distributed Computing",
"Topic :: System :: Systems Administration",
"Typing :: Typed",
]
requires-python = ">=3.13"
dependencies = [
]

# Executable scripts - command-line tools installed with the package
# TODO: Add CLI commands when implemented
# [project.scripts]
# leviftas = "leviftas.cli:main"

# Optional dependencies
[project.optional-dependencies]
dev = [
"mypy>=1.18.2",
"types-PyYAML>=6.0.12",
]
test = [
"pytest>=8.4.2",
"pytest-asyncio>=1.2.0",
"pytest-cov>=7.0.0",
"pytest-mock>=3.15.1",
"pytest-timeout>=2.4.0",
]
all = [
"leviftas[dev,test]",
]


# Project URLs
[project.urls]
Homepage = "https://frost-leo.github.io/Leviftas/"
Documentation = "https://github.com/Frost-Leo/Leviftas/wiki"
Repository = "https://github.com/Frost-Leo/Leviftas"
Issues = "https://github.com/Frost-Leo/Leviftas/issues"

# Setuptools-specific configuration
[tool.setuptools]
zip-safe = false
include-package-data = true

[tool.setuptools.packages.find]
where = [
"src",
]

[tool.setuptools.package-dir]
"" = "src"

# Dynamic metadata
[tool.setuptools.dynamic]
version = {attr = "leviftas.__version__"}


# Testing configuration options
[tool.pytest.ini_options]
testpaths = "tests"
xfail_strict = true
pythonpath = [
"src",
]
addopts = [
# Only overwrite the src/leviftas directory and exclude the test files
"--cov=src/leviftas",
# Detailed mode, displaying each test node
"-v",
# Short backtracking information
"--tb=short",
# Strict marking mode
"--strict-markers",
# Generate coverage report in HTML format
"--cov-report=html",
# Display coverage report in terminal
"--cov-report=term",
# Show uncovered line numbers
"--cov-report=term-missing",
# Branch coverage
"--cov-branch",
]
markers = [
"internal: Internal system class-related tests",
]
# Logging configuration
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(name)s: %(message)s"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
# Log file configuration
log_file = "tests/logs/pytest.log"
log_file_level = "DEBUG"
log_file_format = "%(asctime)s [%(levelname)8s] %(filename)s:%(lineno)d - %(funcName)s() - %(message)s"
log_file_date_format = "%Y-%m-%d %H:%M:%S"
# Capture settings
log_level = "INFO"
log_auto_indent = true

# Coverage configuration options
[tool.coverage.run]
source = ["src/leviftas"]
branch = true
relative_files = true
omit = [
"*/tests/*",
"*/__init__.py",
]

[tool.coverage.report]
precision = 2
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
"@overload",
"@typing.overload",
"typing.assert_never",
"assert_never",
]
show_missing = true

[tool.coverage.html]
directory = "htmlcov"

# Package data configuration
[tool.setuptools.package-data]
leviftas = ["py.typed"]

# Mypy type checking configuration
[tool.mypy]
python_version = "3.13"
mypy_path = "src"
packages = ["leviftas"]
strict = true
namespace_packages = true
explicit_package_bases = true
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
strict_equality = true
strict_concatenate = true
show_error_codes = true
show_column_numbers = true
show_error_context = true
pretty = true
color_output = true
error_summary = true
incremental = true
cache_dir = ".mypy_cache"

[[tool.mypy.overrides]]
module = [
"pytest.*",
"pytest_mock.*",
"pytest_asyncio.*",
]
ignore_missing_imports = true
Loading
Loading