Skip to content
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

airbyte-ci: Switch to prod pypi #34606

Merged
merged 12 commits into from
Jan 30, 2024
Merged

airbyte-ci: Switch to prod pypi #34606

merged 12 commits into from
Jan 30, 2024

Conversation

flash1293
Copy link
Contributor

This PR switches the python registry publish logic over to prod pypi:

  • Pass python registry URL in via env variable and set to upload.pypi.org instead of test.pypi.org
  • Extend readme to document these things
  • Move the cachebuster layer up so new env vars are actually reflected

For this to work in CI, the PYPI_TOKEN Github secret needs to be updated (token is generated already).

I tested manually with a poetry and setup.py package and was able to publish without issues:

@flash1293 flash1293 requested a review from a team January 29, 2024 15:29
Copy link

vercel bot commented Jan 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2024 7:31pm

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flash1293 are we still using the test PyPi when calling publish with the --pre-release option?

.github/actions/run-airbyte-ci/action.yml Show resolved Hide resolved
#### Python registry publishing

If `remoteRegistries.pypi.enabled` in the connector metadata is set to `true`, the connector will be published to the python registry.
To do so, the `PYTHON_REGISTRY_TOKEN` and `PYTHON_REGISTRY_URL` env vars are used to authenticate with the registry and publish the connector.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To do so, the `PYTHON_REGISTRY_TOKEN` and `PYTHON_REGISTRY_URL` env vars are used to authenticate with the registry and publish the connector.
To do so, the `--python-registry-token` and `--python-registry-url` options are used to authenticate with the registry and publish the connector.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only available on the poetry publish command, which is not used for connectors. For connectors you actually have to use the env variables.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I did not notice this. I'd prefer to have the same option on the connector side 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added these options (renamed the registry option to python registry for consistency)

| `--publish-name` | False | | | The name of the package. Not required for poetry packages that define it in the `pyproject.toml` file |
| `--publish-version` | False | | | The version of the package. Not required for poetry packages that define it in the `pyproject.toml` file |
| `--python-registry-token` | True | | PYTHON_REGISTRY_TOKEN | The API token to authenticate with the registry. For pypi, the `pypi-` prefix needs to be specified |
| `--registry-url` | False | https://upload.pypi.org/legacy/ | PYTHON_REGISTRY_URL | The python registry to publish to. Defaults to main pypi |
Copy link
Contributor

@alafanechere alafanechere Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering where the default URL should live in. I'd say it should be at the airbyte-ci CLI level, which would mean the PYTHON_REGISTRY_URL env var does not need to be set on main-release

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely on the airbyte-ci level, but IMHO it makes sense here as well for local usage.

@flash1293
Copy link
Contributor Author

are we still using the test PyPi when calling publish with the --pre-release option?

No, it's going into regular pypi as a dev release (e.g. 0.1.0.dev1234567). As this is shown as "pre-release", IMHO it's the closest semantically to the pre-release logic we have in place already.

Screenshot 2024-01-29 at 16 47 10

test pypi is more of a development thing for publishing pipelines.

@flash1293
Copy link
Contributor Author

flash1293 commented Jan 29, 2024

@alafanechere could addressed your points, could you take another look?

Comment on lines +49 to +50
python_registry_token: Optional[str] = None,
python_registry_url: Optional[str] = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a validation on init that these keyword arguments are not None when self.connector.language in [ConnectorLanguage.Python, ConnectorLanguage.LowCode]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a check to the step - if the python publish logic is hit, it will fail with a descriptive error in case the registry or token isn't set properly.

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@flash1293
Copy link
Contributor Author

@octavia-squidington-iii octavia-squidington-iii removed the area/connectors Connector related issues label Jan 29, 2024
@flash1293 flash1293 merged commit d1334be into master Jan 30, 2024
21 checks passed
@flash1293 flash1293 deleted the flash1293/pypi-prod branch January 30, 2024 08:49
clnoll pushed a commit that referenced this pull request Jan 30, 2024
jbfbell pushed a commit that referenced this pull request Feb 1, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 21, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants