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-1.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

libtool-1.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file libtool-1.1.0.tar.gz.

File metadata

  • Download URL: libtool-1.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for libtool-1.1.0.tar.gz
Algorithm Hash digest
SHA256 eedc80a7e94222dec445174ad620bcf0294b15cb47f505ad9014a5b56a3b30c6
MD5 6080cab10ec03a62c08934314b26bdb0
BLAKE2b-256 ccbf97b97d5b5f50c10c289d097ff4c68d72d9c10346a16328f97a150a690846

See more details on using hashes here.

File details

Details for the file libtool-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: libtool-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for libtool-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1953d86db6a81b165b85f2ee18c430f37af3e623396470e8f1365fe3d0559365
MD5 e0aab90dad957d8007970e654b4b3db3
BLAKE2b-256 bf0535407634ae084bec879ee7541137748aeda91a3ed504a1a94d8ed00f49be

See more details on using hashes here.

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