Publishing Guide¶
This guide explains how to package your toolkit as a library and publish it to the Python Package Index (PyPI), making it installable via pip install salesforce-toolkit.
1. Prerequisites¶
You need a generic "build" environment. Since we added build and twine to setup.py, you can install them:
On your machine (or Docker):
2. Configuration (setup.py)¶
I have already updated your setup.py with your information:
- Name: salesforce-toolkit
- Version: 1.0.0
- Author: Antonio Trento
- URL: https://github.com/antonio-backend-projects/salesforce-toolkit
Note: If the name
salesforce-toolkitis already taken on PyPI (which is likely), you will need to change thenameargument insetup.pyto something unique, likeantonio-salesforce-toolkitorsf-toolkit-pro.
3. Build the Package¶
Run this command to generate the distribution files (.tar.gz and .whl) in the dist/ folder:
You should see:
4. Test Publishing (TestPyPI)¶
It is highly recommended to upload to TestPyPI first to check if everything looks right.
- Register: Go to test.pypi.org and create an account.
- Create Token: Go to Account Settings → API Tokens → Create a new token (Scope: Entire account). Copy it.
- Upload:
-
Enter Credentials:
- Username:
__token__ - Password:
<your-api-token>
- Username:
-
Verify: Try installing it in a new virtual environment:
5. Publish to Production (PyPI)¶
Once verified:
- Register: Go to pypi.org and create an account.
- Create Token: Account Settings → API Tokens.
- Upload:
- Success! Your package is now live. Anyone can run:
6. Alternative: Install from GitHub¶
If you don't want to publish to PyPI publicly, users can install directly from your GitHub repository:
This is great for private testing or internal tools.