Skip to content

Commit

Permalink
Merge pull request #117 from zuzukin/multi-install
Browse files Browse the repository at this point in the history
Multiple changes
  • Loading branch information
analog-cbarber authored Jan 8, 2024
2 parents e64c0b4 + e50181c commit 16eb2e1
Show file tree
Hide file tree
Showing 35 changed files with 1,352 additions and 239 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ jobs:
- name: Dev install whl2conda
run: |
conda run -n whl2conda-dev pip install -e . --no-deps --no-build-isolation
- name: ruff
run: |
make ruff
- name: pylint
if: success() || failure()
run: |
make pylint
- name: mypy
if: success() || failure()
run: |
make mypy
- name: check black formatting
- name: check formatting
if: success() || failure()
run: |
make black-check
make check-format
- name: Test with pytest
if: success() || failure()
run: |
Expand Down
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# whl2conda changes

## [24.1.0] - *in progress*

### Features
* Add `whl2conda build` - limited experimental drop-in replacement for `conda build`
* Support translation of `~=` and `===` version specification operators.
* `whl2conda install` now supports installing multiple package files at once

### Bug fixes
* Use classic installer in `whl2conda install` environments to work around conda bug (#114)
* Include project URLs in metadata that have multi-word keys (#113)
* Write METADATA file in dist-info using UTF8 (#112)

## [23.9.0] - 2023-9-23

* First official stable release
Expand Down
11 changes: 10 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 Christopher Barber
Copyright 2023-2024 Christopher Barber

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -199,3 +199,12 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

## Additional licenses

This source code incorporates some code taken from other projects
with compatible licenses, specifically:

* https://github.com/conda/conda/blob/main/conda/models/version.py (BSD-3)


15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ help:
"--- testing ---\n" \
"pylint - run pylint checks\n" \
"mypy - run mypy type checks\n" \
"black-check - check black formatting\n" \
"check-format - check formatting\n" \
"lint - run all lint checkers\n" \
"pytest - run pytests\n" \
"ruff - run ruff checker\n" \
"coverage - run pytests with test coverage\n" \
"open-coverage - open HTML coverage report\n" \
"\n" \
Expand Down Expand Up @@ -90,20 +91,26 @@ dev-install:
# Test and lint targets
#

black-check:
$(CONDA_RUN) black --check src test
# backward support - just use ruff-format-check instead
black-check: check-format

pylint:
$(CONDA_RUN) pylint src test

mypy:
$(CONDA_RUN) mypy

lint: pylint mypy black-check
lint: ruff pylint mypy black-check

pytest:
$(CONDA_RUN) pytest -s test

ruff:
$(CONDA_RUN) ruff check

check-format:
$(CONDA_RUN) ruff format --check src test

test: pytest

coverage:
Expand Down
4 changes: 1 addition & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ def pytest_configure(config):
config.addinivalue_line(
"markers", "external: mark test as depending on extenral pypi package to run"
)
config.addinivalue_line(
"markers", "slow: mark test as slow to run"
)
config.addinivalue_line("markers", "slow: mark test as slow to run")


def pytest_collection_modifyitems(config, items):
Expand Down
38 changes: 7 additions & 31 deletions doc/guide/limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,14 @@ into noarch python conda packages.
It has the following limitations and known issues, some of which
will be addressed in future releases.

## Version specifiers are not translated

Version specifiers in dependencies are simply copied from
the wheel without modification. This works for many cases,
but since the version comparison operators for pip and conda
are slightly different, some version specifiers will not work
properly in conda. Specifically,

* the *compatible release* operator `~=` is not supported by conda.
To translate, use a double expression with `>=` and `*`, e.g.:
`~= 1.2.3` would become `>=1.2.3,1.2.*` in conda. This form is
also supported by pip, so switching to this format is a viable
workaround for packages under your control.

* the *arbitrary equality* clause `===` is not supported by conda.
I do not believe there is an equivalent to this in conda, but
this clause is also heavily discouraged in dependencies and
might not even match the corresponding conda package.

(*There are other operations supported by conda but not pip, but
the are not a concern when translating from pip specifiers.*)

As a workaround, users can switch to compatible specifier syntax when
possible and otherwise can remove the offending package and add it
back with compatible specifier syntax, e.g.:

```bash
whl2conda mywheel-1.2.3-py3-none-any.whl -D foo -A 'foo >=1.2.3,1.2.*'
```
## Arbitrary equality clause in version specifiers don't have a coda equivalent

The *arbitrary equality* clause `===` is not supported by conda
and there is no equivalent. This clause is also heavily discouraged
in dependencies and probably will not occur that often in practice.

This will be fixed in a future release
(see [issue 84](https://github.com/zuzukin/whl2conda/issues/84)).
We handle this by simplying changinge `===` to `==` but
since this will often not work we also issue a warning.

## Wheel data directories not supported

Expand Down
16 changes: 14 additions & 2 deletions doc/guide/testing.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Installing into a test environment

You will probably want to test your generated conda package before deploying
You will probably want to test your generated conda packages before deploying
it. Currently, `conda install` only supports installing conda package files
without their dependencies, so `whl2conda` provides an `install` subcommand
to install a package into a test environment along with its dependencies:
to install one or more package files into a test environment along with its dependencies:

```bash
$ whl2conda install mypackage-1.2.3-py_0.conda -n test-env
Expand All @@ -24,6 +24,18 @@ $ whl2conda install mypackage-1.2.3-py_0.conda \
--extra pytest -c my-channel
```

If you are building multiple packages with an interdependency you should install
them in a single install command, e.g.:

```bash
$ whl2conda install mypackage-1.2.3-py_0.conda mycorepackage-1.2.3-py_0.conda ...
```

**NOTE**: *in order to work around an [issue](https://github.com/conda/conda/issues/13479)
with conda install when using the default libmamba solver, `whl2conda install` will
configure the target environment to use the classic solver, which can result in slower installs.
If this is a problem, you can instead use mamba.*

## Installing into conda-bld

Once you are done testing, you may either upload your package to a
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

## pyproject.toml metadata format:

* [Current specification](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/)
* [Current specification](https://packaging.python.org/en/latest/specifications/pyproject-toml/)
* [PEP 621](https://peps.python.org/pep-0621/)
* [PEP 639](https://peps.python.org/pep-0639/) - license files
* [PEP 725](https://peps.python.org/pep-0725/) - external dependencies
Expand Down
17 changes: 9 additions & 8 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,28 @@ dependencies:
# runtime
- conda-package-handling >=2.2,<3.0
- platformdirs >=3.10
- pyyaml
- pyyaml >=6.0
- tomlkit >=0.12
- wheel >=0.41
# build
- build >=0.7.0
- hatchling >=1.18,<2.0
- hatchling >=1.21,<2.0
- make >=4.3
# testing
- mypy >=1.5,<2.0
- pylint >=2.17
- mypy >=1.8,<2.0
- pylint >=3.0,<4.0
- pytest >=7.4,<8.0
- pytest-cov >=4.1.0,<5.0
- ruff >=0.1.11
- types-pyyaml >=6.0
# documentation
- black >=22.6
- black >=23.12
- mike >=1.1,<2.0
- mkdocs >=1.5,<2.0
- mkdocstrings-python >=1.3,<2.0
- mkdocstrings-python >=1.7,<2.0
- mkdocs-material >9.1
- mkdocstrings-python-xref >=1.5.2,<2.0
- linkchecker >=10.2.1
- mkdocstrings-python-xref >=1.5.3,<2.0
- linkchecker >=10.4
# for mkdocs-awesome-pages-plugin
- natsort >=8.4
- wcmatch >=8.5
Expand Down
18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ module = [
]
ignore_missing_imports = true

[tool.pylint.main]
ignore-paths=['^src/whl2conda/external/.*$']

[tool.pylint.build_main]
jobs = 0 # enable parallel checks
py-version = "3.8" # min python version
Expand Down Expand Up @@ -106,6 +109,7 @@ disable = [
"file-ignored",
"fixme",
"invalid-name",
"line-too-long",
"locally-disabled",
"raw-checker-failed",
"suppressed-message",
Expand All @@ -117,3 +121,17 @@ disable = [
"useless-suppression",
"wrong-import-order"
]

[tool.ruff]
line-length = 88
exclude = [
"src/whl2conda/external"
]

[tool.ruff.format]
line-ending = "lf"
preview = true
quote-style = "preserve"

[tool.ruff.lint.pydocstyle]
convention = "google"
3 changes: 1 addition & 2 deletions src/whl2conda/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
23.9.0

24.1.0
1 change: 1 addition & 0 deletions src/whl2conda/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Main module allows invocation using `python -m whl2conda`
"""

from .cli.main import main

if __name__ == "__main__": # pragma: no cover
Expand Down
Loading

0 comments on commit 16eb2e1

Please sign in to comment.