Skip to content

Commit

Permalink
Merge branch 'main' into docusaurus
Browse files Browse the repository at this point in the history
  • Loading branch information
pavithraes committed Aug 10, 2023
2 parents c49d3a5 + f0a541b commit 64dccfb
Show file tree
Hide file tree
Showing 17 changed files with 300 additions and 36 deletions.
7 changes: 0 additions & 7 deletions .github/ISSUE_TEMPLATE/bug-report.md

This file was deleted.

84 changes: 84 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Bug report 🐛"
description: "Create a report to help us fix something that is currently broken."
title: "[BUG] - <title>"
labels: ["type: bug 🐛"]

body:
- type: markdown
attributes:
value: |
# Welcome 👋
Thanks for using conda-store and taking some time to contribute to this project.
Please fill out each section below. This info allows maintainers to diagnose (and fix!) your issue as
quickly as possible.
Before submitting a bug, please make sure the issue hasn't been already addressed by searching through
the past issues in this repository.
- type: textarea
attributes:
label: Describe the bug
description: |
A clear and concise description of what the bug is.
We suggest using bullets (indicated by * or -).
placeholder: Be as precise as you can.
validations:
required: true

- type: textarea
attributes:
label: Expected behavior
description: |
A clear and concise description of what you expected to happen.
We suggest using bullets (indicated by * or -).
validations:
required: true

- type: textarea
attributes:
label: How to Reproduce the problem?
description: |
Please provide a minimal code example to reproduce the error.
Be as succinct as possible, and provide detailed step by step guidelines to reproduce the bug (using numbered items).
If you have created a GitHub gist, you can paste the link in this box instead.
validations:
required: true

- type: textarea
attributes:
label: Output
description: |
Provide the output of the steps above, including screenshots and any tracebacks/logs.
Please also ensure that the "How to reproduce the problem?" section contains matching
instructions for reproducing this.
validations:
required: false

- type: textarea
attributes:
label: Versions and dependencies used.
description: |
Describe your environment:
- Conda version (use `conda --version`)
- Operating system
- Node version
- Dependencies installed and their version
validations:
required: false

- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false

- type: markdown
attributes:
value: >
Thanks for contributing 🎉!
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: conda-store documentation
url: https://conda.store/en/latest/
about: Check out the conda-store documentation
- name: conda-store issue tracker
about: Did you find a bug or want to make a suggestion? Open an issue on our tracker.
url: https://https://github.com/conda-incubator/conda-store/issues/new/choose
5 changes: 0 additions & 5 deletions .github/ISSUE_TEMPLATE/feature-request.md

This file was deleted.

39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Feature request"
description: "Create a feature request to help us improve"
title: "[ENH] - <title>"
labels: ["type: enhancement 💅"]

body:
- type: markdown
attributes:
value: |
# Welcome 👋
Thanks for using conda-store and taking some time to contribute to this project.
- type: textarea
attributes:
label: Feature description
description: |
Describe what you are proposing. Provide as much context as possible and link to related issues and/or pull requests.
This section should contain "what" you are proposing.
Are you having any problems? Briefly describe what your painpoints are. For example: "I'm always frustrated when ..."
validations:
required: true

- type: textarea
attributes:
label: Value and/or benefit
description: |
What is the value in adding this feature, and who will benefit from it? Include any information that could help us prioritize the issue.
This section should contain "why" this issue should be resolved.
validations:
required: true

- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/general-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "General issue 💡"
description: "A general template for many kinds of issues."
title: "<title>"
labels: ["type: question 🤔"]

body:
- type: markdown
attributes:
value: |
# Welcome 👋
Thanks for using conda-store and taking some time to contribute to this project.
Please fill out each section below. This info allows maintainers to diagnose (and fix!) your issue as
quickly as possible.
Before submitting a bug, please make sure the issue hasn't been already addressed by searching through
the past issues in this repository.
- type: textarea
attributes:
label: Context
description: |
Describe what you are proposing. Provide as much context as possible and link to related issues and/or pull requests.
This section should contain "what" you are proposing.
Are you having any problems? Briefly describe what your pain points are.
validations:
required: true

- type: textarea
attributes:
label: Value and/or benefit
description: |
What is the value of adding this feature, and who will benefit from it? Include any information that could help us prioritize the issue.
This section should contain "why" this issue should be resolved.
validations:
required: true

- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
22 changes: 22 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Fixes # .
<!-- Reference the issue corresponding to this PR. If an issues does not exist, consider opening one or writing a detailed descrition for what this PR changes and it's value in the following sections. -->
<!-- GitHub Docs on Keywords: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests -->

## Description
<!-- What is the purpose of this pull request? -->

This pull request:

- a
- b
- c

## Pull request checklist
<!-- Quick checklist to ensure high-quality Pull Request. -->

- [ ] Did you test this change locally?
- [ ] Did you update the documentaion (if required)?
- [ ] Did you add/update relevant tests for this change (if required)?

## Additional information
<!-- Do you have any other information about this pull request? This may include screenshots, references, and/or implementation notes. -->
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2

conda:
environment: conda-store-server/environment-dev.yaml
environment: docs/environment-docs.yml
12 changes: 11 additions & 1 deletion conda-store-server/conda_store_server/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import uvicorn
from fastapi import FastAPI, Request, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import RedirectResponse, JSONResponse
from fastapi.responses import RedirectResponse, JSONResponse, FileResponse
from fastapi.staticfiles import StaticFiles
from starlette.middleware.sessions import SessionMiddleware
from fastapi.templating import Jinja2Templates
Expand Down Expand Up @@ -297,6 +297,16 @@ async def http_exception_handler(request, exc):
def redirect_home(request: Request):
return RedirectResponse(request.url_for("get_conda_store_ui"))

