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

fix: Fix publish-pypi #395

Merged
merged 3 commits into from
Jan 5, 2024
Merged

Conversation

hiohiohio
Copy link
Contributor

@hiohiohio hiohiohio commented Dec 27, 2023

Context:

  • introduced poetry-dynamic-versioning in feat: Use poetry-dynamic-versioning #390
  • however, it causes an error when installing the poetry-dynamic-versioning package as pipx does not support installing multiple packages
  pipx install poetry poetry-dynamic-versioning
  shell: /usr/bin/bash -e {0}
usage: pipx [-h] [--version]
            {install,uninject,inject,upgrade,upgrade-all,uninstall,uninstall-all,reinstall,reinstall-all,list,run,runpip,ensurepath,environment,completions}
            ...
pipx: error: unrecognized arguments: poetry-dynamic-versioning
Error: Process completed with exit code 2.

Changes:

  • separate installing poetry-dynamic-versioning for poetry-publish

@AlexandrosKyriakakis
Copy link
Member

Wondering if the versioning will still be published here ->

headers["User-Agent"] = "APCA-PY/" + __version__

@hiohiohio
Copy link
Contributor Author

Wondering if the versioning will still be published here

The __version__ is from here and the version number will be replaced by poetry-dynamic-versioning if all configuration is good.
https://github.com/alpacahq/alpaca-py/blob/ba83efb4660c0aabb0ffa54732ef79fe04785747/alpaca/__init__.py#L2C8-L2C8

@@ -41,6 +41,9 @@ sphinx-toolbox = "^3.1.2"
requires = ["poetry-core>=1.4.2", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry-dynamic-versioning]
enable=true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

missed to enable poetry-dynamic-versioning
now you can test on local by running below command with local git tag of vN.N.N

poetry build

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AlexandrosKyriakakis confirmed on local that the version is replaced by the poetry-dynamic-versioning

% git clone [email protected]:hiohiohio/alpaca-py.git
% git switch fix-publish-pypi
% git tag v0.0.2      
% poetry build
Building alpaca-py (0.0.2)
  - Building sdist
  - Built alpaca_py-0.0.2.tar.gz
  - Building wheel
  - Built alpaca_py-0.0.2-py3-none-any.whl
% cd dist                  
% unzip alpaca_py-0.0.2-py3-none-any.whl
Archive:  alpaca_py-0.0.2-py3-none-any.whl
  inflating: alpaca/__init__.py      
  inflating: alpaca/broker/__init__.py  
  inflating: alpaca/broker/client.py  
  inflating: alpaca/broker/enums.py  
  inflating: alpaca/broker/models/__init__.py  
  inflating: alpaca/broker/models/accounts.py  
  inflating: alpaca/broker/models/cip.py  
  inflating: alpaca/broker/models/documents.py  
  inflating: alpaca/broker/models/funding.py  
  inflating: alpaca/broker/models/journals.py  
  inflating: alpaca/broker/models/trading.py  
  inflating: alpaca/broker/requests.py  
  inflating: alpaca/common/__init__.py  
  inflating: alpaca/common/constants.py  
  inflating: alpaca/common/enums.py  
  inflating: alpaca/common/exceptions.py  
  inflating: alpaca/common/models.py  
  inflating: alpaca/common/requests.py  
  inflating: alpaca/common/rest.py   
  inflating: alpaca/common/types.py  
  inflating: alpaca/common/utils.py  
  inflating: alpaca/common/websocket.py  
  inflating: alpaca/data/__init__.py  
  inflating: alpaca/data/enums.py    
  inflating: alpaca/data/historical/__init__.py  
  inflating: alpaca/data/historical/crypto.py  
  inflating: alpaca/data/historical/news.py  
  inflating: alpaca/data/historical/option.py  
  inflating: alpaca/data/historical/screener.py  
  inflating: alpaca/data/historical/stock.py  
  inflating: alpaca/data/historical/utils.py  
  inflating: alpaca/data/live/__init__.py  
  inflating: alpaca/data/live/crypto.py  
  inflating: alpaca/data/live/stock.py  
  inflating: alpaca/data/mappings.py  
  inflating: alpaca/data/models/__init__.py  
  inflating: alpaca/data/models/bars.py  
  inflating: alpaca/data/models/base.py  
  inflating: alpaca/data/models/news.py  
  inflating: alpaca/data/models/orderbooks.py  
  inflating: alpaca/data/models/quotes.py  
  inflating: alpaca/data/models/screener.py  
  inflating: alpaca/data/models/snapshots.py  
  inflating: alpaca/data/models/trades.py  
  inflating: alpaca/data/requests.py  
  inflating: alpaca/data/timeframe.py  
  inflating: alpaca/py.typed         
  inflating: alpaca/trading/__init__.py  
  inflating: alpaca/trading/client.py  
  inflating: alpaca/trading/enums.py  
  inflating: alpaca/trading/models.py  
  inflating: alpaca/trading/requests.py  
  inflating: alpaca/trading/stream.py  
  inflating: alpaca_py-0.0.2.dist-info/LICENSE  
  inflating: alpaca_py-0.0.2.dist-info/METADATA  
  inflating: alpaca_py-0.0.2.dist-info/WHEEL  
  inflating: alpaca_py-0.0.2.dist-info/RECORD  
