Skip to main content

๐Ÿ A quick and easy way to distribute your Python projects!

Project description

sailboat

Publish system files for Sailboat.

A quick and easy way to distribute your python projects!

sailboat will let you go from hello world to a published app in about 5 minutes! It generates a setup.py and correct directory structure for you in seconds, all with a simple config file.

In addition to this, it can build your Mac and Windows apps in the cloud using GitHub actions, so you don't need to have both a Mac and Windows computer to create apps. To use this feature, activate it with the wizard.

Please see the quickstart for an example.

Installation

Install with Pip: pip3 install sailboat Download Binary: Download from latest release. Homebrew: brew install cole-wilson/taps/Sailboat

Usage:

Note: sailboat can be substituted for sail at any time.

It is suggested that you run sailboat wizard to get started.

sailboat wizard

This command runs a setup wizard that generates a sailboat.toml file in your current directory. It will also help you set up GitHub actions and creat a git repo.

sailboat dev

This command lets you test your project on your own system without needing to install it every time.

(running sailboat build also does this)

sailboat git

Setup git and GitHub.

sailboat [--options] build <version>

This command is where everything happens! There are several things that build does with the given version:

  1. First, it will build a directory structure that looks something like this.
.
โ”œโ”€โ”€ .github
โ”‚   โ””โ”€โ”€ workflows
โ”‚       โ””โ”€โ”€ sailboat.yml
โ”œโ”€โ”€ bin
โ”‚   โ””โ”€โ”€ <compiled .sh files for your project>
โ”œโ”€โ”€ build
โ”‚   โ””โ”€โ”€ <location where build data is generated>
โ”œโ”€โ”€ dist
โ”‚   โ””โ”€โ”€ <compiled files ready for distribution>
โ”œโ”€โ”€ <project name>
โ”‚   โ”œโ”€โ”€ # This is where your source code goes:
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ __main__.py
โ”‚   โ”œโ”€โ”€ mod1.py
โ”‚   โ”œโ”€โ”€ mod2.py
โ”‚   โ”œโ”€โ”€ data.txt
โ”‚   โ””โ”€โ”€ etc...
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ setup.py
โ””โ”€โ”€ sailboat.toml
  1. Generate GitHub Actions workflow files
  2. Generate .app, .dmg, .exe, .msi files (depending on your configuration and system)
  3. Generate files used for PyPi distribution.

Options:

Some valid commandline options are:

  • -y: No interaction, always accept changes. (BUILD MODE)

  • --actions-only: Only generate actions file. (BUILD MODE)

  • --mac-only: Only generate mac file. (BUILD MODE)

  • --windows-only: Only generate windows file. (BUILD MODE)

  • --pypi-only: Only generate pypi files. (BUILD MODE)

  • --setup-only: Only generate setup.py. (BUILD MODE)

  • --no-installer: Overide installer config. (BUILD MODE)

  • -f: Use .release-notes-latest file for release notes. (RELEASE MODE)

These options can be combined

sailboat release [pypi | github]

This will upload your built project to PyPi and GitHub. (or just one of them, depending on the command options)

Configuration

There are several options in the configuration that are not mentioned in the wizard. This section explains what they do:

build.build_script:

This option can provide a file name for custom pre and post build scripts for custom actions. An example value would be build.py. Inside build.py you need one or two functions called pre and post. Each one of these must have two positional arguments: version and data. version is a string of the version triggering the build, and data is a dict containing the decoded sailboat.toml data. If data is returned at the end of the function, it is used instead of the normal value, and is saved at the end of the build. An example file might look like this:

def pre(version,data):
	print("Building version {}".format(version))
def post(version,data):
	data['test'] = version
	return data

This file would run pre() at the beginning, and post() at the end. data['test'] will be saved in sailboat.toml.

build.bundle_id:

The OSX Bundle Identifier used in PyInstaller. Defaults to com.<author>.<short_name>.

build.actions_built_latest:

Whether or not the GitHub actions file was changed at the last build, updates automatically.

latest_build:

The latest built version.

resources.no_import:

Modules found in *.py files that do NOT need to be required.

git.github:

The upstream URL for sailboat git and sailboat release.

setup_data:

This is a dictionary for custom setup.py values. For example:

[setup_data]
test = "test_value"

add the key test to setup.py with the value "test_value";

Quickstart

Let's say that we have a file helloworld.py:

name = input("What's your name? ")
print(f"Hello {name}!")

That's all fine and good, but how will we distribute our awesome app so that all ou relatives and friends can run it?

Whenever you have this problem, there are normally two solutions:

  • Get everyone to install Python, and then distribute copies of your source code.

  • Go through the trouble of packaging and distributing your project as a native application.

Both of these are less than ideal, but with sailboat there is a third option:

  • Use sailboat to distribute your project to PyPi, and also generate native applications and installers in about 5 minutes!

    • To do this we will need to install sailboat: pip3 install sailboat

    • Next, we will have to generate a sailboat.toml file by running sailboat wizard.

    • After we have done this, just type sailboat build 0.0.1 and wait for the build process to finish.

    • Next, we have to get a PyPi account. Go to https://pypi.org/account/register/ to register.

    • After that, just type in sailboat release to finish!

    • Now, you can install your app by typing pip3 install <your-app-name> and run it with <your-app-name> if you have Python, or by launching the packaged app in the ./dist/pyinstaller/ folder.

Acknowledgements:

Thanks to all the people at PyInstaller, dmgbuild, Wix.Py, twine, and GitHub actions who provided ways for me to create this.

Contributors

  • Cole Wilson

Contact

cole@colewilson.xyz

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

sailboat-0.10.3rc1.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sailboat-0.10.3rc1-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file sailboat-0.10.3rc1.tar.gz.

File metadata

  • Download URL: sailboat-0.10.3rc1.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7

File hashes

Hashes for sailboat-0.10.3rc1.tar.gz
Algorithm Hash digest
SHA256 cd0b30466ed78f9cf902ebeff1e66ace7b9cd768c8a04387109d97f665b74eba
MD5 52366dbb6d829376f3b7b347999ae912
BLAKE2b-256 e21d7620f3c4f2eb7b760e8f5b6e4a2c9715f4ce47e7ca26a0c8fb03cc9d9878

See more details on using hashes here.

File details

Details for the file sailboat-0.10.3rc1-py3-none-any.whl.

File metadata

  • Download URL: sailboat-0.10.3rc1-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7

File hashes

Hashes for sailboat-0.10.3rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 7aebbd5f504552f3f5a0b940f335aae6d81fb955561487ccd0d7653cf03b8ef6
MD5 0342107780234671e2151deb1a5fe4e3
BLAKE2b-256 d34ea240bfb7736937dbad8a48447d4931bfef3542c6c2b0febbec4531d1a5b3

See more details on using hashes here.

Supported by

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