@app.get("/favicon.ico", include_in_schema=False)
async def favicon():
return FileResponse(
os.path.join(
os.path.dirname(conda_store_server.server.__file__),
"static",
"favicon.ico",
)
)

if self.enable_metrics:
app.include_router(
views.router_metrics,
Expand Down
Binary file not shown.
50 changes: 29 additions & 21 deletions conda-store/conda_store/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import yarl

from conda_store import auth, exception
from conda_store import auth, exception, utils


class CondaStoreAPIError(exception.CondaStoreError):
Expand Down Expand Up @@ -49,7 +49,7 @@ async def __aexit__(self, exc_type, exc, tb):
async def get_paginated_request(self, url: yarl.URL, max_pages=None, **kwargs):
data = []

async with self.session.get(url) as response:
async with self.session.get(utils.ensure_slash(url)) as response:
response_data = await response.json()
num_pages = math.ceil(response_data["count"] / response_data["size"])
data.extend(response_data["data"])
Expand All @@ -58,13 +58,17 @@ async def get_paginated_request(self, url: yarl.URL, max_pages=None, **kwargs):
num_pages = min(max_pages, num_pages)

for page in range(2, num_pages + 1):
async with self.session.get(url % {"page": page}) as response:
async with self.session.get(
utils.ensure_slash(url % {"page": page})
) as response:
data.extend((await response.json())["data"])

return data

async def get_permissions(self):
async with self.session.get(self.api_url / "permission") as response:
async with self.session.get(
utils.ensure_slash(self.api_url / "permission")
) as response:
return (await response.json())["data"]

async def create_token(
Expand All @@ -81,26 +85,26 @@ async def create_token(
"exp": expiration or current_permissions["expiration"],
}
async with self.session.post(
self.api_url / "token", json=requested_permissions
utils.ensure_slash(self.api_url / "token"), json=requested_permissions
) as response:
if response.status == 400:
raise CondaStoreAPIError((await response.json())["message"])

return (await response.json())["data"]["token"]

async def list_namespaces(self):
return await self.get_paginated_request(self.api_url / "namespace")
return await self.get_paginated_request(self.api_url / "namespace" / "")

async def create_namespace(self, namespace: str):
async with self.session.post(
self.api_url / "namespace" / namespace
utils.ensure_slash(self.api_url / "namespace" / namespace)
) as response:
if response.status != 200:
raise CondaStoreAPIError(f"Error creating namespace {namespace}")

async def delete_namespace(self, namespace: str):
async with self.session.delete(
self.api_url / "namespace" / namespace
utils.ensure_slash(self.api_url / "namespace" / namespace)
) as response:
if response.status != 200:
raise CondaStoreAPIError(f"Error deleting namespace {namespace}")
Expand All @@ -117,7 +121,7 @@ async def list_environments(self, status: str, artifact: str, packages: List[str

async def delete_environment(self, namespace: str, name: str):
async with self.session.delete(
self.api_url / "environment" / namespace / name
utils.ensure_slash(self.api_url / "environment" / namespace / name)
) as response:
if response.status != 200:
raise CondaStoreAPIError(
Expand All @@ -126,7 +130,7 @@ async def delete_environment(self, namespace: str, name: str):

async def create_environment(self, namespace: str, specification: str):
async with self.session.post(
self.api_url / "specification",
utils.ensure_slash(self.api_url / "specification"),
json={
"namespace": namespace,
"specification": specification,
Expand All @@ -143,7 +147,7 @@ async def create_environment(self, namespace: str, specification: str):

async def get_environment(self, namespace: str, name: str):
async with self.session.get(
self.api_url / "environment" / namespace / name
utils.ensure_slash(self.api_url / "environment" / namespace / name)
) as response:
if response.status != 200:
raise CondaStoreAPIError(
Expand All @@ -156,13 +160,15 @@ async def solve_environment(
self, channels: List[str], conda: List[str], pip: List[str]
):
async with self.session.get(
self.api_url
/ "specification"
% {
"channels": channels,
"conda": conda,
"pip": pip,
}
utils.ensure_slash(
self.api_url
/ "specification"
% {
"channels": channels,
"conda": conda,
"pip": pip,
}
)
) as response:
return (await response.json())["solve"]

Expand All @@ -177,15 +183,17 @@ async def list_builds(self, status: str, artifact: str, packages: List[str]):
return await self.get_paginated_request(url)

async def get_build(self, build_id: int):
async with self.session.get(self.api_url / "build" / str(build_id)) as response:
async with self.session.get(
utils.ensure_slash(self.api_url / "build" / str(build_id))
) as response:
if response.status != 200:
raise CondaStoreAPIError(f"Error getting build {build_id}")

return (await response.json())["data"]

async def download(self, build_id: int, artifact: str) -> bytes:
url = self.api_url / "build" / str(build_id) / artifact
async with self.session.get(url) as response:
url = self.api_url / "build" / str(build_id) / artifact / ""
async with self.session.get(utils.ensure_slash(url)) as response:
if response.status != 200:
raise CondaStoreAPIError(f"Error downloading build {build_id}")

Expand Down
Loading

0 comments on commit 64dccfb

Please sign in to comment.