# Clone the repository
git clone https://github.com/yourusername/monocore.git
cd monocore/sdk/python
# Install dependencies using uv
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install the package in development mode
uv pip install -e ".[dev]"To build your package with uv:
uv buildThis will create distribution files in the dist/ directory:
- A wheel file (
.whl) - Built distribution - A source distribution (
.tar.gz)
- For TestPyPI: Create an account on TestPyPI and generate an API token in your account settings.
- For PyPI: Create an account on PyPI and generate an API token in your account settings.
Save these tokens securely as you'll only see them once.
# Build the distribution
uv build
# Upload to TestPyPI
uv publish --token $TEST_PYPI_TOKEN --publish-url https://test.pypi.org/legacy/# Create a new environment for testing
uv venv test_env
source test_env/bin/activate # On Windows: test_env\Scripts\activate
# Install from TestPyPI
uv pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ your-package-nameOnce you've verified your package works correctly on TestPyPI:
# Build the distribution (if you haven't already)
uv build
# Upload to PyPI
uv publish --token $PYPI_TOKENFor automated releases, consider setting up a GitHub Actions workflow that publishes your package when you create a new release. For this approach, you'll need to:
- Add your PyPI token as a GitHub repository secret
- Create a workflow file (e.g.,
.github/workflows/publish.yml)
name: Publish Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
- name: Build and publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
uv build
uv publish --token $PYPI_TOKEN