Build an app that allows the user to provide the items required to create and manage the lifecycle of repositories in Bitbucket using the atlassian-python-api library.
To upload files, please first save the app
import streamlit as st
from atlassian import Bitbucket
# Streamlit app title
st.title('Bitbucket Repository Manager')
# User inputs for Bitbucket
with st.form(key='bitbucket_form'):
username = st.text_input('Enter your Bitbucket Username')
password = st.text_input('Enter your Bitbucket App Password', type='password')
repo_name = st.text_input('Enter the Repository Name')
project_key = st.text_input('Enter the Project Key')
submit_button = st.form_submit_button(label='Create/Manage Repository')
if submit_button:
# Initialize Bitbucket instance
bitbucket = Bitbucket(username=username, password=password)
# Check if the repository exists
if bitbucket.repo.exists(project_key, repo_name):
st.success('Repository Exists!')
# Provide options to manage the repository
if st.button('Delete Repository'):
bitbucket.repo.delete(project_key, repo_name)
st.success('Repository Deleted')
else:
# Create a new repository
bitbucket.repo.create(project_key, repo_name)
st.success('Repository Created')
# Additional lifecycle management options can be added here.
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?