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

Removing global configurations #10

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6026585
Use `micromamba run` instead of `conda run`
yamaton Aug 5, 2022
0d76b29
Ensure micromamba in `condax repair`
yamaton Aug 5, 2022
04ac843
Add option to hide exit code of wrappers
yamaton Aug 5, 2022
b1da453
Improve handling of config values slightly
yamaton Aug 5, 2022
c4d95b4
Update README
yamaton Aug 6, 2022
399fa83
Hotfix conda download url base
yamaton Aug 6, 2022
3b90207
Add `condax --version`
yamaton Aug 6, 2022
8a59a30
Bump to 0.1.0
yamaton Aug 6, 2022
0d6b42a
Show message to `condax ensure-path` even when it's already good
yamaton Aug 8, 2022
45f8500
Update README
yamaton Aug 6, 2022
a8c6ca5
Add filtering when scanning over conda envs
yamaton Aug 9, 2022
ce6e950
Improve an error message
yamaton Aug 9, 2022
2e7a0b6
Fix `condax update` to properly update links and metadata file
yamaton Aug 9, 2022
262c406
Say no update when that's the case
yamaton Aug 9, 2022
6bfd394
Lint with black
yamaton Aug 9, 2022
38e71e9
Add `condax update --update-specs`
yamaton Aug 9, 2022
83d59b8
Refactor slightly
yamaton Aug 9, 2022
a461cbb
Hotfix condax update
yamaton Aug 9, 2022
1486cb7
Add test cases of `condax update`
yamaton Aug 9, 2022
8a544af
Resolve that `conda update` does not take version specs
yamaton Aug 9, 2022
f5a12d4
Set default channels via ~/.mambarc and ~/.condarc
yamaton Aug 9, 2022
298a635
Fix conda and micromamba setups for windows 64 bit
yamaton Aug 9, 2022
ac8a32a
Don't use micromamba on windows for now
yamaton Aug 9, 2022
c5e2f21
Revert "Don't use micromamba on windows for now"
yamaton Aug 9, 2022
cceacdc
Reinstall micromamba in `condax repair`
yamaton Aug 9, 2022
63de742
Bump to 0.1.1
yamaton Aug 10, 2022
0622dfd
Add comments
yamaton Aug 11, 2022
1c2791d
Remove an unused github action from the original
yamaton Aug 12, 2022
342c398
Tidy up logging and errors
abrahammurciano Aug 12, 2022
303ddef
poetry
abrahammurciano Aug 12, 2022
1d834f2
Tidied up cli (#9)
abrahammurciano Aug 15, 2022
a2a466e
WIP: Refactoring install command
abrahammurciano Aug 15, 2022
8ea8254
metadata serialization
abrahammurciano Aug 20, 2022
b886fde
WIP: Refactoring remove command
abrahammurciano Aug 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .flake8

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/pre-commit.yml

This file was deleted.

21 changes: 6 additions & 15 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,21 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

# - name: Lint with flake8
# run: |
# pip install flake8
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pip install poetry
poetry install

- name: Test with pytest
run: |
pip install pytest
pytest
poetry run pytest

- name: Install condax
run: |
pip install .
condax ensure-path
poetry run condax ensure-path
mkdir -p "${HOME}/.local/bin"

- name: Install black via condax
run: |
condax install black
poetry run condax install black

- name: Run black --help
run: |
Expand All @@ -56,4 +47,4 @@ jobs:

- name: Remove black from condax environments
run: |
condax remove black
poetry run condax remove black
18 changes: 0 additions & 18 deletions .pre-commit-config.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

40 changes: 27 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,63 @@

## What is this?

`condax` is a package manager exclusively for installing commands from conda distribution channels. `condax` frees you from activating and deactivating conda environments while keeping programs in separate environments.
`condax` is a package manager exclusively for installing commands. `condax`, built on top of `conda` variants, frees you from activating and deactivating conda environments while keeping programs in separate environments.

`condax` was originally developed by [Marius van Niekerk ](https://github.com/mariusvniekerk/condax). I'm adding features here after the version 0.0.5.
`condax` was originally developed by [Marius van Niekerk ](https://github.com/mariusvniekerk/condax). More features have been added here after the version 0.0.5.


## Examples

Here is how to install `node`, and execute it.
Here is how you can install `node`. You can just execute it without activating its associated environment. `node` still lives in its own environment so there is no worry about dependencies.

```shell
condax install nodejs

# Then node is ready to run.
node --version
```

This operation is equivalent to the following; `condax` just keeps track of conda environments for commands.
There is no magic about the operation, and you can even do the same without having `condax`; the trick is to use `conda run` (or `micromamba run`) which is effectively sandwitching a command with `conda activate` and `conda deactivate`.

```shell
conda env create -c conda-forge -n nodejs nodejs
conda run -n nodejs 'node --version'
# Create an environent `nodejs`.
mamba env create -c conda-forge -n nodejs nodejs

# Run `node --verion` within the nodejs environment.
micromamba run -n nodejs node --version
```

## How to install `condax`
`condax` just creates scripts like this, by default in `~/.local/bin`, and manages them together with conda environments. It's simple, yet quite convenient when you deal with many commands from conda channels. (I'm looking at you, [`bioconda`](https://bioconda.github.io/) users 🤗.)


## How to install and setup `condax`

Use `pip` or `pipx` to install directly from this repository.

```
```shell
$ pip install git+https://github.com/yamaton/condax

# Or, pipx install git+https://github.com/yamaton/condax if pipx is available.
```

Then add `~/.local/bin` to your `$PATH` if not done already. This command will modify shell configuration. You may skip this if you manage `$PATH` by yourself.

```shell
condax ensure-path
```


## Changes since the original [`condax 0.0.5`](https://github.com/mariusvniekerk/condax/)

- Supports `condax list` to display installed executables.
- Uses `mamba` internally if available.
- Uses `mamba` to manipulate environments if available.
- Uses `micromamba` to run commands.
- Supports installing a package with version constraints, like `condax install ipython=8.3`.
- See [package match specifications](https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/pkg-specs.html#package-match-specifications) for the detail.
- Supports injecting/uninjecting packages onto/from an existing environment.
- Supports configuring via environment variables, or by passing a config file.
- Supports exporting and importing conda environments (only the ones managed by `condax`).
- Internally, this fork creates scripts calling `conda run` instead of creating symbolic links.
- Supports exporting and importing condax environments for reproducibility.
- Internally, this fork creates scripts calling `micromamba run` instead of creating symbolic links.
- ➡️ Solves [the issue](https://github.com/mariusvniekerk/condax/issues/13) with non-Python packages
- Follows [XDG Base Directory Specification](https://stackoverflow.com/questions/1024114/location-of-ini-config-files-in-linux-unix) for directory and file locations:
- Environments are created in `~/.local/share/condax/envs`. (Previously `~/.condax`.)
Expand All @@ -53,14 +68,13 @@ $ pip install git+https://github.com/yamaton/condax

## Known issues

- ``ERROR conda.cli.main_run:execute(49): `conda run XXX` failed (see above for error)`` appears whenever a command returns a nonzero exit code.
- Support of Windows platform is imperfect, though it should work fine on WSL.


## Migrating environments from `condax` v0.0.5

This forked version has changed the locations of the environments and the config file. If you have already installed packages with the original `condax`, please run the following, just once, to sort out.

```bash
```shell
condax repair --migrate
```
Binary file added assets/conx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions assets/conx.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion condax/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
__version__ = "0.0.6"
import sys


if sys.version_info >= (3, 8):
import importlib.metadata as _metadata
else:
import importlib_metadata as _metadata

__version__ = _metadata.version(__package__)
Loading