Skip to content

Commit f8d49ff

Browse files
committed
migrate from setup.py to pyproject.toml
1 parent 4c6e5cd commit f8d49ff

File tree

8 files changed

+406
-56
lines changed

8 files changed

+406
-56
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ dist
88
video_to_ascii.egg-info
99
build/
1010
test.py
11-
env/
11+
env/
12+
__pycache__/
13+
*.mp4

README.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,54 @@
3535

3636
## Installation
3737

38-
Standard installation
38+
### From PyPI (Recommended)
39+
40+
Standard installation (without audio support):
41+
42+
```bash
43+
$ pip install video-to-ascii
44+
```
45+
46+
With audio support:
47+
48+
```bash
49+
$ pip install video-to-ascii[audio]
50+
```
51+
52+
Complete installation (with all optional dependencies):
53+
54+
```bash
55+
$ pip install video-to-ascii[all]
56+
```
57+
58+
### 🔄 Migration Guide
59+
60+
If you were using the old installation method with `--install-option`:
61+
62+
```bash
63+
# ❌ Old way (no longer supported)
64+
$ pip install video-to-ascii --install-option="--with-audio"
65+
66+
# ✅ New way
67+
$ pip install video-to-ascii[audio]
68+
```
69+
70+
**Note**: The `--install-option` flag has been [deprecated by pip](https://pip.pypa.io/en/stable/news/#deprecation-of-install-option-and-global-option) and removed in pip 23.1+.
71+
72+
### From Source
73+
74+
Clone the repository and install:
3975

4076
```bash
41-
$ pip3 install video-to-ascii
77+
$ git clone https://github.com/joelibaceta/video-to-ascii.git
78+
$ cd video-to-ascii
79+
$ pip install .
4280
```
4381

44-
With audio support installation
82+
Or with audio support:
4583

4684
```bash
47-
$ pip3 install video-to-ascii --install-option="--with-audio"
85+
$ pip install .[audio]
4886
```
4987

5088
## How to use

migrate.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Script de migración para video-to-ascii
4+
Ayuda a los usuarios a migrar del sistema antiguo al nuevo
5+
"""
6+
7+
import sys
8+
import subprocess
9+
import os
10+
11+
def main():
12+
print("🎬 Video-to-ASCII Migration Helper")
13+
print("="*50)
14+
15+
# Detectar si están tratando de usar el método antiguo
16+
old_command = any('--install-option' in arg and '--with-audio' in arg for arg in sys.argv)
17+
18+
if old_command or '--help' in sys.argv or len(sys.argv) == 1:
19+
print("\n📢 NOTICE: Installation method has changed!")
20+
print("\n❌ Old way (no longer works):")
21+
print(" pip3 install video-to-ascii --install-option=\"--with-audio\"")
22+
23+
print("\n✅ New ways:")
24+
print(" pip install video-to-ascii # Basic installation")
25+
print(" pip install video-to-ascii[audio] # With audio support")
26+
print(" pip install video-to-ascii[all] # Everything included")
27+
28+
if not ('--help' in sys.argv or len(sys.argv) == 1):
29+
print("\n🔄 Auto-installing with audio support...")
30+
try:
31+
subprocess.run([sys.executable, '-m', 'pip', 'install', 'video-to-ascii[audio]'], check=True)
32+
print("✅ Installation completed successfully!")
33+
except subprocess.CalledProcessError:
34+
print("❌ Installation failed. Please try manually:")
35+
print(" pip install video-to-ascii[audio]")
36+
sys.exit(1)
37+
else:
38+
print("Usage: python migrate.py")
39+
40+
if __name__ == '__main__':
41+
main()

pyproject.toml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "video-to-ascii"
7+
version = "1.3.1"
8+
description = "It is a simple python package to play videos in the terminal"
9+
readme = "README.md"
10+
license = "MIT"
11+
authors = [
12+
{name = "Joel Ibaceta", email = "mail@joelibaceta.com"}
13+
]
14+
maintainers = [
15+
{name = "Joel Ibaceta", email = "mail@joelibaceta.com"}
16+
]
17+
keywords = ["video", "ascii", "terminal", "opencv"]
18+
classifiers = [
19+
"Development Status :: 4 - Beta",
20+
"Intended Audience :: Developers",
21+
"Operating System :: OS Independent",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Topic :: Multimedia :: Video",
29+
"Topic :: Terminals",
30+
]
31+
requires-python = ">=3.8"
32+
dependencies = [
33+
"opencv-python>=4.5.0",
34+
"xtermcolor>=2.0.0",
35+
"ffmpeg-python>=0.2.0",
36+
]
37+
38+
[project.optional-dependencies]
39+
audio = ["pyaudio>=0.2.11"]
40+
dev = [
41+
"pytest>=6.0",
42+
"black",
43+
"flake8",
44+
"mypy",
45+
]
46+
all = ["video-to-ascii[audio]"]
47+
48+
[project.urls]
49+
Homepage = "https://github.com/joelibaceta/video-to-ascii"
50+
Repository = "https://github.com/joelibaceta/video-to-ascii"
51+
Issues = "https://github.com/joelibaceta/video-to-ascii/issues"
52+
Documentation = "https://github.com/joelibaceta/video-to-ascii#readme"
53+
54+
[project.scripts]
55+
video-to-ascii = "video_to_ascii.cli:main"
56+
57+
[tool.setuptools.packages.find]
58+
include = ["video_to_ascii*"]
59+
60+
[tool.setuptools.package-data]
61+
video_to_ascii = ["**/*"]
62+
63+
[tool.black]
64+
line-length = 88
65+
target-version = ["py38", "py39", "py310", "py311"]
66+
67+
[tool.mypy]
68+
python_version = "3.8"
69+
warn_return_any = true
70+
warn_unused_configs = true

requirements.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1-
opencv-python
2-
xtermcolor
1+
# Dependencias básicas
2+
opencv-python>=4.5.0
3+
xtermcolor>=2.0.0
4+
ffmpeg-python>=0.2.0
5+
6+
# Dependencias opcionales para audio
7+
# Instalar con: pip install .[audio]
8+
# pyaudio>=0.2.11
9+
10+
# Para desarrollo
11+
# Instalar con: pip install .[dev]
12+
# pytest>=6.0
13+
# black
14+
# flake8
15+
# mypy

setup.py

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,9 @@
1-
import sys
2-
from setuptools import setup, find_packages
3-
from setuptools.command.install import install
4-
from setuptools.command.develop import develop
5-
from setuptools.command.egg_info import egg_info
1+
"""
2+
Este setup.py se mantiene solo para compatibilidad hacia atrás.
3+
El proyecto ahora usa pyproject.toml como configuración principal.
4+
"""
65

7-
def install_package(package):
8-
import pip
9-
try:
10-
from pip._internal import main
11-
main.main(['install', package])
12-
except AttributeError:
13-
from pip import __main__
14-
__main__._main(['install', package])
6+
from setuptools import setup
157

16-
if "--with-audio" in sys.argv:
17-
install_package('opencv-python')
18-
install_package('pyaudio')
19-
sys.argv.remove("--with-audio")
20-
else:
21-
install_package('opencv-python')
22-
23-
setup(
24-
name="video_to_ascii",
25-
version="1.3.0",
26-
author="Joel Ibaceta",
27-
author_email="mail@joelibaceta.com",
28-
license='MIT',
29-
description="It is a simple python package to play videos in the terminal",
30-
long_description="A simple tool to play a video using ascii characters instead of pixels",
31-
url="https://github.com/joelibaceta/video-to-ascii",
32-
project_urls={
33-
'Source': 'https://github.com/joelibaceta/video-to-ascii',
34-
'Tracker': 'https://github.com/joelibaceta/video-to-ascii/issues'
35-
},
36-
packages=find_packages(),
37-
include_package_data=True,
38-
install_requires=['xtermcolor', 'ffmpeg-python'],
39-
classifiers=[
40-
"Programming Language :: Python :: 3",
41-
"Intended Audience :: Developers",
42-
"License :: OSI Approved :: MIT License",
43-
"Operating System :: OS Independent",
44-
],
45-
keywords='video ascii terminal opencv',
46-
entry_points={
47-
"console_scripts": [
48-
'video-to-ascii=video_to_ascii.cli:main'
49-
]
50-
}
51-
)
8+
# La configuración real está en pyproject.toml
9+
setup()

0 commit comments

Comments
 (0)