Skip to content

Commit ebf702a

Browse files
committed
refactoring: project directory structure changed, added setup.py file for packaging
1 parent 0f99c32 commit ebf702a

File tree

7 files changed

+56
-14
lines changed

7 files changed

+56
-14
lines changed

changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## Unreleased
8+
## 0.1.0 — 2025-02-15
99
### Added
1010

1111
- [x] added `changelog`, `license` files
1212

13+
### Changed
14+
15+
- [x] refactoring: project directory structure changed, added `setup.py` file for packaging
16+
1317
## Unversioned — 2015-11-17
1418

1519
Initial release

readme.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,33 @@ or [Russian](https://ru.wikipedia.org/wiki/Ёфикатор).
1414

1515
## Usage
1616

17-
Depends on yoficator.dic, which is used for the lookup and should remain in the same folder.
18-
19-
`yoficator.py [text-file-in-Russian | string-in-Russian]`
17+
1. Build wheel:
18+
```sh
19+
python setup.py bdist_wheel -d '/tmp'
20+
```
21+
2. Install wheel:
22+
```sh
23+
pip install yoficator-0.1.0-py2-none-any.whl
24+
```
25+
3. Use:
26+
```sh
27+
python -m yoficator # [text-file-in-Russian | string-in-Russian]
28+
```
2029

2130
## Examples
2231

2332
Running the command without arguments parses the test file:
2433

25-
`yoficator.py`
34+
```sh
35+
python -m yoficator
36+
```
2637

2738
Or just use it with a file or string:
2839

2940
```sh
30-
yoficator.py russianfile.txt # prints to STDOUT
31-
yoficator.py russianfile.txt > russianfile-yoficated.txt
32-
yoficator.py "Где ее книга?"
41+
python -m yoficator russianfile.txt # prints to STDOUT
42+
python -m yoficator russianfile.txt > russianfile-yoficated.txt
43+
python -m yoficator "Где ее книга?"
3344
```
3445

3546
## Limitations

setup.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- coding: utf-8 -*-
2+
import setuptools
3+
4+
5+
with open('readme.md') as fh:
6+
long_description = fh.read()
7+
8+
setuptools.setup(
9+
name='yoficator',
10+
version='0.1.0',
11+
description='A Russian text yoficator (ёфикатор)',
12+
long_description=long_description,
13+
long_description_content_type='text/markdown',
14+
license='License :: OSI Approved :: MIT License',
15+
packages=['yoficator'],
16+
package_data={
17+
'yoficator': [
18+
'_data/yoficator.dic',
19+
'_data/yoficator.txt',
20+
],
21+
},
22+
install_requires=['regex==2015.11.09'],
23+
include_package_data=True,
24+
classifiers=[
25+
'Programming Language :: Python :: 3',
26+
'License :: OSI Approved :: MIT License',
27+
'Operating System :: OS Independent',
28+
],
29+
python_requires='>=2.7, <3',
30+
)

yoficator/__init__.py

Whitespace-only changes.

yoficator.py renamed to yoficator/__main__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,9 @@
6868

6969
pp = pprint.PrettyPrinter(4)
7070

71-
# Variables initialization; tests a file if no argument is supplied.
72-
# Save the yoficator as a subfolder of your Desktop
73-
# TODO: Make it compatible with other OSs.
74-
workingDir = os.getenv('HOME') + "/Desktop/yoficator/"
75-
textFile = workingDir + "tests/yoficator.txt"
76-
dictionaryFile = workingDir + "yoficator.dic"
71+
workingDir = os.path.abspath(os.path.dirname(__file__)) + '/_data'
72+
textFile = workingDir + "/yoficator.txt"
73+
dictionaryFile = workingDir + "/yoficator.dic"
7774

7875
if len(sys.argv) > 1:
7976
# Is the input a filename?
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)