Compare commits

..

1 Commits

Author SHA1 Message Date
Syed Muhammad Dawoud Sheraz Ali
23fc21ea52 build: re-add auto-add for PRs with a different target 2025-01-16 19:08:57 +05:00
11 changed files with 82 additions and 136 deletions

View File

@ -18,6 +18,8 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools
- name: Install dependencies
run: |
pip install .[dev]

View File

@ -1,22 +0,0 @@
# https://hatch.pypa.io/latest/how-to/config/dynamic-metadata/
import os
import typing as t
from hatchling.metadata.plugin.interface import MetadataHookInterface
HERE = os.path.dirname(__file__)
class MetaDataHook(MetadataHookInterface):
def update(self, metadata: dict[str, t.Any]) -> None:
about = load_about()
metadata["version"] = about["__version__"]
def load_about() -> dict[str, str]:
about: dict[str, str] = {}
with open(
os.path.join(HERE, "tutorandroid", "__about__.py"), "rt", encoding="utf-8"
) as f:
exec(f.read(), about)
return about

View File

@ -19,16 +19,6 @@ instructions, because git commits are used to generate release notes:
<!-- scriv-insert-here -->
<a id='changelog-20.0.0'></a>
## v20.0.0 (2025-06-10)
- [Improvement] Migrate packaging from setup.py/setuptools to pyproject.toml/hatch. (by @Abdul-Muqadim-Arbisoft)
- For more details view tutor core PR: https://github.com/overhangio/tutor/pull/1163
- [Improvement] Add hatch_build.py in sdist target to fix the installation issues (by @dawoudsheraz)
- 💥[Feature] Upgrade to teak. (by @Abdul-Muqadim-Arbisoft)
<a id='changelog-19.0.0'></a>
## v19.0.0 (2024-12-09)

2
MANIFEST.in Normal file
View File

@ -0,0 +1,2 @@
recursive-include tutorandroid/patches *
recursive-include tutorandroid/templates *

View File

@ -1,30 +1,25 @@
.DEFAULT_GOAL := help
.PHONY: docs
SRC_DIRS = ./tutorandroid
BLACK_OPTS = --exclude templates ${SRC_DIRS}
# Warning: These checks are not necessarily run on every PR.
test: test-lint test-types test-format test-pythonpackage # Run some static checks.
test: test-lint test-types test-format # Run some static checks.
test-format: ## Run code formatting tests
ruff format --check --diff ${SRC_DIRS}
black --check --diff $(BLACK_OPTS)
test-lint: ## Run code linting tests
ruff check ${SRC_DIRS}
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS}
test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
build-pythonpackage: ## Build the "tutor-android" python package for upload to pypi
python -m build --sdist
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
twine check dist/tutor_android-$(shell make version).tar.gz
format: ## Format code automatically
ruff format ${SRC_DIRS}
black $(BLACK_OPTS)
fix-lint: ## Fix lint errors automatically
ruff check --fix ${SRC_DIRS}
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes.
isort --skip=templates ${SRC_DIRS}
changelog-entry: ## Create a new changelog entry.
scriv create
@ -32,9 +27,6 @@ changelog-entry: ## Create a new changelog entry.
changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect
version: ## Print the current tutor-android version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorandroid", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
ESCAPE = 
help: ## Print this help
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \

View File

@ -1,2 +0,0 @@
- [Improvement] Migrate from pylint and black to ruff. (by @Abdul-Muqadim-Arbisoft)
- [Improvement] Test python package distribution build when running make test. (by @Abdul-Muqadim-Arbisoft)

View File

