Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to create environment from lockfile #772

Merged
merged 32 commits into from
May 1, 2024

Conversation

nkaretnikov
Copy link
Contributor

@nkaretnikov nkaretnikov commented Mar 3, 2024

Fixes #676.

Description

This pull request:

  • adds a way to create an environment from a lockfile
  • adds a test.

Pull request checklist

  • Did you test this change locally?
  • Did you update the documentation (if required)?
  • Did you add/update relevant tests for this change (if required)?

Additional information

  • conda-store-ui will need to be extended to support this feature because it has its own YAML parser
  • I didn't add documentation for this reason as well. Despite being in this repo, most of our docs are about conda-store-ui. I think it needs to be implemented on the UI side before we document it in user-visible docs, otherwise it'll be confusing.

How to test

Automated testing

  • Run the server via docker:
docker compose up --build
  • Once the server is running, the following command should succeed:
pytest -rfxs tests/test_api.py::test_create_lockfile_specification_auth -vvv --capture=no

Manual testing

  • Submit a specification like the following:
Screen Shot 2024-03-04 at 04 26 22
  • A whitespace-sensitive version is also accepted:
Screen Shot 2024-03-04 at 04 07 34
  • Do not forget to click on the checkbox

  • The keys are: name, description, and lockfile. conda-store requires that a specification has a name, which is why this wraps an upstream conda-lock lockfile format instead of passing it directly as a specification. From conda-store-server/conda_store_server/schema.py:

class LockfileSpecification(BaseModel):
    name: constr(regex=f"^[{ALLOWED_CHARACTERS}]+$")  # noqa: F722
    description: Optional[str] = ""
    lockfile: Lockfile
class Lockfile(StrictModel):
    version: ClassVar[int] = 1

    package: List[LockedDependency]
    metadata: LockMeta

Copy link

netlify bot commented Mar 3, 2024

Deploy Preview for conda-store canceled.

Name Link
🔨 Latest commit d7b721f
🔍 Latest deploy log https://app.netlify.com/sites/conda-store/deploys/6631b24c95062600082ddb01

@nkaretnikov nkaretnikov force-pushed the lockfile-envs-676 branch 2 times, most recently from 5caa45a to 3cebcb4 Compare March 4, 2024 07:56
@nkaretnikov

This comment was marked as resolved.

@nkaretnikov
Copy link
Contributor Author

@jaimergp A gentle reminder that this needs review.

Copy link
Member

@jaimergp jaimergp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this live, but I already have a few comments about the initial implementation. See inlines for more details, but to sum up:

  • Use dropdown menu instead of a checkbox
  • Don't push data model abstractions to the UI (the user should not need to manipulate their lockfile when copy-pasting). Instead, add extra fields as needed.
  • constructor does support explicit.txt lockfiles which can be easily generated from the conda-lock.yml.

@nkaretnikov nkaretnikov force-pushed the lockfile-envs-676 branch from c9bbf34 to 6bb3ae8 Compare May 1, 2024 02:51
@nkaretnikov nkaretnikov merged commit b40b7e3 into conda-incubator:main May 1, 2024
27 checks passed
peytondmurray pushed a commit to peytondmurray/conda-store that referenced this pull request May 4, 2024
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api 🌐 area: user experience 👩🏻‍💻 Items impacting the end-user experience project: JATIC Work item needed for the JATIC project type: enhancement 💅🏼
Projects
Status: Done 💪🏾
Development

Successfully merging this pull request may close these issues.

[ENH] - Add ability to create environment from lockfile
2 participants