Skip to content

Commit

Permalink
adding the packaging code,
Browse files Browse the repository at this point in the history
  • Loading branch information
KarelVesely84 committed Feb 12, 2019
1 parent b02b09c commit 12d7487
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 16 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ with kaldi_io.open_or_fd(ark_scp_output,'wb') as f:


#### Install
- run `git clone https://github.com/vesis84/kaldi-io-for-python.git <kaldi-io-dir>`
- add `PYTHONPATH=${PYTHONPATH}:<kaldi-io-dir>` to `$HOME/.bashrc`
- now the `import kaldi_io` will work from any location
- or simply use `python setup.py install` (default python), alternatively `python{2|3} setup.py install`,
- from pypi: `python -m pip --user install kaldi_io`
- from sources:
- `git clone https://github.com/vesis84/kaldi-io-for-python.git <kaldi-io-dir>`
- `python setup.py install` (default python)
- for local development use: `PYTHONPATH=${PYTHONPATH}:<kaldi-io-dir>` in `$HOME/.bashrc`

Note it is recommended to set KALDI_ROOT in your `$HOME/.bashrc` as
`export KALDI_ROOT=<some_kaldi_dir>`, so you can read/write using
pipes with kaldi binaries.


#### License
Expand Down
42 changes: 42 additions & 0 deletions make_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

exit 0

# Step 1: udpate version in 'setup.py'

# Step 2: make packages,
# python3 -m pip install --user --upgrade setuptools wheel twine
rm dist/*
python2 setup.py bdist_wheel
python3 setup.py sdist bdist_wheel
#$ ls dist/
# kaldi_io-vesis84-0.9.0.tar.gz
# kaldi_io_vesis84-0.9.0-py2-none-any.whl
# kaldi_io_vesis84-0.9.0-py3-none-any.whl

# Hint: skip to 'Step 8' to skip sandboxing on 'test.pypi.org'

{ # TEST_DEPLOYMENT_ON test.pypi.org,
# Step 3: upload the packages (test site),
python3 -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*

# Step 4: see webpage,
# https://test.pypi.org/project/kaldi_io_vesis84

# Step 5: try installing it locally,
python3 -m pip install --user --index-url https://test.pypi.org/simple/ kaldi_io_vesis84

# Stepy 6: try to install it,
python3
<import kaldi_io
<print(kaldi_io)

# Step 7: remove the package,
python3 -m pip uninstall kaldi_io_vesis84
}

# Step 8: Put the packages to 'production' pypi,
python3 -m twine upload --verbose dist/*
python3 -m pip install --user kaldi_io
python3 -m pip uninstall kaldi_io

38 changes: 26 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright 2019 Oplatai.com (author: Ondrej Platek)
# Copyright 2019 Brno University of Technology (author: Karel Vesely)

# Licensed under the Apache License, Version 2.0 (the "License")

from setuptools import setup, find_packages
setup(name='kaldi_io',
version='0.0.1',
description='Glue code connecting Kaldi data and Python.',
author='Karel Vesely',
packages=find_packages(),
url='https://github.com/vesis84/kaldi-io-for-python',
install_requires=[
'numpy>=1.15.3',
]
)
import setuptools

with open("README.md","r") as fh:
long_description = fh.read()

setuptools.setup(
name='kaldi_io',
version='0.9.0',
author='Karel Vesely',
description='Glue code connecting Kaldi data and Python.',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/vesis84/kaldi-io-for-python',
install_requires=[ 'numpy>=1.15.3', ],
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 2",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Topic :: Multimedia :: Sound/Audio :: Speech",
],
)

0 comments on commit 12d7487

Please sign in to comment.