mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 22:11:55 +00:00
Publish versions a3 to Pypi (#5568)
* bump versions and script to publish * small improvements * uncomment exception * openbb * publishing guidelines * improve docs
This commit is contained in:
7
.github/pull_request_template.md
vendored
7
.github/pull_request_template.md
vendored
@@ -25,7 +25,6 @@
|
||||
|
||||
### Checklist
|
||||
|
||||
|
||||
- [ ] I ensure I have self-reviewed my code.
|
||||
- [ ] I have commented/documented my code, particularly in hard-to-understand sections.
|
||||
- [ ] I have adhered to the GitFlow naming convention and my branch name is in the format of `feature/feature-name` or `hotfix/hotfix-name`.
|
||||
@@ -65,7 +64,10 @@
|
||||
- [ ] Ensure the existing tests pass.
|
||||
- [ ] Ensure the new provider and/or fetcher is stable and usable.
|
||||
- [ ] If applicable, please add new tests for the provider and/or fetcher (see [CONTRIBUTING.md](/openbb_platform/CONTRIBUTING.md) to leverage semi-automated testing).
|
||||
|
||||
- If a new provider or extension was added:
|
||||
- [ ] Update the list of [Extensions](/openbb_platform/EXTENSIONS.md).
|
||||
- [ ] Update the list of [Providers](/openbb_platform/PROVIDERS.md).
|
||||
- [ ] If it's a community extension or provider, update the [integration tests GitHub Action workflow](/.github/workflows/platform-api-integration-test.yml).
|
||||
|
||||
### Checklist
|
||||
|
||||
@@ -75,5 +77,4 @@
|
||||
- [ ] I ensure that I am following th [CONTRIBUTING guidelines](https://github.com/OpenBB-finance/OpenBBTerminal/blob/main/CONTRIBUTING.md).
|
||||
- [ ] (If applicable) I have updated tests following [these guidelines](/openbb_platform/CONTRIBUTING.md#qa-your-extension).
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
18
openbb_platform/PUBLISH.md
vendored
Normal file
18
openbb_platform/PUBLISH.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Publishing to PyPI
|
||||
|
||||
Publishing checklist:
|
||||
|
||||
> Note: you need to have the appropriate credentials and permissions to publish to PyPI
|
||||
|
||||
1. Ensure all unit tests pass: `pytest openbb_platform -m "not integration"`
|
||||
2. Ensure all integration tests pass: `pytest openbb_platform -m integration`
|
||||
3. Change the Platform version on `openbb_platform/platform/core/openbb_core/app/constants.py`
|
||||
4. Run the publishing script: `python openbb_platform/dev_publish.py`
|
||||
5. Update poetry files: `python openbb_platform/poetry_update.py`
|
||||
6. Open a PR so that changes are reflected on the main branch
|
||||
|
||||
Finally, check if everything worked:
|
||||
|
||||
1. Install and test the package from Pypi on a clean environment
|
||||
2. Check if all the `pyproject.toml` files are correct, including the `openbb_platform` one.
|
||||
3. Double check if there is any new extension or provider that needs to be added to [integration tests GitHub Action workflow](/.github/workflows/platform-api-integration-test.yml).
|
||||
59
openbb_platform/dev_publish.py
Normal file
59
openbb_platform/dev_publish.py
Normal file
@@ -0,0 +1,59 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
repo_dir = Path(__file__).parent.parent
|
||||
|
||||
# core and provider
|
||||
core_dir = repo_dir / "openbb_platform/platform/core"
|
||||
provider_dir = repo_dir / "openbb_platform/platform/provider"
|
||||
|
||||
# extensions
|
||||
extensions_dir = repo_dir / "openbb_platform/extensions"
|
||||
extensions = [x for x in extensions_dir.iterdir() if x.is_dir()]
|
||||
|
||||
# providers
|
||||
providers_dir = repo_dir / "openbb_platform/providers"
|
||||
providers = [x for x in providers_dir.iterdir() if x.is_dir()]
|
||||
|
||||
# openbb
|
||||
openbb_dir = repo_dir / "openbb_platform"
|
||||
|
||||
VERSION_BUMP_CMD = "poetry version prerelease"
|
||||
PUBLISH_CMD = "poetry publish --build"
|
||||
|
||||
raise Exception(
|
||||
"If you're ar running this script for the first time,"
|
||||
"ensure you have changed `VERSION` on System Settings "
|
||||
"before you publish the `openbb-core` package to Pypi."
|
||||
)
|
||||
|
||||
|
||||
def run_cmds(directory: Path):
|
||||
print(f"Publishing: {directory.name}") # noqa: T201
|
||||
os.chdir(directory)
|
||||
os.system(VERSION_BUMP_CMD) # noqa: S605
|
||||
os.system(PUBLISH_CMD) # noqa: S605
|
||||
|
||||
|
||||
# provider
|
||||
run_cmds(provider_dir)
|
||||
|
||||
# core
|
||||
run_cmds(core_dir)
|
||||
|
||||
# extensions
|
||||
for extension in extensions:
|
||||
if extension.name in ["__pycache__", "tests"]:
|
||||
continue
|
||||
|
||||
run_cmds(extension)
|
||||
|
||||
# providers
|
||||
for provider in providers:
|
||||
if provider.name in ["__pycache__", "tests"]:
|
||||
continue
|
||||
|
||||
run_cmds(provider)
|
||||
|
||||
# openbb
|
||||
run_cmds(openbb_dir)
|
||||
Reference in New Issue
Block a user