Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 1.84 KB

File metadata and controls

64 lines (45 loc) · 1.84 KB

Description

Python semi-automatic package building script

How to

A minimal setup.py

setup(
    name='MyPackageName',
    version='1.0.0',
    description='Description of my package',

    py_modules=["mymodule"] # Single modules project,
    package_dir={"":"src"} # Telling setuptools our code is in ./src directory
)

Cloning project from a repo

  1. Edit the ./templates/setup.py with your data and Add your LICENSE if you want to:

  2. Run the script like ./build my_remote_git_repo

    • It will clone it and create your package at ./cloned_package/dist/

Now your project is ready to be deployed or used anywhere else you need to :)

Useful files - For more accurate behaviour

templates
    MANIFEST.in
    setup.py
    README.md
    ...
  1. [OPTIONAL] Edit the MANIFEST.in with the includes,excludes you need.
  • If you happen to use MANIFEST.in you better add it in the line 56 from the build script to enable the copy of this file for packaging.

Example of MANIFEST.in

include src/my_package/main.py
include src/my_package/requirements.txt
recursive-include src/my_package/libs *
recursive-exclude src/my_package/tests *
recursive-exclude .DS_Store *
  1. [OPTIONAL] pyproject.toml for telling which backend build system we're using.

Future updates - TODOs

  • Creatre a windows-like script (or make it different)
  • Make the process of setup.py automatic (cli for example)
  • Automatic fetching a LICENSE or creating it
    • Download/scrape from opensource.org
    • Have some templates and make the subtitution using a cli