### Set up virtual environment and install python-taiga Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Install the project locally into a virtual environment using pip. This command installs the package in editable mode. ```bash mkvirtualenv taiga cd taiga/ pip install -e . ``` -------------------------------- ### Install python-taiga Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Install the python-taiga library using pip. ```bash pip install python-taiga ``` -------------------------------- ### Initialize TaigaAPI and Get Project by Slug Source: https://context7.com/nephila/python-taiga/llms.txt Initializes the TaigaAPI with a token and retrieves a project object using its slug. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') ``` -------------------------------- ### Create and Manage Tasks Source: https://context7.com/nephila/python-taiga/llms.txt Provides examples for creating, listing, filtering, updating, and deleting tasks, including associating them with user stories and adding comments. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Get a user story story = project.get_userstory_by_ref(42) ``` ```python # Get task status ID task_status = project.task_statuses.get(name='New') ``` ```python # Add task to user story task = story.add_task( 'Implement login form', task_status.id ) print(f"Created task: {task.subject}") ``` ```python # Create standalone task task = api.tasks.create( project=project.id, subject='Review documentation', status=task_status.id, description='Review and update API docs', is_blocked=False, tags=['documentation'] ) ``` ```python # List tasks all_tasks = api.tasks.list(project=project.id) story_tasks = story.list_tasks() ``` ```python # Filter tasks by status new_tasks = api.tasks.list(project=project.id, status=task_status.id) ``` ```python # Get task by reference task = project.get_task_by_ref(123) ``` ```python # Update task task.subject = 'Updated task name' task.is_blocked = True task.blocked_note = 'Waiting for design approval' task.update() ``` ```python # Add comment task.add_comment('Starting work on this task') ``` ```python # Delete task task.delete() ``` -------------------------------- ### Authenticate with Token Source: https://context7.com/nephila/python-taiga/llms.txt Initialize the API with an existing authentication token for faster setup without login. This is useful if you already have a valid token. ```python from taiga import TaigaAPI # Use existing token api = TaigaAPI(token='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...') # Access projects immediately projects = api.projects.list() for project in projects: print(f"Project: {project.name}") ``` -------------------------------- ### Install pre-commit hooks Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Install git hooks using pre-commit to automatically check code style compliance on every commit. Ensure pre-commit is installed globally or in your virtual environment. ```bash pre-commit install ``` -------------------------------- ### Configure Project Settings in Python Source: https://context7.com/nephila/python-taiga/llms.txt Provides Python code examples for configuring project settings such as priorities, severities, issue types, statuses, and points. This involves adding and listing these configuration items. Ensure the TaigaAPI is initialized and a project object is available. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') ``` ```python priority = project.add_priority('Critical', color='#FF0000') ``` ```python priorities = project.list_priorities() ``` ```python severity = project.add_severity('Blocker', color='#FF0000') ``` ```python severities = project.list_severities() ``` ```python issue_type = project.add_issue_type('Security', color='#FF5733') ``` ```python issue_types = project.list_issue_types() ``` ```python issue_status = project.add_issue_status('In Review', color='#FFA500') ``` ```python issue_statuses = project.list_issue_statuses() ``` ```python task_status = project.add_task_status('Testing', color='#00FF00') ``` ```python task_statuses = project.list_task_statuses() ``` ```python story_status = project.add_user_story_status('Ready for Dev', color='#0000FF') ``` ```python story_statuses = project.list_user_story_statuses() ``` ```python point = project.add_point('XXL', value=40) ``` ```python points = project.list_points() ``` ```python old_status = project.issue_statuses.get(name='Old Status') new_status = project.issue_statuses.get(name='New Status') old_status.delete(move_to_id=new_status.id) ``` -------------------------------- ### List User Stories and Get by Attribute Source: https://context7.com/nephila/python-taiga/llms.txt Lists all user stories for a project and demonstrates retrieving a single story by its reference number or priority. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # List returns SearchableList with helper methods stories = project.list_user_stories() # Get single item by attribute story = stories.get(ref=42) high_priority_story = stories.get(priority=5) ``` -------------------------------- ### Create and Manage Epics Source: https://context7.com/nephila/python-taiga/llms.txt Demonstrates creating, listing, updating, and deleting epics, including retrieving associated user stories and adding comments. Also shows how to get custom attributes. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Create an epic epic = project.add_epic( 'User Authentication System', description='Complete authentication flow including login, logout, and password recovery', color='#FF5733', tags=['authentication', 'security'] ) print(f"Created epic: {epic.subject}") ``` ```python # List epics epics = project.list_epics() for e in epics: print(f"Epic: {e.subject}") ``` ```python # Get epic by reference epic = project.get_epic_by_ref(5) ``` ```python # List user stories in epic stories = epic.list_user_stories() for story in stories: print(f" Story: {story.subject}") ``` ```python # Update epic epic.is_closed = True epic.update() ``` ```python # Add comment epic.add_comment('All stories completed, closing epic') ``` ```python # Get custom attributes attrs = epic.get_attributes() ``` ```python # Delete epic epic.delete() ``` -------------------------------- ### Get User's Starred Projects Source: https://context7.com/nephila/python-taiga/llms.txt Retrieves and prints the names of projects starred by the authenticated user. ```python me = api.me() starred = me.starred_projects() for proj in starred: print(f"Starred: {proj.name}") ``` -------------------------------- ### List and Filter Projects Source: https://context7.com/nephila/python-taiga/llms.txt Retrieve projects with filtering and pagination options. You can list all projects, get a specific project by slug or ID, or paginate through results. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') # List all projects projects = api.projects.list() for project in projects: print(f"{project.name}: {project.description}") # Get project by slug project = api.projects.get_by_slug('my-project-slug') # Get project by ID project = api.projects.get(123) # List with pagination projects_page1 = api.projects.list(page=1, page_size=50) projects_page2 = api.projects.list(page=2, page_size=50) # Disable pagination (get all at once - use cautiously) all_projects = api.projects.list(pagination=False) ``` -------------------------------- ### Get History for Other Item Types Source: https://context7.com/nephila/python-taiga/llms.txt Demonstrates how to retrieve history for tasks, issues, and epics using their respective IDs. ```python task = project.get_task_by_ref(100) task_history = api.history.task.get(task.id) issue = project.get_issue_by_ref(50) issue_history = api.history.issue.get(issue.id) epic = project.get_epic_by_ref(5) epic_history = api.history.epic.get(epic.id) ``` -------------------------------- ### Get Any Item by Reference Source: https://context7.com/nephila/python-taiga/llms.txt Retrieves any project item (user story, task, issue, epic) using its reference number. Auto-detects the item type. ```python item = project.get_item_by_ref(42) if item: print(f"Found: {item.subject}") ``` -------------------------------- ### Run tests with tox Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Execute all tests across different Python versions using tox to ensure code quality and compatibility. Ensure tox is installed in your virtual environment. ```bash tox ``` -------------------------------- ### Get Specific Item Types by Reference Source: https://context7.com/nephila/python-taiga/llms.txt Retrieves specific item types (user story, task, issue, epic) by their reference numbers. ```python user_story = project.get_userstory_by_ref(42) task = project.get_task_by_ref(100) issue = project.get_issue_by_ref(50) epic = project.get_epic_by_ref(5) ``` -------------------------------- ### Get Wiki History Source: https://context7.com/nephila/python-taiga/llms.txt Retrieves the history of a wiki page using its ID. ```python wiki_history = api.history.wiki.get(wiki_page.id) ``` -------------------------------- ### Get history of a user story Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Retrieves the history associated with a specific user story. ```python history = api.history.user_story.get(user_story.id) ``` -------------------------------- ### Get Project, User Story, Task, or Issue by Reference Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Retrieve specific Taiga items (projects, user stories, tasks, issues) using their primary key or a slug/reference. This is useful for accessing individual items when you know their identifier. ```python new_project = api.projects.get_by_slug('nephila') print (new_project.get_issue_by_ref(1036)) print (new_project.get_userstory_by_ref(1111)) print (new_project.get_task_by_ref(1112)) ``` -------------------------------- ### Get Project Metadata by Name Source: https://context7.com/nephila/python-taiga/llms.txt Retrieves specific project metadata like priorities, statuses, or roles by their names from the project's embedded lists. ```python # Get from project's embedded lists priority = project.priorities.get(name='High') status = project.issue_statuses.get(name='New') role = project.roles.get(name='Developer') ``` -------------------------------- ### Get User Story History Source: https://context7.com/nephila/python-taiga/llms.txt Retrieves and prints the history of a specific user story, including who made changes, when, and any comments. ```python story = project.get_userstory_by_ref(42) history = api.history.user_story.get(story.id) for entry in history: print(f"Changed by: {entry.get('user', {}).get('name')}") print(f"Date: {entry.get('created_at')}") print(f"Comment: {entry.get('comment')}") print("---") ``` -------------------------------- ### Run tox tests for a specific Python version Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Execute tests for a specific Python version, for example, Python 3.7, using tox. This is useful for targeted testing. ```bash tox -epy37 ``` -------------------------------- ### Create and Manage Projects Source: https://context7.com/nephila/python-taiga/llms.txt Create new projects, configure settings, and duplicate existing projects. This includes liking, unliking, and retrieving project statistics. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') # Create a new project project = api.projects.create( 'My New Project', 'A detailed project description' ) print(f"Created project: {project.name} (ID: {project.id})") # Configure project settings project.is_private = True project.is_backlog_activated = True project.is_kanban_activated = True project.is_wiki_activated = True project.update() # Duplicate an existing project old_project = api.projects.get_by_slug('template-project') new_project = old_project.duplicate( 'New Project from Template', 'Duplicated from template', is_private=True, users=[] # Optional: list of user IDs to include ) # Like/Unlike a project project.like() project.unlike() # Get project statistics stats = project.stats() print(f"Total points: {stats.get('total_points')}") issues_stats = project.issues_stats() print(f"Open issues: {issues_stats.get('opened_issues')}") # Delete project project.delete() ``` -------------------------------- ### Create and star a project Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Creates a new project and then stars it using the API. ```python new_project = api.projects.create('TEST PROJECT', 'TESTING API') new_project.star() ``` -------------------------------- ### Configure Webhooks in Python Source: https://context7.com/nephila/python-taiga/llms.txt Demonstrates how to create, list, update, and delete webhooks for a project. Webhooks are used for event notifications. Requires a project object and details like name, URL, and secret key for creation. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') ``` ```python webhook = project.add_webhook( 'CI/CD Pipeline', 'https://ci.example.com/webhooks/taiga', 'your-secret-key' ) print(f"Created webhook: {webhook.name}") ``` ```python webhooks = project.list_webhooks() for wh in webhooks: print(f"Webhook: {wh.name} -> {wh.url}") ``` ```python webhook.url = 'https://new-ci.example.com/webhooks/taiga' webhook.update() ``` ```python webhook.delete() ``` -------------------------------- ### List available tox environments Source: https://github.com/nephila/python-taiga/blob/master/CONTRIBUTING.rst View all available tox environments, including those for code style checking and documentation generation. ```bash tox -l ``` -------------------------------- ### Create and Push Tag Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Create a Git tag for the new release version and push it to the remote repository. ```bash git tag ``` ```bash git push origin ``` -------------------------------- ### Create and Manage User Stories Source: https://context7.com/nephila/python-taiga/llms.txt Demonstrates creating, listing, filtering, updating, and deleting user stories within a project. Includes creating stories with milestones and adding comments. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Create a user story story = project.add_user_story( 'As a user, I want to login', description='User authentication feature', tags=['auth', 'security'], is_blocked=False ) print(f"Created story: {story.subject} (ref: {story.ref})") ``` ```python # Create story with milestone milestone = project.milestones[0] story_with_sprint = project.add_user_story( 'Implement password reset', description='Allow users to reset their password', milestone=milestone.id ) ``` ```python # List user stories stories = project.list_user_stories() for s in stories: print(f"#{s.ref}: {s.subject}") ``` ```python # Filter stories stories = api.user_stories.list(project=project.id, status=1) ``` ```python # Get story by reference story = project.get_userstory_by_ref(42) ``` ```python # Update story story.subject = 'Updated subject' story.description = 'Updated description' story.update() ``` ```python # Add comment to story story.add_comment('This is a comment on the user story') ``` ```python # Get and set custom attributes attrs = story.get_attributes() story.set_attribute('1', 'Custom value', version=1) ``` ```python # Delete story story.delete() ``` -------------------------------- ### Manage Project Tags in Python Source: https://context7.com/nephila/python-taiga/llms.txt Illustrates how to add and list tags for a project, and how to apply tags to user stories and issues. Tags can have optional colors. Ensure the TaigaAPI is initialized and a project object is available. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') ``` ```python project.add_tag('feature', color='#00FF00') project.add_tag('bug', color='#FF0000') project.add_tag('documentation') # Color is optional ``` ```python tags = project.list_tags() for tag, color in tags.items(): print(f"Tag: {tag} (color: {color})") ``` ```python story = project.add_user_story( 'New feature', tags=['feature', 'priority'] ) ``` ```python issue = project.add_issue( 'Critical bug', priority.id, status.id, issue_type.id, severity.id, tags=['bug', 'critical'] ) ``` -------------------------------- ### Create a New Project Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Create a new project in Taiga by providing a name and a slug. This is a fundamental operation for organizing your work. ```python new_project = api.projects.create('TEST PROJECT', 'TESTING API') ``` -------------------------------- ### List and Set Custom Attributes in Python Source: https://context7.com/nephila/python-taiga/llms.txt Demonstrates how to list custom attributes for different item types (issues, tasks, user stories, epics) and how to set attribute values on specific issues or user stories. Requires a project object and attribute IDs. ```python issue_attrs = project.list_issue_attributes() task_attrs = project.list_task_attributes() story_attrs = project.list_user_story_attributes() epic_attrs = project.list_epic_attributes() ``` ```python issue = project.get_issue_by_ref(50) issue.set_attribute(issue_attr.id, 'iPhone 12', version=1) ``` ```python attrs = issue.get_attributes() print(f"Attributes: {attrs}") ``` ```python story = project.get_userstory_by_ref(42) story.set_attribute(story_attr.id, '8') ``` -------------------------------- ### Search for items within a project Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Lists all projects, then searches for items (user stories in this case) within the first project. The search term is 'NEW'. ```python projects = api.projects.list() search_result = api.search(projects[0].id, 'NEW') for user_story in search_result.user_stories: print (user_story) ``` -------------------------------- ### Create Git Tag Source: https://github.com/nephila/python-taiga/blob/master/CONTRIBUTING.rst Create a Git tag for a specific version. Replace `` with the actual version number. ```bash git tag ``` -------------------------------- ### Create and Manage Issues Source: https://context7.com/nephila/python-taiga/llms.txt Shows how to create, list, filter, update, vote on, and delete issues, including setting priorities, severities, and types. Also covers adding comments and custom attributes. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Get required IDs for issue creation priority = project.priorities.get(name='High') status = project.issue_statuses.get(name='New') issue_type = project.issue_types.get(name='Bug') severity = project.severities.get(name='Normal') ``` ```python # Create an issue issue = project.add_issue( 'Login button not working', priority.id, status.id, issue_type.id, severity.id, description='Users cannot click the login button on mobile devices' ) print(f"Created issue: #{issue.ref} - {issue.subject}") ``` ```python # List issues issues = project.list_issues() for i in issues: print(f"#{i.ref}: {i.subject}") ``` ```python # Filter issues api_issues = api.issues.list(project=project.id, status=status.id) ``` ```python # Get issue by reference issue = project.get_issue_by_ref(100) ``` ```python # Update issue issue.subject = 'Login button not responsive on mobile' issue.update() ``` ```python # Voting on issues issue.upvote() issue.downvote() ``` ```python # Add comment issue.add_comment('Confirmed this issue on iOS Safari') ``` ```python # Custom attributes issue.set_attribute('device', 'iPhone 12') ``` ```python # Delete issue issue.delete() ``` -------------------------------- ### Search Project Items in Python Source: https://context7.com/nephila/python-taiga/llms.txt Shows how to perform searches within a project for various item types including user stories, tasks, issues, wiki pages, and epics. Requires an initialized TaigaAPI and a project object. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') ``` ```python results = api.search(project.id, 'login') ``` ```python print(f"Total results: {results.count}") ``` ```python print("User Stories:") for story in results.user_stories: print(f" #{story.ref}: {story.subject}") ``` ```python print("Tasks:") for task in results.tasks: print(f" #{task.ref}: {task.subject}") ``` ```python print("Issues:") for issue in results.issues: print(f" #{issue.ref}: {issue.subject}") ``` ```python print("Wiki Pages:") for page in results.wikipages: print(f" {page.slug}") ``` ```python print("Epics:") for epic in results.epics: print(f" {epic.subject}") ``` -------------------------------- ### Clone the python-taiga repository Source: https://github.com/nephila/python-taiga/blob/master/CONTRIBUTING.rst Clone your forked repository locally to begin development. ```bash $ git clone git@github.com:your_name_here/python-taiga.git ``` -------------------------------- ### Manage Project Memberships and Roles in Python Source: https://context7.com/nephila/python-taiga/llms.txt Shows how to manage project members and their roles using the Taiga API. This includes creating new roles, adding members with specific roles, listing existing memberships, and updating or deleting memberships. Ensure you have initialized the TaigaAPI with a valid token and obtained a project object. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') ``` ```python role = project.add_role('QA Engineer', computable=True) print(f"Created role: {role.name}") ``` ```python roles = project.list_roles() for r in roles: print(f"Role: {r.name}") ``` ```python membership = project.add_membership( 'developer@example.com', role.id ) print(f"Added member: {membership.email}") ``` ```python memberships = project.list_memberships() for m in memberships: print(f"Member: {m.email}") ``` ```python membership.role = another_role.id membership.update() ``` ```python membership.delete() ``` -------------------------------- ### Clone the python-taiga repository Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Clone your forked repository locally to begin making changes. ```bash git clone git@github.com:your_name_here/python-taiga.git ``` -------------------------------- ### List Tasks with Project Filter Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Retrieve a list of tasks, filtered by a specific project ID. This demonstrates how to apply filters when listing items. ```python tasks = api.tasks.list(project=1) ``` -------------------------------- ### Commit and push changes Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Stage all changes, commit them with a descriptive message, and push the branch to your GitHub repository. ```bash git add . git commit -m "Your detailed description of your changes." git push origin name-of-your-bugfix-or-feature ``` -------------------------------- ### Bump Development Version Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md After merging the release, bump the development version using the inv tag-dev command with the release level. This prepares for the next development cycle. ```bash inv tag-dev --level=release ``` -------------------------------- ### Manage Wiki Pages and Links Source: https://context7.com/nephila/python-taiga/llms.txt This snippet covers creating, listing, updating, and deleting wiki pages, as well as attaching files and managing wiki links. Wiki pages are identified by their slug. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Create wiki page wiki_page = project.add_wikipage( 'getting-started', '# Getting Started\n\nWelcome to the project documentation!' ) print(f"Created wiki page: {wiki_page.slug}") # List wiki pages pages = project.list_wikipages() for page in pages: print(f"Wiki: {page.slug}") # Update wiki page wiki_page.content = '# Getting Started\n\n## Prerequisites\n\nUpdated content here.' wiki_page.update() # Attach file to wiki page wiki_page.attach('/path/to/diagram.png', description='Architecture diagram') # List wiki attachments attachments = wiki_page.list_attachments() # Create wiki link link = project.add_wikilink( 'External Docs', 'https://docs.example.com' ) # List wiki links links = project.list_wikilinks() for l in links: print(f"Link: {l.title} -> {l.href}") # Delete wiki page wiki_page.delete() ``` -------------------------------- ### Handle Project Not Found Error Source: https://context7.com/nephila/python-taiga/llms.txt Shows how to handle `TaigaRestException` when attempting to retrieve a non-existent project, checking for specific status codes like 404 and 403. ```python try: # Attempt to get non-existent project project = api.projects.get(999999) except TaigaRestException as e: if e.status_code == 404: print("Project not found") elif e.status_code == 403: print("Access denied") else: print(f"Error: {e}") ``` -------------------------------- ### Publish Release Source: https://github.com/nephila/python-taiga/blob/master/CONTRIBUTING.rst Publish the release from the tags page on the Git hosting platform (e.g., GitHub). -------------------------------- ### Specify Custom Host Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Configure the TaigaAPI client to connect to a Taiga instance hosted on a custom domain or IP address. Useful if you are not using the default Taiga cloud instance. ```python from taiga import TaigaAPI api = TaigaAPI( host='http://taiga.my.host.org' ) ``` -------------------------------- ### List Projects and User Stories Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Retrieve a list of all projects and user stories available in Taiga. These calls fetch all available items, potentially using pagination behind the scenes. ```python projects = api.projects.list() stories = api.user_stories.list() ``` -------------------------------- ### Add a User Story Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Add a new user story to a project, providing a title and an optional description. User stories are a core component of agile development. ```python userstory = new_project.add_user_story( 'New Story', description='Blablablabla' ) ``` -------------------------------- ### Create and Manage Milestones (Sprints) Source: https://context7.com/nephila/python-taiga/llms.txt Use this to create, list, update, and delete milestones (sprints) in a Taiga project. Dates can be provided as strings or datetime objects. ```python from taiga import TaigaAPI from datetime import datetime, timedelta api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Create a milestone start_date = datetime.now() end_date = start_date + timedelta(days=14) milestone = project.add_milestone( 'Sprint 1', start_date.strftime('%Y-%m-%d'), end_date.strftime('%Y-%m-%d') ) print(f"Created milestone: {milestone.name}") # You can also pass datetime objects directly milestone2 = project.add_milestone( 'Sprint 2', datetime(2024, 2, 1), datetime(2024, 2, 14) ) # List milestones milestones = project.list_milestones() for m in milestones: print(f"Milestone: {m.name} ({m.estimated_start} to {m.estimated_finish})") # Get milestone statistics stats = milestone.stats() print(f"Completed points: {stats.get('completed_points')}") print(f"Total points: {stats.get('total_points')}") # Access user stories in milestone for story in milestone.user_stories: print(f" Story: {story.subject}") # Update milestone milestone.name = 'Sprint 1 - Extended' milestone.update() # Delete milestone milestone.delete() ``` -------------------------------- ### Bump Release Version Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Use this command to bump the release version by major, minor, or patch level. Ensure you are on the correct branch before executing. ```bash inv tag-release --level=(major|minor|patch) ``` -------------------------------- ### Authenticate with Username and Password Source: https://context7.com/nephila/python-taiga/llms.txt Authenticate to Taiga using username and password credentials. This creates a session and initializes all API resources. ```python from taiga import TaigaAPI # Create API instance and authenticate api = TaigaAPI() api.auth(username='myuser', password='mypassword') # Get current user info me = api.me() print(f"Logged in as: {me.full_name}") print(f"Email: {me.email}") ``` -------------------------------- ### Create a Swimlane Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Add a new swimlane to a project. Swimlanes are used to organize tasks and user stories visually on a board. ```python newlane = new_project.add_swimlane('New Swimlane') ``` -------------------------------- ### Retrieve a single page of tasks Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Fetches only the first page of tasks. Be aware that unpaginated results may exceed parser limits. ```python tasks_page_1 = api.tasks.list(page=1) # Will only return page 1 ``` -------------------------------- ### Filter Tasks and Issues Source: https://context7.com/nephila/python-taiga/llms.txt Demonstrates filtering tasks by status and issues by severity, showcasing the versatility of the filter method across different item types. ```python # Works on all list types tasks = api.tasks.list(project=project.id) new_tasks = tasks.filter(status=1) issues = project.list_issues() high_severity = issues.filter(severity=4) ``` -------------------------------- ### Create and Manage Swimlanes Source: https://context7.com/nephila/python-taiga/llms.txt This snippet demonstrates how to create, list, update, and delete swimlanes in a Taiga project. Deleting a swimlane requires specifying where its items should be moved. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Create a swimlane swimlane = project.add_swimlane('Urgent') print(f"Created swimlane: {swimlane.name}") # List swimlanes swimlanes = project.list_swimlanes() for sl in swimlanes: print(f"Swimlane: {sl.name} (order: {sl.order})") # Create user story in swimlane story = project.add_user_story( 'Urgent bug fix', swimlane=swimlane.id ) # Update swimlane swimlane.name = 'Critical' swimlane.order = 1 swimlane.update() # Delete swimlane (requires moving items) swimlane.delete(move_to_id=other_swimlane.id) ``` -------------------------------- ### Specify page size for tasks Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Retrieves a specific number of results from the first page of tasks. Unpaginated results may cause errors. ```python tasks_page_1 = api.tasks.list(page=1, page_size=200) # Will 200 results from page 1 ``` -------------------------------- ### Push Git Tag Source: https://github.com/nephila/python-taiga/blob/master/CONTRIBUTING.rst Push the newly created tag to the remote repository (e.g., GitHub). ```bash git push origin ``` -------------------------------- ### Attach a file to an issue Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Attaches a file with a description to an issue, user story, or task. ```python newissue.attach('README.md', description='Read the README in Issue') ``` -------------------------------- ### Handle Taiga Attachment Errors Source: https://context7.com/nephila/python-taiga/llms.txt Demonstrates catching `TaigaException` which can occur during operations like attaching files, printing the error message. ```python try: # Attachment error story = project.get_userstory_by_ref(42) story.attach('/nonexistent/file.txt') except TaigaException as e: print(f"Taiga error: {e}") ``` -------------------------------- ### Update Changelog Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Run towncrier to automatically generate or update the changelog file. The --yes flag bypasses confirmation prompts. ```bash towncrier --yes ``` -------------------------------- ### Authenticate with Username and Password Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Authenticate to the Taiga API using your username and password. Ensure you have your Taiga credentials ready. ```python from taiga import TaigaAPI api = TaigaAPI() api.auth( username='user', password='psw' ) ``` -------------------------------- ### Create an Issue Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Create a new issue within a project, specifying its title and various attributes like priority, status, type, and severity. This is used for tracking bugs and other problems. ```python newissue = new_project.add_issue( 'New Issue', new_project.priorities.get(name='High').id, new_project.issue_statuses.get(name='New').id, new_project.issue_types.get(name='Bug').id, new_project.severities.get(name='Minor').id, description='Bug #5' ) ``` -------------------------------- ### Custom Host and LDAP Authentication Source: https://context7.com/nephila/python-taiga/llms.txt Connect to a self-hosted Taiga instance with LDAP authentication and optional SSL verification. You can also configure proxies for network access. ```python from taiga import TaigaAPI # Connect to self-hosted Taiga with LDAP api = TaigaAPI( host='https://taiga.mycompany.com', auth_type='ldap', tls_verify=True # Set to False to skip SSL verification ) api.auth(username='ldap_user', password='ldap_password') # Optionally use proxies api_with_proxy = TaigaAPI( host='https://taiga.mycompany.com', proxies={'https': 'http://proxy.mycompany.com:8080'} ) ``` -------------------------------- ### Handle Taiga API Authentication Errors Source: https://context7.com/nephila/python-taiga/llms.txt Demonstrates how to catch and handle `TaigaRestException` during API authentication, printing details about the error. ```python from taiga import TaigaAPI from taiga.exceptions import TaigaException, TaigaRestException api = TaigaAPI() try: # Attempt authentication api.auth(username='user', password='wrong_password') except TaigaRestException as e: print(f"API Error: {e}") print(f"Status Code: {e.status_code}") print(f"URI: {e.uri}") print(f"Method: {e.method}") ``` -------------------------------- ### Update and delete a project Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Modifies the name of an existing project and then deletes it. ```python new_project.name = 'New name for my project' new_project.update() new_project.delete() ``` -------------------------------- ### Add User Story with Milestone Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Create a new user story and associate it with a specific milestone. This requires creating the milestone first and then referencing its ID when adding the user story. ```python jan_feb_milestone = new_project.add_milestone( 'MILESTONE 1', '2015-01-26', '2015-02-26' ) userstory = new_project.add_user_story( 'New Story', description='Blablablabla', milestone=jan_feb_milestone.id ) ``` -------------------------------- ### Application Authentication Source: https://context7.com/nephila/python-taiga/llms.txt Authenticate as an application using OAuth-style flow with encrypted tokens. This method is suitable for server-to-server interactions. ```python from taiga import TaigaAPI api = TaigaAPI(host='https://api.taiga.io') # Authenticate with application credentials api.auth_app( app_id='your-app-id', app_secret='your-app-secret-key', auth_code='authorization-code-from-oauth-flow', state='optional-state-parameter' ) # Application is now authenticated projects = api.projects.list() ``` -------------------------------- ### Configure Authentication Type Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Set a specific authentication type, such as 'ldap', when initializing the TaigaAPI client. This is necessary if your Taiga instance uses a custom authentication backend. ```python from taiga import TaigaAPI api = TaigaAPI( host='http://taiga.my.host.org', auth_type='ldap' ) ``` -------------------------------- ### Duplicate an Existing Project Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Duplicate an existing Taiga project, including most of its settings but excluding user stories and tasks. This is helpful for setting up new projects based on existing templates. ```python old_project = api.projects.get_by_slug('nephila') new_project = old_project.duplicate('TEST PROJECT', 'TESTING API') ``` -------------------------------- ### Create a new branch for development Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md Create a new branch for your bugfix or feature development. This isolates your changes from the main codebase. ```bash git checkout -b name-of-your-bugfix-or-feature ``` -------------------------------- ### Authenticate with Token Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Authenticate to the Taiga API by passing an authentication token directly to the TaigaAPI constructor. This is an alternative to username/password authentication. ```python from taiga import TaigaAPI api = TaigaAPI(token='mytoken') ``` -------------------------------- ### Attach Files to Taiga Items Source: https://context7.com/nephila/python-taiga/llms.txt This code shows how to attach files to various Taiga items like user stories, tasks, issues, epics, and wiki pages. Files can be attached using a file path or a file-like object. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Attach file to user story story = project.get_userstory_by_ref(42) attachment = story.attach( '/path/to/mockup.png', description='UI mockup for login screen' ) print(f"Attached: {attachment.name}") # Attach file to task task = project.get_task_by_ref(100) task.attach('/path/to/notes.txt', description='Meeting notes') # Attach file to issue issue = project.get_issue_by_ref(50) issue.attach('/path/to/screenshot.png', description='Bug screenshot') # Attach file to epic epic = project.get_epic_by_ref(5) epic.attach('/path/to/roadmap.pdf', description='Epic roadmap') # List attachments story_attachments = story.list_attachments() for att in story_attachments: print(f"Attachment: {att.name} - {att.url}") task_attachments = task.list_attachments() issue_attachments = issue.list_attachments() # Attach using file object with open('/path/to/file.txt', 'rb') as f: story.attach(f, description='File from stream') ``` -------------------------------- ### Increment Development Version Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md To increment the development version (e.g., from 1.2.0.dev1 to 1.2.0.dev2), use the inv tag-dev command with the relver level. ```bash inv tag-dev --level=relver ``` -------------------------------- ### Combine Filters for User Stories Source: https://context7.com/nephila/python-taiga/llms.txt Combines multiple filter conditions to retrieve user stories that meet all specified criteria, such as being assigned to a specific user and being blocked. ```python my_blocked = stories.filter(assigned_to=me.id, is_blocked=True) ``` -------------------------------- ### Push Develop Branch Source: https://github.com/nephila/python-taiga/blob/master/CONTRIBUTING.rst Push the updated develop branch to the remote repository after bumping the development version. ```bash git push develop ``` -------------------------------- ### List Tasks Without Pagination Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Retrieve all tasks without using pagination. This forces the API to fetch all results in a single request, which might be less efficient for large datasets. ```python tasks = api.tasks.list(paginate=False) ``` -------------------------------- ### Push Master Branch Source: https://github.com/nephila/python-taiga/blob/master/CONTRIBUTING.rst After a successful pipeline, push the master branch. This step assumes the pipeline is for release validation. ```bash git push master ``` -------------------------------- ### Add a Task to a User Story Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Add a new task to an existing user story. You need to provide the task title and the ID of the task status. ```python userstory.add_task( 'New Task 2', new_project.task_statuses[0].id ) ``` -------------------------------- ### Merge Master into Develop Source: https://github.com/nephila/python-taiga/blob/master/CONTRIBUTING.rst Merge the master branch back into the develop branch to incorporate release changes into the development line. ```bash git merge master ``` -------------------------------- ### Add and Set Custom Issue Attribute Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Add a custom attribute to issues within a project and then set a value for that attribute on a specific issue. This allows for flexible data tracking. ```python new_project.add_issue_attribute( 'Device', description='(iPad, iPod, iPhone, Desktop, etc.)' ) newissue.set_attribute('1', 'Desktop') ``` -------------------------------- ### Define Custom Attributes Source: https://context7.com/nephila/python-taiga/llms.txt This code demonstrates how to add custom attributes to issues, tasks, and user stories in Taiga. These attributes allow for extended data fields specific to your project's needs. ```python from taiga import TaigaAPI api = TaigaAPI(token='your-token') project = api.projects.get_by_slug('my-project') # Create custom attribute for issues issue_attr = project.add_issue_attribute( 'Device', description='Device type affected (iPad, iPhone, Desktop)' ) print(f"Created attribute: {issue_attr.name}") # Create custom attribute for tasks task_attr = project.add_task_attribute( 'Estimated Hours', description='Estimated time in hours' ) # Create custom attribute for user stories story_attr = project.add_user_story_attribute( 'Business Value', description='Business value score (1-10)' ) ``` -------------------------------- ### Filter User Stories by Attributes Source: https://context7.com/nephila/python-taiga/llms.txt Filters user stories based on various attributes like 'is_blocked' or 'is_closed'. ```python blocked_stories = stories.filter(is_blocked=True) closed_stories = stories.filter(is_closed=True) ``` -------------------------------- ### Amend Commit Source: https://github.com/nephila/python-taiga/blob/master/docs/contributing.md After updating the changelog, amend the previous commit to include the changelog changes. This keeps the commit history clean. ```bash git commit --amend ``` -------------------------------- ### Disable SSL Certificate Verification Source: https://github.com/nephila/python-taiga/blob/master/docs/usage.md Disable SSL certificate verification for the TaigaAPI client. Use this with caution, as it can expose your connection to security risks. It's typically used for development or internal networks with self-signed certificates. ```python from taiga import TaigaAPI api = TaigaAPI( host='http://taiga.my.host.org', tls_verify=False ) ``` -------------------------------- ### Token Refresh Source: https://context7.com/nephila/python-taiga/llms.txt Refresh an expired authentication token without re-entering credentials. This uses a stored refresh token or a provided specific refresh token. ```python from taiga import TaigaAPI api = TaigaAPI() api.auth(username='user', password='pass') # Later, refresh the token api.refresh_token() # Uses stored refresh token # Or provide a specific refresh token api.refresh_token(token_refresh='your-refresh-token') ``` -------------------------------- ### Delete a Comment Source: https://context7.com/nephila/python-taiga/llms.txt Deletes a specific comment from a user story's history using the resource ID and comment ID. ```python api.history.user_story.delete_comment( resource_id=story.id, comment_id='comment-uuid-here' ) ``` -------------------------------- ### Undelete a Comment Source: https://context7.com/nephila/python-taiga/llms.txt Undeletes a previously deleted comment from a user story's history. ```python api.history.user_story.undelete_comment( resource_id=story.id, comment_id='comment-uuid-here' ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.