Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pipeline fail to publish to pypi when package contains dependencies

Edited

I'm trying to publish a python package but build fails on pipe

image.png

My package requires requests and pytz so, on setup.py I have install_requires=['requests', 'pytz']

 

The atlassian/pypi-publish:0.3.1 image can't find pytz module so, how I can handle this?

image.png

1 answer

0 votes

@diego.magalhaes

follow Python Packaging guide  https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives

and use appropriate DISTRIBUTIONS.

Like

'DISTRIBUTIONS': 'sdist bdist_wheel'
This should help you.
You also may want some of the next commands to put in DISTRIBUTIONS variable instead of that, depending on your case (generally you need either  bdist_wheel distributions or just execute the command Before publishing : `python setup.py install`, e.g.).
You can find more commands cli man , typing
`python setup.py --help-commands`
Regards, Galyna

Hey @Galyna Zholtkevych thanks for the reply but it will not help.

I already following this exactly Python Package guide and have the DISTRIBUTION set on my bitbucket-pipelines.yml. Using a python venv without pytz, the behavior is the same when I ran "python setup.py " ModuleNotFoundError: No module named 'pytz'

Since pytz and requests are needed, I need to install it on pypi-publish before pipe.py run.

@diego.magalhaes

try to run

python setup.py install

or

python setup.py develop

instead, before using the pipe publishing. This should install needed things.

I have tested this with pytz also and with other packages and this works for our repository also where we publish package with dependencies.

E.g.

deploy: &deploy
step:
name: Deploy to PyPI
script:
- python setup.py install
- pipe: atlassian/pypi-publish:0.2.3
variables:
PYPI_USERNAME: $USERNAME
PYPI_PASSWORD: $PASSWORD

 

@diego.magalhaes  if doesn't , please share full logs, we'll try to investigate

@Galyna Zholtkevych 

I found a way to solve this problem before your reply. The pipe was removed from yaml and I used twine to upload and it directly so:

script: 
-
export BUILD_VERSION=${BITBUCKET_TAG}
- pip install twine requests pytz
- python setup.py sdist bdist_wheel
- twine check dist/*
- twine upload -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} dist/*

 Thank's for your support!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

157 views 2 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you