Skip to content

Commit c9ffe1f

Browse files
authored
Merge pull request #21 from takeyamayuki/develop
PyPI support
2 parents 1e174a0 + 95b7d8b commit c9ffe1f

File tree

9 files changed

+53
-24
lines changed

9 files changed

+53
-24
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ dist-win/
1212
dist-linux/
1313
app-s.spec
1414

15-
# py2exe
1615
.eggs/
17-
setup.py
16+
*.egg-info/
1817

1918
# pip
2019
site-packages

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include requirements.txt

README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,17 @@
3737
- Just download from the latest release(windows, mac only).
3838

3939
# Installation
40-
## 📁 Run as executable file
40+
## 📁 Executable file
4141
Download the zip file that matches your environment from the [latest release](https://github.com/takeyamayuki/NonMouse/releases).
4242

4343
OR
44-
## 🐍 Run as python
44+
## 🐍 PyPI
4545
Run the following script.
4646

4747
```sh
48-
$ git clone https://github.com/takeyamayuki/NonMouse
49-
$ cd NonMouse
50-
$ pip install -r requirements.txt
48+
$ pip install nonmouse
5149
```
52-
If you have trouble installing mediapipe, please visit the [official website](https://google.github.io/mediapipe/getting_started/install.html).
53-
54-
> **Note**
55-
> For mac, you need to add the location where you want to run it, such as Terminal or VScode, to the Security and Privacy Accessibility and Cammera section in System Preferences.
50+
(If you have trouble installing mediapipe, please visit the [official website](https://google.github.io/mediapipe/getting_started/install.html).)
5651

5752
# Usage
5853
## 1. Install a camera
@@ -91,15 +86,14 @@ The following three ways of placing the device are assumed.
9186
OR
9287
- Run the following script from the continuation of the installation.
9388

94-
For windows, linux(global hotkey function does not work in linux.)
89+
For windows and linux(global hotkey function does not work in linux.)
9590
```sh
96-
$ python3 -m nonmouse
91+
$ nonmouse
9792
```
9893

9994
For MacOS, you need execute permission.
10095
```sh
101-
$ sudo /path/to/python3 -m nonmouse
102-
# When you invoke python with sudo, the system python is invoked, so you must specify the python you want to run yourself.
96+
$ sudo nonmouse
10397
```
10498

10599
## 3. Settings
@@ -163,13 +157,15 @@ Run the following scripts for each OS.
163157
...
164158
Location: c:\users\namik\appdata\local\programs\python\python37\lib\site_packages
165159
...
166-
#Copy and paste into the datas in app-win.spec
160+
#Copy and paste into the datas in win.spec
167161
$ pyinstaller config/win.spec
168162
... ````
169163
- mac
170164

171165
Create a venv environment and perform `pip install`, because the directory specified in `datas` is for an assumed venv environment.
172166
```sh
167+
$ git clone https://github.com/takeyamayuki/NonMouse.git
168+
$ cd NonMouse
173169
$ python3 -m venv venv
174170
$ . venv/bin/activate
175171
(venv)$ pip install -r requirements.txt

config/mac.spec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
block_cipher = None
55

66

7-
a = Analysis(['app.py'],
7+
a = Analysis(['../nonmouse/__main__.py'],
88
pathex=['/Users/yukitakeyama/Documents/Python/NonMouse2g'], # 各々の環境に合わせてPATHを変更してください
9-
binaries=[('/System/Library/Frameworks/Tcl.framework/Versions/8.5/tclsh8.5', 'tcl')],
10-
datas=[('venv/lib/python3.9/site-packages/mediapipe/modules', 'mediapipe/modules'),],
11-
hiddenimports=['pynput', 'pywinauto', 'tkinter', 'tkinter.filedialog prog', 'pkg_resources.py2_warn', 'pkg_resources.markers'],
9+
binaries=[],
10+
datas=[('../venv/lib/python3.9/site-packages/mediapipe/modules', 'mediapipe/modules'),],
11+
# hiddenimports=['pynput', 'pywinauto', 'tkinter', 'tkinter.filedialog prog', 'pkg_resources.py2_warn', 'pkg_resources.markers'],
1212
hookspath=[],
1313
hooksconfig={},
1414
runtime_hooks=[],
@@ -37,4 +37,4 @@ exe = EXE(pyz,
3737
disable_windowed_traceback=False,
3838
target_arch=None,
3939
codesign_identity=None,
40-
entitlements_file=None , icon='icon.ico')
40+
entitlements_file=None , icon='../images/icon.ico')

config/win.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
block_cipher = None
55

66

7-
a = Analysis(['app.py'],
7+
a = Analysis(['..\\nonmouse\\__main__.py'],
88
pathex=['C:\\Users\\namik\\Documents\\NonMouse\\NonMouse'], #それぞれの環境に応じて、変更してください
99
binaries=[],
1010
datas=[('C:\\users\\namik\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\mediapipe\\modules', 'mediapipe\\modules'),],
@@ -37,4 +37,4 @@ exe = EXE(pyz,
3737
disable_windowed_traceback=False,
3838
target_arch=None,
3939
codesign_identity=None,
40-
entitlements_file=None , icon='icon.ico')
40+
entitlements_file=None , icon='..\\images\\icon.ico')
File renamed without changes.

nonmouse/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3+
from nonmouse import *
4+
import os, glob
5+
6+
__copyright__ = 'Copyright (C) 2023 Yuki TAKEYAMA'
7+
__version__ = '2.7.0'
8+
__license__ = 'Apache-2.0'
9+
__author__ = 'Yuki TAKEYAMA'
10+
__author_email__ = '[email protected]'
11+
__url__ = 'http://github.com/takeyamayuki/NonMouse'
12+
13+
__all__ = [
14+
os.path.split(os.path.splitext(file)[0])[1]
15+
for file in glob.glob(os.path.join(os.path.dirname(__file__), '[a-zA-Z0-9]*.py'))
16+
]

nonmouse/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
elif pf == 'Darwin':
2727
hotkey = 'Command'
2828
elif pf == 'Linux':
29-
hotkey = '' # hotkeyはLinuxでは無効
29+
hotkey = 'XXX' # hotkeyはLinuxでは無効
3030

3131

3232
def main():

setup.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from setuptools import setup, find_packages
2+
3+
def _requires_from_file(filename):
4+
return open(filename).read().splitlines()
5+
6+
7+
setup(
8+
name='nonmouse',
9+
version='2.7.0',
10+
packages=find_packages(),
11+
description='a webcam-based virtual gesture mouse that is easy to use with hands on the desk',
12+
author='Yuki TAKEYAMA',
13+
author_email='[email protected]',
14+
url='https://github.com/takeyamayuki/NonMouse',
15+
license='Apache-2.0',
16+
install_requires=_requires_from_file('requirements.txt'),
17+
entry_points={'console_scripts': ['nonmouse=nonmouse.__main__:main',]},
18+
python_requires='>=3.6',
19+
)

0 commit comments

Comments
 (0)