Skip to main content

Pypackage looks to package python without writing a setup.py

Project description

Pypackage

View this on GitHub Pages

Build Status Coverage Status Version Download format Downloads this month Development Status License

Pypackage is a collection of python packaging applications including:

py-build
py-develop
py-info
py-install
py-setup
py-test

The main goal of Pypackage is to make python packaging easier and faster.

Wouldn’t it be nice if you could just write some python, run a command, and have a distributable package? Well now you can!

Features

  • automatic python modules and packages detection

  • automatic inclusion of non-python package data files, and their inclusion in and writing of the MANIFEST.in

  • support for three different testing frameworks (pytest, nose, and unittest) for use with setup.py test

  • automatic script detection (any executable file in ./bin or ./scripts)

  • automatic version, author, maintainer and email(s) detection (perfers __init__.py, __version__.py)

  • curses front-end to python classifiers selection

  • easy display of installed python package metadata with py-info <package>

Example, “Hello World” application:

$ mkdir hello_world
$ cd hello_world
$ vim hello_world.py   # write your python here... :)
$ py-build -is

The py-build -is command will take you through an interactive py-build session and save the setup.py to disk after creating it, but will not run it.

You can also use the py-setup command at any time to print what Pypackage would use as a setup.py in the current directory’s context.

Metadata can be mixed in with site-wide defaults from $HOME/.pypackage if you want to fill in some common attributes for all your projects.

Pypackage also provides three different test runners to automatically find and run your tests with python setup.py test, you can use any of pytest, nose or unittest.

To be clear though: pypackage does not intend on replacing setuptools, pip, or really anything at all in the python packaging tool-chain, it only attempts to complement those utilities and make getting started with python packaging a little easier.

In my utopian perfect dream world, I’d see projects not having a setup.py under source control, instead only a static metadata file, then having the inverse relationship being true in the distribution version of the package.

Example, write Python and send it to PyPI

First, configure your ~/.pypirc file with a [pypi] section if you haven’t already. Now, assuming you lay out your project something like:

./your_project
./your_project/README.md
./your_project/pypackage.meta
./your_project/...
./your_project/your_project/__init__.py
./your_project/your_project/your_code.py
./your_project/your_project/...

With pypackage installed, from ./your_project run the following commands to send your project to PyPI for the first time:

$ py-build
$ py-build -s
$ python setup.py register
$ twine upload dist/* || pip install twine && twine upload dist/*

Every time after that, to update your package is a two step process:

$ py-build
$ twine upload dist/*

This will upload a binary wheel and source distribution to PyPI so you can share your work with the world.

The source distribution will include a setup.py and will not include the pypackage.meta if you use one. In this way, Pypackage does not create a build dependency on your distribution, but rather only on your source, or perhaps more specifically, your build chain and/or development environment. Unless you choose to develop off of the distributed source version, then carry on doing your thing. Just don’t submit any patches to the setup.py because it’s not a real thing in the source. As a project maintainer, you may even consider adding setup.py to the .gitignore of your pypackaged projects.

Further examples

If your OS can run a bash script, execute demo.sh in the top level of this repo to create a new pypackage venv and some simple example packages in an example directory. From there feel free to play around and experiment with pypackage features and applications.

Screenshots

The following screenshots were all taken with the detected_pkg package, which is created by the demo.sh script described in the further examples section above.

Curses top level classifiers selection screen:

top level classifiers

Curses development status screen with Beta selected:

development status classifiers

Interactive build process which used the above in it’s classifiers selection:

`py-build -si` interactive build session

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

pypackage-0.1.8.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

pypackage-0.1.8-py2.py3-none-any.whl (36.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pypackage-0.1.8.tar.gz.

File metadata

  • Download URL: pypackage-0.1.8.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pypackage-0.1.8.tar.gz
Algorithm Hash digest
SHA256 ec34055c6a3015c97f93f69e6135733fa412439941e18e5ee6feda935685ac63
MD5 0af09222df0080fe1c68d0fe98a4dfdd
BLAKE2b-256 147bf41080ef1076ed7beb728a5fd08c03e2108794e257cbdfaa8d7610e108e5

See more details on using hashes here.

File details

Details for the file pypackage-0.1.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pypackage-0.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 97ad34694dc24857f9823d673c0e4cff6233d311823432548c1996f43663bb06
MD5 91ab3102c2eb52de2476913a541ae833
BLAKE2b-256 06a9ea9957191836d3a74c2fced16197731afd65bc7b82367f41f0376e07adfa

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