Skip to content

Commit

Permalink
Merge pull request #144 from VishwamAI/kasinadhsarma/publish-package
Browse files Browse the repository at this point in the history
Publish package
  • Loading branch information
kasinadhsarma authored Oct 19, 2024
2 parents cbcf28d + cbc4383 commit 3b78ced
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,17 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/* --skip-existing
update_workflow:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Update workflow
run: |
echo "Updating workflow in GitHub"
# Add any additional steps needed to update the workflow
46 changes: 46 additions & 0 deletions docs/publishing_workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# NeuroFlex Package Publishing Workflow

This document provides a detailed guide on how to publish the NeuroFlex package to PyPI. It includes prerequisites, step-by-step instructions, and troubleshooting tips for common issues.

## Prerequisites

Before publishing the package, ensure you have the following:

1. **PyPI Account**: You need a PyPI account to upload the package. If you don't have one, you can create it [here](https://pypi.org/account/register/).
2. **PyPI API Token**: Generate an API token from your PyPI account. This token will be used for authentication during the publishing process. You can generate a token [here](https://pypi.org/manage/account/#api-tokens).
3. **GitHub Secrets**: Add the PyPI API token to your GitHub repository secrets. This will allow the GitHub Actions workflow to access the token securely. Go to your repository settings, navigate to "Secrets and variables" > "Actions", and add a new secret with the name `PYPI_API_TOKEN`.

## Steps for Publishing

Follow these steps to publish the NeuroFlex package to PyPI:

1. **Update Version**: Ensure the version number in `setup.py` is updated. Increment the version number according to semantic versioning (e.g., from `0.1.3` to `0.1.4`).

2. **Create a Tag**: Create a new tag for the release. This will trigger the GitHub Actions workflow to publish the package.
```bash
git tag v0.1.4
git push origin v0.1.4
```

3. **GitHub Actions Workflow**: The `.github/workflows/ci_cd.yml` file contains the workflow for publishing the package. The `publish` job is triggered on push events to tags. It performs the following steps:
- Checks out the repository
- Sets up Python 3.8
- Installs build tools (`build` and `twine`)
- Verifies the distribution files
- Publishes the package to PyPI using `twine`

4. **Verify the Release**: After the workflow completes, verify that the package is published to PyPI. You can check the package page on PyPI [here](https://pypi.org/project/neuroflex/).

## Troubleshooting

Here are some common issues and their solutions:

1. **Authentication Error**: If you encounter an authentication error during the publishing process, ensure that the PyPI API token is correctly added to the GitHub repository secrets and that it has the necessary permissions.

2. **Version Conflict**: If you receive an error about a version conflict, ensure that the version number in `setup.py` is unique and has not been used in a previous release.

3. **Build Errors**: If there are errors during the build process, check the `setup.py` file for any issues with the package metadata or dependencies. Ensure that all required files are included in the package.

4. **Network Issues**: If the publishing process fails due to network issues, try rerunning the GitHub Actions workflow. You can do this from the "Actions" tab in your GitHub repository.

By following these steps and troubleshooting tips, you should be able to successfully publish the NeuroFlex package to PyPI.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

setup(
name="neuroflex",
version="0.1.4", # Updated version to 0.1.3
version="0.1.4", # Updated version to 0.1.4
author="kasinadhsarma",
author_email="[email protected]",
description="An advanced neural network framework with interpretability, generalization, robustness, and fairness features",
long_description=open("README.md").read(),
long_description=open("README.md").read() + "\n\n## Publishing Instructions\n\nTo publish the package to PyPI, follow these steps:\n\n1. Ensure you have the latest version of `setuptools` and `twine` installed:\n ```bash\n pip install --upgrade setuptools twine\n ```\n\n2. Create the distribution files for the package:\n ```bash\n python setup.py sdist bdist_wheel\n ```\n\n3. Upload the package to PyPI using `twine`:\n ```bash\n twine upload dist/*\n ```\n\n4. Verify the package is published by checking the [PyPI page](https://pypi.org/project/neuroflex/).\n",
long_description_content_type="text/markdown",
url="https://github.com/VishwamAI/neuroflex",
packages=find_packages(include=["NeuroFlex", "NeuroFlex.*"], exclude=["tests*"]),
Expand Down

0 comments on commit 3b78ced

Please sign in to comment.