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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/publish-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
# install poetry first for cache
- name: setup poetry
run: pipx install poetry poetry-dynamic-versioning
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -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

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"


[tool.poetry-dynamic-versioning.substitution]
folders = [
{ path = "alpaca" }
Expand Down