% cat alpaca/__init__.py 
# placeholder for poetry-dynamic-versioning
__version__ = "0.0.2"

@@ -35,3 +35,4 @@ jobs:
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
plugins: "poetry-dynamic-versioning"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@hiohiohio hiohiohio Dec 28, 2023

Choose a reason for hiding this comment

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

@sai-g thank you. I have checked this on local using act and seems working as expected.
The last part is failing as expected because I did not supply pypi token.

| Expected a value for pypi-token.pypi setting.

% git tag v0.0.3
% act --container-architecture linux/amd64 -j build-and-publish --pull=false
WARN[0000] Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name
WARN[0000] Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name
[Publish python package/build-and-publish] 🚀  Start image=catthehacker/ubuntu:act-latest
INFO[0000] Parallel tasks (0) below minimum, setting to 1
[Publish python package/build-and-publish]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform=linux/amd64 username= forcePull=false
INFO[0002] Parallel tasks (0) below minimum, setting to 1
[Publish python package/build-and-publish]   🐳  docker create image=catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Publish python package/build-and-publish]   🐳  docker run image=catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Publish python package/build-and-publish]   ☁  git clone 'https://github.com/JRubics/poetry-publish' # ref=v1.16
[Publish python package/build-and-publish] ⭐ Run Main actions/checkout@v4
[Publish python package/build-and-publish]   🐳  docker cp src=/ws/hiohiohio-alpaca-py/. dst=/ws/hiohiohio-alpaca-py
[Publish python package/build-and-publish]   ✅  Success - Main actions/checkout@v4
[Publish python package/build-and-publish] ⭐ Run Main Build and publish to pypi
[Publish python package/build-and-publish]   🐳  docker pull image=jrubics/poetry-publish:v1.16 platform=linux/amd64 username= forcePull=false
[Publish python package/build-and-publish]   🐳  docker create image=jrubics/poetry-publish:v1.16 platform=linux/amd64 entrypoint=[] cmd=["latest" "latest" "" "" "" "" "" "" "" "" "" "poetry-dynamic-versioning" "."] network="container:act-Publish-python-package-build-and-publish-6f9d5ebb146892ab87d15a24d59ba55efc98024e43d94191a329bcad6363d930"
[Publish python package/build-and-publish]   🐳  docker run image=jrubics/poetry-publish:v1.16 platform=linux/amd64 entrypoint=[] cmd=["latest" "latest" "" "" "" "" "" "" "" "" "" "poetry-dynamic-versioning" "."] network="container:act-Publish-python-package-build-and-publish-6f9d5ebb146892ab87d15a24d59ba55efc98024e43d94191a329bcad6363d930"
...
| Using version ^1.2.0 for poetry-dynamic-versioning
...
| Package operations: 4 installs, 0 updates, 0 removals
|
|   • Installing markupsafe (2.1.3)
|   • Installing dunamai (1.19.0)
|   • Installing jinja2 (3.1.2)
|   • Installing poetry-dynamic-versioning (1.2.0)
...
Installing the current project: alpaca-py (0.0.3)
| Building alpaca-py (0.0.3)
|   - Building sdist
|   - Built alpaca_py-0.0.3.tar.gz
|   - Building wheel
|   - Built alpaca_py-0.0.3-py3-none-any.whl
|
| Expected a value for pypi-token.pypi setting.
[Publish python package/build-and-publish]   ❌  Failure - Main Build and publish to pypi
[Publish python package/build-and-publish] exit with `FAILURE`: 1
[Publish python package/build-and-publish] 🏁  Job failed
Error: Job 'build-and-publish' failed

Copy link
Contributor

@matebudai matebudai left a comment

Choose a reason for hiding this comment

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

👍

@hiohiohio hiohiohio merged commit a41e28b into alpacahq:master Jan 5, 2024
5 checks passed
@hiohiohio hiohiohio deleted the fix-publish-pypi branch January 5, 2024 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants