Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
95a5df0
[#67] Moved all source files to the `src` folder.
eoyilmaz Dec 29, 2025
12448f2
[#67] Updated `.gitignore` file.
eoyilmaz Dec 29, 2025
79a32fa
[#67] Moved all the content of the `timecode/__init__.py` to `timecod…
eoyilmaz Dec 29, 2025
162d726
[#67] Added a new empty `__init__.py` file.
eoyilmaz Dec 29, 2025
d79b7d1
[#67] Added `VERSION` file to easily update library version.
eoyilmaz Dec 29, 2025
d948c9f
[#67] Added `Makefile` to start using the Makefile Workflow.
eoyilmaz Dec 29, 2025
e819599
[#67] Updated `MANIFEST.in` file to include only the required files i…
eoyilmaz Dec 29, 2025
0cbd050
[#67] Added `pyproject.toml` and removed `setup.cfg` file.
eoyilmaz Dec 29, 2025
e8fc0b8
[#67] Removed metadata enum values from the `timecode` module.
eoyilmaz Dec 29, 2025
8c1ed36
[#67] Updated the test file to import the `timecode` module correctly.
eoyilmaz Dec 29, 2025
9d2de09
[#67] Removed the `upload_to_pypi[.cmd]` files.
eoyilmaz Dec 29, 2025
39ff783
[#67] Updated the `clean` target in the `Makefile` so that it deletes…
eoyilmaz Dec 29, 2025
df1bfe6
[#67] Updated `.github/workflows/python-package.yml` file:
eoyilmaz Dec 29, 2025
7d817fc
[#67] Updated github workflow to reflect the change of the `master` b…
eoyilmaz Dec 29, 2025
180e1a0
[#67] Updated github workflow to install packages to system wide Python.
eoyilmaz Dec 29, 2025
c4decce
[#67] Updated the module level imports to not to break backwards comp…
eoyilmaz Dec 29, 2025
71406d7
[#67] Fixed all linting errors on the `timecode` module.
eoyilmaz Dec 29, 2025
d38cbbb
[#67] Updated `README.md` with fancy badges.
eoyilmaz Dec 29, 2025
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
18 changes: 9 additions & 9 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: Python package

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

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v2
Expand All @@ -26,14 +26,14 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Lint with flake8
pip install uv
if [ -f requirements-dev.txt ]; then uv pip install -r requirements-dev.txt --system; fi
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
ruff check --statistics ./src
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
ruff check --statistics --exit-zero ./src
- name: Test with pytest
run: |
pytest
PYTHONPATH=./src pytest -n auto -W ignore --color=yes --cov-report term --cov-report html --cov=src/timecode;
18 changes: 11 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
*~*
*.pyc
.DS_Store
.coverage
.DS_Store
.pytest_cache/*
.ruff_cache/*
.venv/*
*.egg-info
*.egg-info/*
*.pyc
*.swp
.venv/*
*~*
build/*
dist/
docs/doctrees/*
docs/html/*
docs/latex/*
docs/doctrees/*
docs/source/generated/*
dist/
build/*
include/*
__pycache__
18 changes: 5 additions & 13 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
include *.txt *.ini *.cfg *.rst *.py

include CHANGELOG
include TODO
include README
include INSTALL
include MANIFEST.in
include CHANGELOG.rst
include LICENSE
include timecode.py
recursive-include docs *
recursive-include tests *

prune docs/build
prune docs/source/generated
include MANIFEST.in
include README.md
global-exclude __pycache__
global-exclude *.py[cod]
90 changes: 90 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
SHELL:=bash
NUM_CPUS = $(shell nproc || grep -c '^processor' /proc/cpuinfo)
PACKAGE_NAME = timecode
SETUP_PY_FLAGS = --use-distutils
VERSION := $(shell cat VERSION)
VERSION_FILE=$(CURDIR)/VERSION
VIRTUALENV_DIR:=.venv
SYSTEM_PYTHON?=python3

all: build FORCE

.PHONY: help
help:
@echo ""
@echo "Available targets:"
@make -qp | grep -o '^[a-z0-9-]\+' | sort

.PHONY: venv
venv:
@printf "\n\033[36m--- $@: Creating Local virtualenv '$(VIRTUALENV_DIR)' using '`which python`' ---\033[0m\n"
$(SYSTEM_PYTHON) -m venv $(VIRTUALENV_DIR)

build:
@printf "\n\033[36m--- $@: Building $(PACKAGE_NAME) ---\033[0m"
@printf "\n\033[36m--- $@: Local install into virtualenv '$(VIRTUALENV_DIR)' ---\033[0m";
@source ./$(VIRTUALENV_DIR)/bin/activate; \
printf "\n\033[36m--- $@: Using python interpreter '`which python`' ---\033[0m\n"; \
pip install uv; \
uv pip install -r requirements.txt -r requirements-dev.txt; \
uv build;

install:
@printf "\n\033[36m--- $@: Installing $(PACKAGE_NAME) to virtualenv at '$(VIRTUALENV_DIR)' using '`which python`' ---\033[0m\n"
source ./$(VIRTUALENV_DIR)/bin/activate; \
uv pip install ./dist/$(PACKAGE_NAME)-$(VERSION)-*.whl --force-reinstall;

clean: FORCE
@printf "\n\033[36m--- $@: Clean ---\033[0m\n"
-rm -rf .pytest_cache
-rm -rf .coverage
-rm -rf .ruff_cache
-rm -rf .tox
-rm -rf $(VIRTUALENV_DIR)
-rm -rf dist
-rm -rf build
-rm -Rf src/$(PACKAGE_NAME)/__pycache__
-rm -Rf tests/__pycache__

clean-all: clean
@printf "\n\033[36m--- $@: Clean All---\033[0m\n"
-rm -f INSTALLED_FILES
-rm -f setuptools-*.egg
-rm -f use-distutils
-rm -f main.py
-rm -Rf htmlcov
-rm .coverage.*
-rm -Rf src/$(PACKAGE_NAME).egg-info
-rm -Rf $(VIRTUALENV_DIR)

html:
./setup.py readme

new-release:
@printf "\n\033[36m--- $@: Generating New Release ---\033[0m\n"
git add $(VERSION_FILE)
git commit -m "Version $(VERSION)"
git push
git checkout main
git pull
git merge develop
git tag $(VERSION)
git push origin main --tags
@source ./$(VIRTUALENV_DIR)/bin/activate; \
printf "\n\033[36m--- $@: Using python interpreter '`which python`' ---\033[0m\n"; \
uv pip install -r requirements.txt; \
uv pip install -r requirements-dev.txt; \
uv build; \
twine check dist/$(PACKAGE_NAME)-$(VERSION).tar.gz; \
twine upload dist/$(PACKAGE_NAME)-$(VERSION).tar.gz;

.PHONY: tests
tests:
@printf "\n\033[36m--- $@: Run Tests ---\033[0m"
@printf "\n\033[36m--- $@: Using virtualenv at '$(VIRTUALENV_DIR)' ---\033[0m"; \
source ./$(VIRTUALENV_DIR)/bin/activate; \
printf "\n\033[36m--- $@: Using python interpreter '`which python`' ---\033[0m\n"; \
PYTHONPATH=src pytest -n auto -W ignore --color=yes --cov-report term --cov-report html --cov=src/$(PACKAGE_NAME);

# https://www.gnu.org/software/make/manual/html_node/Force-Targets.html
FORCE:
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
![license](https://img.shields.io/pypi/l/timecode.svg)
![pyversion](https://img.shields.io/pypi/pyversions/timecode.svg)
![pypiversion](https://img.shields.io/pypi/v/timecode.svg)
![wheel](https://img.shields.io/pypi/wheel/timecode.svg)

About
-----

Expand Down
1 change: 1 addition & 0 deletions VERSION
204 changes: 204 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools",
]

[project]
authors = [
{name = "Erkan Özgür Yılmaz", email = "eoyilmaz@gmail.com"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: MacOS X",
"Environment :: Win32 (MS Windows)",
"Environment :: X11 Applications",
"Intended Audience :: End Users/Desktop",
"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",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Libraries :: Python Modules",
]
description = "SMPTE Time Code Manipulation Library"
dynamic = ["version"]
keywords = ["video", "timecode", "smpte"]
license = "MIT"
maintainers = [
{name = "Erkan Özgür Yılmaz", email = "eoyilmaz@gmail.com"},
]
name = "timecode"
readme = "README.md"
requires-python = ">= 3.9"

[project.urls]
"Home Page" = "https://github.com/eoyilmaz/timecode"
GitHub = "https://github.com/eoyilmaz/timecode"
Repository = "https://github.com/eoyilmaz/timecode.git"
Download = "https://github.com/eoyilmaz/timecode/releases/"

[tool.distutils.bdist_rpm]
doc-files = "LICENSE README.md"
fix-python = 1
packager = "Erkan Ozgur Yilmaz <eoyilmaz@gmail.com>"
release = 1

[tool.distutils.bdist_wheel]
universal = 0

[tool.distutils.install]
record = "INSTALLED_FILES"

[tool.setuptools]
include-package-data = false

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

[tool.setuptools.package-data]
timecode = [
"LICENSE",
"src/timecode/py.typed",
"README.md",
"VERSION",
]

[tool.setuptools.exclude-package-data]
DisplayCAL = [
"docs",
"tests",
"tests/__pycache__"
]

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }
optional-dependencies.test = { file = ["requirements-dev.txt"] }
version = { file = ["VERSION"] }

[tool.black]
line-length = 88

[tool.flake8]
exclude = [
"__pycache__",
".coverage",
".DS_Store",
".github",
".pytest_cache",
".ruff_cache",
".venv",
".vscode",
"build",
"dist",
"docs",
"INSTALLED_FILES",
"MANIFEST.in",
"tests",
"timecode.egg-info",
"VERSION",
]
extend-select = ["B950"]
ignore = ["D107", "E203", "E501", "E701", "SC200", "W503"]
max-complexity = 12
max-line-length = 80
per-file-ignores = [
"DisplayCAL/lib/agw/fmresources.py: B950"
]

[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ANN", # flake-annotations
"ASYNC", # flake-async
"B", # flake8-bugbear
"C", # McCabe complexity
"C4", # flake8-comprehensions
"COM", # flake8-commas
"D", # pydocstyle
"E", # pycodestyle
"F", # Pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt
"I", # isort
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # PEP8 Naming
"NPY", # NumPy-specific rules
"PERF", # perflint
"PIE", # flake8-pie
"PLR", # Pylint - Refactor
"PYI", # flake8-pyi
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific-rules
"Q", # flake8-quotes
"S", # flake-bandit
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"T10", # flake8-debugger
"TC", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"YTT", # flake-2020

]
extend-ignore = [
"ANN002", # missing type annotations args
"ANN003", # missing type annotations kwargs
"COM812", # flake8-commas
"D104", # Missing docstring in in publish package
"D107", # skip docstring for __init__
"D203", # Incorrect blank line before class
"D209", # New line after last paragraph in docstring
"D213", # Multiline docstring summary second line
"D412", # Bland line between header and content
"D416", # Missing section name colon
"E741", # Ambiguous variable name
"E402", # Module level import not at top of file
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments
"PLR0914", # Too many local variables
"PLR0915", # Too many statements
"PLR2004", # Magic value comparison
"PERF203", # Try..except in loop, TODO: Re-enable this later on...
"RUF100", # Unused noqa
"S105", # Hardcoded password
"S110", # try..except..pass
"S603", # Subprocess without shell=True
]

[tool.ruff.lint.mccabe]
max-complexity = 12

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.pytest.ini_options]
pythonpath = [
".",
]

[tool.tox]
requires = ["tox>=4.23.2"]
env_list = ["3.9", "3.10", "3.11", "3.12", "3.13"]

[tool.tox.env_run_base]
description = "run the tests with pytest"
package = "wheel"
wheel_build_env = ".pkg"
deps = [
"pytest>=6",
"pytest-cov",
"pytest-xdist",
]
commands = [
["pytest"],
]

[tool.mypy]
Loading