@ -1,83 +1,2 @@
# https://packaging.python.org/en/latest/tutorials/packaging-projects/
# https://hatch.pypa.io/latest/config/build/
[project]
name = "tutor-android"
license = { text = "AGPL-3.0-only" }
authors = [
{ name = "Edly" },
{ email = "hello@edly.io" }
]
maintainers = [
{ name = "Abdul-Muqadim" },
{ email = "abdul.muqadim@arbisoft.com" }
]
description = "Android mobile app plugin for Tutor"
readme = { file = "README.rst", content-type = "text/x-rst" }
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"tutor>=20.0.0,<21.0.0"
]
# Version will be dynamically loaded from __about__.py
dynamic = ["version"]
[project.optional-dependencies]
dev = [
"tutor[dev]>=20.0.0,<21.0.0",
"ruff",
]
[project.entry-points."tutor.plugin.v1"]
android = "tutorandroid.plugin"
# URLs for documentation and issue tracking
[project.urls]
Homepage = "https://github.com/overhangio/tutor-android"
Documentation = "https://github.com/overhangio/tutor-android"
Code = "https://github.com/overhangio/tutor-android"
Issues = "https://github.com/overhangio/tutor-android/issues"
Community = "https://discuss.openedx.org/tag/tutor"
# Hatch-specific configuration
[tool.hatch.metadata.hooks.custom]
path = ".hatch_build.py"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.sdist]
# Disable strict naming for twine compatibility
strict-naming = false
include = [ "/tutorandroid", '.hatch_build.py' ]
exclude = [ "tests*" ]
[tool.hatch.build.targets.wheel]
packages = ["tutorandroid"]
[tool.ruff]
exclude = ["templates", "docs/_ext"]
[tool.ruff.lint]
# E: pycodestyle errors
# I: isort
# N: pep8-naming
select = ["E", "I", "N"]
# F401: unused-import
# F841: unused-variable
# W292: missing-newline-at-end-of-file
extend-select = ["F401", "F841", "W292"]
[tool.ruff.format]
requires = ["setuptools", "wheel"]

65
setup.py Normal file
View File

@ -0,0 +1,65 @@
import io
import os
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
def load_readme():
with io.open(os.path.join(HERE, "README.rst"), "rt", encoding="utf8") as f:
return f.read()
def load_about():
about = {}
with io.open(
os.path.join(HERE, "tutorandroid", "__about__.py"),
"rt",
encoding="utf-8",
) as f:
exec(f.read(), about) # pylint: disable=exec-used
return about
ABOUT = load_about()
setup(
name="tutor-android",
version=ABOUT["__version__"],
url="https://github.com/overhangio/tutor-android",
project_urls={
"Code": "https://github.com/overhangio/tutor-android",
"Issue tracker": "https://github.com/overhangio/tutor-android/issues",
"Community": "https://discuss.openedx.org",
},
license="AGPLv3",
author="Edly",
author_email="hello@edly.io",
maintainer="Edly",
maintainer_email="abdul.muqadim@arbisoft.com",
description="Android mobile app plugin for Tutor",
long_description=load_readme(),
long_description_content_type="text/x-rst",
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.9",
install_requires=["tutor>=19.0.0,<20.0.0"],
extras_require={"dev": ["tutor[dev]>=19.0.0,<20.0.0"]},
entry_points={
"tutor.plugin.v1": [
"android = tutorandroid.plugin"
]
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)

View File

@ -1 +1 @@
__version__ = "20.0.0"
__version__ = "19.0.0"

View File

@ -15,8 +15,8 @@ spec:
app.kubernetes.io/name: android-app
spec:
securityContext:
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
runAsUser: 1000
runAsGroup: 1000
containers:
- name: android-app
image: {{ ANDROID_APP_DOCKER_IMAGE }}

View File

@ -23,8 +23,8 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
# Version 4.0.0 is not working:
# https://github.com/overhangio/tutor-android/pull/6#issuecomment-1541510489
"APP_VERSION": "3.1.4",
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-android:{{ ANDROID_VERSION }}", # noqa: E501
"APP_DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-android-app:{{ ANDROID_VERSION }}", # noqa: E501
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-android:{{ ANDROID_VERSION }}",
"APP_DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-android-app:{{ ANDROID_VERSION }}",
"ENABLE_RELEASE_MODE": False,
"RELEASE_STORE_PASSWORD": "android store password",
"RELEASE_KEY_PASSWORD": "android release key password",