Skip to main content

Create, version and upload library

Project description

libtool

libtool is a Python library for creating a Python library, and also manages versions and uploading to PyPi with twine

libtool runs in Python 3+ and only in Windows.

Instructions

You need to make a use_file.ini like this(see more options below):

[info]
# example with if...main that uses all imports from your library
test_file:test.py
# can also be test_file=your_test_file.py
author:test author
email=test.author@mail.com
description = description of the library
url=http://test.author.com
#dependencies
install_requires=mhyt,mhmovie
license:mit

and your test.py (Same as test_file above) like this:

from my_test_library.file1 import plus
from my_test_library.file2 import minus
#
if __name__ == "__main__":
    plus(2,2)#4
    # ##############
    minus(11,1)#10

To create library from ini:

libtool c {your ini file}
#or
libtool create {your ini file}

And the libtool creates the following files automatically:

  • setup.py
  • __ init __.py
  • License.txt
  • README.md

and the libtool will ask you if you want to edit readme.

To change version number(run version from the folder with setup.py):

libtool v

and the libtool ask "enter new version:".

To upload (Run upload from the folder with setup.py):

libtool upload
#or
libtool u
#you can add twine options e.g.
libtool u -r testpypi

Twine options here

Access from python

To access the libtool from a python file:

from libtool._cmd_argv import cmd
cmd.parse(["c", "use_file.ini"])
# or 
cmd.parse( ["u", "-r testpypi"])
#and all commands

Prerequisites

libtool depends on the python modules:

Markdown-Editor, requests, setuptools, wheel and twine

Installing

To install with pip- type in terminal:

(sudo) pip install libtool

if this doesn't work try:

pip install --upgrade setuptools wheel

if there is still an error please open an issue in github issues.

Additional options

To show help message:

libtool ?
#or
libtool help

Additional options for ini file (also in "info" section):

#foldername with your library in it, then not all imports need
#to be in file
folder=foldername 
#can also be folder:foldername
#the version of the library
start_version:1.0.0
#cmd scripts or other files that you want in path, like in setuptools scripts.
#separate scripts with commas.
scripts:script1.cmd,script2.exe

Additional options for create library command:

# to disable open editor to edit readme.md:
libtool c {your ini file} -e edit
# to disable create readme.md:
libtool c {your ini file} -e readme 
# to disable create setup.py:
libtool c {your ini file} -e setup
# to disable create __init__.py:
libtool c {your ini file} -e init
# to disable create licence.txt:
libtool c {your ini file} -e licence
# you can merge options
libtool c use_file.ini -e edit readme setup init licence

View examples here

Custom options

You can also set custom options using Python. To create a library:

from libtool.libtool_class import Library

l = Library(
    test_file="test.py",
    email="your.email@your_mail.com",
    description="only for test",
    url = "http://your.url.com",
    pylicense="mit",
    author="author",
    install_requires=["mhyt","mhmovie"],
    #and the additional options:
    folder="foldername",
    start_version="2.7.3",
    scripts=["script1.bat",]
)
#to create __init__.py
l.c_init()
#to create licence.txt
l.c_licence()
#to create setup.py
l.c_setup()
#to create readme.md
l.c_md()
#to edit readme.md
l.edit_md()

To change version:

from libtool.up_version import UpVersion

UpVersion("my-sample-library")

To publish to PyPi:

from libtool.pypi.up_pypi import up
up("my-sample-library")
#you can add twine options e.g.
up("my-sample-library","-r testpypi")

Built With

Author

matan h

License

This project is licensed under the MIT License.

Created by

This library was created using libtool

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libtool-0.1.3.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

libtool-0.1.3-py3-none-any.whl (12.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page