Pipeline fail to publish to pypi when package contains dependencies

diego.magalhaes November 12, 2020

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
Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 13, 2020

@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
diego.magalhaes November 13, 2020

Hey @Halyna Berezovska 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.

Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 13, 2020

@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

 

Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 13, 2020

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

diego.magalhaes November 16, 2020

@Halyna Berezovska 

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!

Like Qoyyuum likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events