@@ -469,3 +469,56 @@ The code to embed badges can be found on travis and coveralls.
469
469
After the CI runs successfully, the badges will be updated.
470
470
471
471
Checkout the repo at this stage using the [ ` 08-ci ` ] ( https://github.com/MichaelKim0407/tutorial-pip-package/tree/08-ci ) tag.
472
+
473
+ ## Step 9: Releasing on pypi!
474
+
475
+ At this point, your library can already be shared with the world,
476
+ however it is not on pypi yet.
477
+
478
+ To release on pypi, there are a few things we need to take care of.
479
+
480
+ First, add some classifiers for your package in ` setup() ` .
481
+ A full list of classifiers can be found [ here] ( https://pypi.org/pypi?%3Aaction=list_classifiers ) .
482
+
483
+ Next, change ` __version__ ` to a standard version string, such as ` 1.0 ` .
484
+
485
+ Next, change the name of your package, if you followed the tutorial thus far,
486
+ since ` my_pip_package ` would be taken by me.
487
+ Be creative!
488
+ The ` name ` argument in ` setup() ` does not need to match the name of the python package,
489
+ but it's better to keep them the same so that anyone that installs your library won't be confused.
490
+
491
+ You may also want to add a ` description ` in ` setup() ` .
492
+
493
+ Once everything is good, we can package the library:
494
+
495
+ ``` bash
496
+ $ python setup.py sdist
497
+ ```
498
+
499
+ If should create a ` .tar.gz ` file under ` dist/ ` .
500
+ You can unzip the file to inspect its contents.
501
+
502
+ Also, don't forget to add ` dist/ ` to ` .gitignore ` .
503
+
504
+ The file is now ready to be uploaded to ` pypi ` .
505
+ Create an account on ` pypi ` , and store the credentials in ` ~/.pypirc ` :
506
+
507
+ ```
508
+ [pypi]
509
+ username =
510
+ password =
511
+ ```
512
+
513
+ Finally, to upload the file:
514
+
515
+ ``` bash
516
+ $ twine upload dist/{packaged file}.tar.gz
517
+ ```
518
+
519
+ Your package should now show up on ` pypi ` and installable using ` pip install ` .
520
+
521
+ It would also be a good idea to create a release on GitHub,
522
+ and drop the packaged file as an attachment.
523
+
524
+ Checkout the repo at this stage using the [ ` 09-release ` ] ( https://github.com/MichaelKim0407/tutorial-pip-package/tree/09-release ) tag.
0 commit comments