Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

bitbucket-distutils

Intro

Distribute/setuptools/distutils command for Bitbucket. You can use Bitbucket downloads instead of PyPI downloads for release.

To use this, follow the instruction.

Instruction

First of all your software must be packaged within the standard distribution way: use distutils, Distribute or setuptools. This package contains an extension command for that.

Then, add this package into setup_requires parameter of your setup() configuration (of setup.py script):

setup(name='YourPackageName',
      version='1.2.3',
      ...,
      setup_requires=['bitbucket-distutils >= 0.1.2'])

Now there will be the overwritten upload command for your setup.py:

$ python setup.py upload --help
Common commands: (see '--help-commands' for more)

...

Options for 'upload' command:
  --bb-repository (-R)  Bitbucket repository name e.g. user/reponame
  --bb-username (-u)    Bitbucket username
  --bb-password (-p)    Bitbucket password

...

As you can see there are --bb--prefixed options for the command. If -u/--bb-username and --p/--bb-password are not present, it shows the prompt. -R/--bb-repository is required.

Upload

Upload is very easy:

$ python setup.py sdist upload -R user/reponame register

By explained:

sdist
Makes the source distribution file. If your package name is YourPackageName and its version is 1.2.3, and then its file name becomes YourPackageName-1.2.3.tar.gz.
upload -R user/reponame
Uploads the built source distribution file into your Bitbucket repository. It does not mean that it will be version-controlled, but it will be simply uploaded to its downloads page.
register
Using the Bitbucket download URL registers the package of this version into PyPI. The URL of PyPI page will be http://pypi.python.org/YourPackageName/1.2.3

Defaulting options

You can make default values for these options by specifying in the setup.cfg configuration file. For example, if you want to default --bb-repository, make setup.cfg file like (hyphens becomes underscores):

[upload]
bb_repository = user/reponame

You can make a shorthand alias as well:

[aliases]
release = sdist upload register

Author and license

It is distributed under Public Domain. Just do what you want to do with this. Written by Hong Minhee.

You can checkout the source code from its Bitbucket Mercurial repository:

$ hg clone https://bitbucket.org/dahlia/bitbucket-distutils

If you found a bug, please report it to the issue tracker.

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.