-
Notifications
You must be signed in to change notification settings - Fork 12
Python Package, Code Refactoring and Documentation #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PayalLakra
wants to merge
25
commits into
upsidedownlabs:main
Choose a base branch
from
PayalLakra:bio_amptool
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
42c5157
Creating chordspy Python Package
PayalLakra 6a2908c
Add chordspy
PayalLakra 4265aae
Updated Readme
PayalLakra d45eb5b
Updated Readme
PayalLakra 32b5523
Create python-publish.yml
PayalLakra 6608a35
Update python-publish.yml
PayalLakra e298113
Final changes before release
PayalLakra 299d169
Update python-publish.yml
PayalLakra 3e1afb0
Remove unnecessary files
PayalLakra cc04e19
Adding release.yml file
PayalLakra 29d3c57
Update the location of workflow
PayalLakra 2e90cdc
Merge branch 'main' of https://github.com/PayalLakra/Chords-Python
PayalLakra 27e4afd
Update actions/upload-artifact
PayalLakra 1797422
Adding command to create .toml file
PayalLakra cb2bc44
pyproject.toml file
PayalLakra f59f748
Updated artifact
PayalLakra 8bc1bd5
updated
PayalLakra 6572dcd
update version just to check
PayalLakra c6beed7
version updated
PayalLakra 75a6d25
Updated pyproject.toml file
PayalLakra 34ba1a8
Fully Documented Code
PayalLakra 187e58b
Fully Documented Code
PayalLakra 35d96ff
Chnages suggested by coderabbit
PayalLakra 58f37ce
Correct code
PayalLakra 2b1049b
Update the path for the image
PayalLakra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+" | ||
- "[0-9]+.[0-9]+.[0-9]+b[0-9]+" | ||
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" | ||
|
||
env: | ||
PACKAGE_NAME: "chordspy" | ||
OWNER: "Upside Down Labs" | ||
|
||
jobs: | ||
details: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
new_version: ${{ steps.release.outputs.new_version }} | ||
suffix: ${{ steps.release.outputs.suffix }} | ||
tag_name: ${{ steps.release.outputs.tag_name }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Extract tag and Details | ||
id: release | ||
run: | | ||
if [ "${{ github.ref_type }}" = "tag" ]; then | ||
TAG_NAME=${GITHUB_REF#refs/tags/} | ||
NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}') | ||
SUFFIX=$(echo $TAG_NAME | grep -oP '[a-z]+[0-9]+' || echo "") | ||
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT" | ||
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT" | ||
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "No tag found" | ||
exit 1 | ||
fi | ||
|
||
check_pypi: | ||
needs: details | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch PyPI version | ||
run: | | ||
response=$(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json || echo "{}") | ||
latest_version=$(echo $response | jq -r '.info.version // "0.0.0"') | ||
echo "latest_version=$latest_version" >> $GITHUB_ENV | ||
|
||
- name: Compare versions | ||
run: | | ||
if [ "$(printf '%s\n' "$latest_version" "${{ needs.details.outputs.new_version }}" | sort -rV | head -n1)" != "${{ needs.details.outputs.new_version }}" ]; then | ||
echo "Version ${{ needs.details.outputs.new_version }} is not newer than PyPI version $latest_version" | ||
exit 1 | ||
fi | ||
|
||
setup_and_build: | ||
needs: [details, check_pypi] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" # Changed from 3.13 to stable version | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Configure Poetry | ||
run: | | ||
poetry config virtualenvs.in-project true | ||
poetry config virtualenvs.create true | ||
|
||
- name: Set version | ||
run: poetry version ${{ needs.details.outputs.new_version }} | ||
|
||
- name: Install dependencies | ||
run: poetry install --sync --no-interaction --no-root | ||
|
||
- name: Build package | ||
run: poetry build | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/* | ||
|
||
pypi_publish: | ||
needs: setup_and_build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: release | ||
permissions: | ||
id-token: write # Essential for trusted publishing | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
verbose: true # For better debugging | ||
|
||
github_release: | ||
needs: [setup_and_build, pypi_publish] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ needs.details.outputs.tag_name }} | ||
PayalLakra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
files: | | ||
dist/* | ||
generate_release_notes: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include requirements.txt | ||
include README.md | ||
recursive-include chordspy/templates * | ||
recursive-include chordspy/static * | ||
recursive-include chordspy/config * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.