Skip to content

Commit bf59f7a

Browse files
author
webdev778
committed
PyPi packaging
1 parent 649b025 commit bf59f7a

File tree

5 files changed

+66
-3
lines changed

5 files changed

+66
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
src/interscript/maps/*.py
22
__pycache__
3+
build/
4+
dist/
5+
*.egg-info

README.adoc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,38 @@ interscript.load_map('bgnpcgn-ukr-Cyrl-Latn-2019')
3535
print(interscript.transliterate('bgnpcgn-ukr-Cyrl-Latn-2019', input()))
3636
-----
3737

38+
== Development
39+
40+
Ensure you have used a bootstrap repository https://github.com/interscript/interscript
41+
and not just cloned this repo yourself, otherwise `./setup.sh` script won\'t work.
42+
43+
`./setup.sh` script is used to build the maps from the `maps` repository using our Ruby
44+
Interscript implementation. Those maps are compiled to respective `.py` files inside
45+
`src/interscript/maps/` directory and are not included in this repository.
46+
47+
=== Running tests
48+
49+
[source,shell]
50+
---
51+
$ ./setup.sh
52+
$ pip install -e .
53+
$ pytest
54+
---
55+
56+
=== Building package
57+
58+
[source,shell]
59+
---
60+
$ ./setup.sh
61+
$ python -m build
62+
---
63+
64+
=== Publishing package
65+
66+
[source,shell]
67+
---
68+
$ twine publish file.whl
69+
---
3870

3971
== Copyright and license
4072

build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
rm -rf src/interscript/maps
4+
mkdir -p src/interscript/maps
5+
pushd ../ruby
6+
bundle install || exit 1
7+
bundle exec rake compile[python,../python/src/interscript/maps] || exit 1
8+
popd

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = [
55
{ name="Ribose Inc.", email="open.source@ribose.com" },
66
]
77
description = "Interoperable script conversion systems"
8-
readme = "README.adoc"
8+
readme = {file = "README.adoc", content-type = "text/plain"}
99
requires-python = ">=3.8"
1010
classifiers = [
1111
"Programming Language :: Python :: 3",
@@ -23,5 +23,5 @@ Homepage = "https://www.interscript.org"
2323
Issues = "https://github.com/interscript/interscript-python/issues"
2424

2525
[build-system]
26-
requires = ["hatchling"]
27-
build-backend = "hatchling.build"
26+
requires = ["setuptools", "wheel", "regex"]
27+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from setuptools import setup, find_packages
2+
from setuptools.command.build_py import build_py as _build_py
3+
import os
4+
5+
class CustomBuildCommand(_build_py):
6+
"""Ensure the maps are built"""
7+
8+
def run(self):
9+
if not os.path.exists("src/interscript/maps"):
10+
print("Maps have not been built. Please issue ./build.sh before trying to build a package.")
11+
exit(1)
12+
13+
# Call the superclass method to perform the standard build
14+
super().run()
15+
16+
setup(
17+
cmdclass={
18+
'build_py': CustomBuildCommand,
19+
},
20+
)

0 commit comments

Comments
 (0)