Skip to content

Commit

Permalink
Fix nightly-release workflow and tweak Poetry package naming (#208)
Browse files Browse the repository at this point in the history
## Problem
After the poetry migration in
#193 the `PyPI
Release: Nightly (pinecone-client-nightly)` has been failing:
https://github.com/pinecone-io/pinecone-python-client/actions/runs/6374232183/job/17298658421

The reason is we removed the `setup.py` file as a part of the migration
and `nightly-release.yaml` used to adjust the module name via `sed -i
's/pinecone-client/pinecone-client-nightly/g' setup.py`. To achieve
something similar now that we've changed our build / packaging process
to use Poetry, we need to look at updating the `pyproject.toml` file.

While looking at correcting this, I realized the resulting build
artifacts from `make package` (which now calls `poetry build`) now have
different package names which may cause issues with PyPI:

- (Old) `pinecone-client-2.2.4.tar.gz`
- (New) `pinecone-2.2.4.tar.gz`
- (Old) `pinecone_client-2.2.4-py3-none-any.whl`
- (New) `pinecone-2.2.4-py3-none-any.whl`

## Solution

- I updated `nightly-release.yaml` to call `sed -i ...` on the
`pyproject.toml` file instead of `setup.py`. This should swap out `name:
pinecone-client` for `name: pinecone-client-nightly` under
`[tools.poetry]` which should fix up the package naming.
- Added a `packages` section to `pyproject.toml` to define the top-level
pinecone package entrypoint. Poetry uses the `name` field by default
unless this is specified which is why we were ending up with artifacts
called `pinecone-...` rather than `pinecone-client-...`.

**Note:**
Poetry swaps the hyphen in `pinecone-client` for an underscore in the
resulting build output artifacts.

New packages:
- `pinecone_client-2.2.4.tar.gz`
- `pinecone_client-2.2.4-py3-none-any.whl`

The `.whl` naming is equivalent, and the `tar.gz` has an underscore
rather than a hyphen. I think ultimately this shouldn't matter given the
guidance around `name` here:

https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#name

> Comparison of project names is case insensitive and treats
arbitrarily-long runs of underscores, hyphens, and/or periods as equal.
For example, if you register a project named cool-stuff, users will be
able to download it or declare a dependency on it using any of the
following spellings:
Cool-Stuff
cool.stuff
COOL_STUFF
CoOl__-.-__sTuFF


## Type of Change

- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
- [X] Infrastructure change (CI configs, etc)
- [ ] Non-code change (docs, etc)
- [ ] None of the above: (explain here)

## Test Plan

Describe specific steps for validating this change.
  • Loading branch information
austin-denoble authored Oct 3, 2023
1 parent 229e8db commit ab0fba7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/nightly-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get recent changes
id: list-commits
run: |
Expand All @@ -31,19 +31,19 @@ jobs:
- name: Set dev version
id: version
run: |
versionFile="pinecone/__version__"
currentDate=$(date +%Y%m%d%H%M%S)
versionNumber=$(cat $versionFile)
devVersion="${versionNumber}.dev${currentDate}"
echo "$devVersion" > $versionFile
versionFile="pinecone/__version__"
currentDate=$(date +%Y%m%d%H%M%S)
versionNumber=$(cat $versionFile)
devVersion="${versionNumber}.dev${currentDate}"
echo "$devVersion" > $versionFile
- name: Adjust module name
run: |
sed -i 's/pinecone-client/pinecone-client-nightly/g' setup.py
sed -i 's/pinecone-client/pinecone-client-nightly/g' pyproject.toml
- name: Update README
run: |
echo "This is a nightly developer build of the Pinecone Python client. It is not intended for production use." > README.md
echo "This is a nightly developer build of the Pinecone Python client. It is not intended for production use." > README.md
- uses: actions/setup-python@v4
with:
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ exclude = '''
'''

[tool.poetry]
name = "pinecone"
name = "pinecone-client"
version = "2.2.4"
packages = [
{ include="pinecone", from="." },
]
description = "Pinecone client and SDK"
authors = ["Pinecone Systems, Inc. <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit ab0fba7

Please sign in to comment.