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

support for user settings #146

Merged
merged 31 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a23b6d2
Move conftest.py into test/ subdir
analog-cbarber Apr 22, 2024
9c3de73
Initial support for persistent user settings (#58)
analog-cbarber Apr 22, 2024
022db41
Cleanup and document settings API (#58)
analog-cbarber Apr 22, 2024
b7417bf
Conditionalize kw_only dataclass arg by python version
analog-cbarber Apr 22, 2024
f75ce89
dict -> Dict for python 3.8 type annotation
analog-cbarber Apr 22, 2024
e6234a6
Add type annotation for mypy
analog-cbarber Apr 22, 2024
05becc2
Fix external sphinx test
analog-cbarber Apr 22, 2024
5c3b844
Test for auto-update stdrenames settings and options
analog-cbarber Apr 26, 2024
d1f9e28
Update stdrenames
analog-cbarber Apr 26, 2024
2fd6c8a
Test default conda format from settings
analog-cbarber May 1, 2024
60bfd80
Test default conda format from settings
analog-cbarber May 1, 2024
15a3a3a
Test pypi index alias lookup
analog-cbarber May 1, 2024
8e2ed3c
Update VERSION/CHANGELOG to 24.5.0
analog-cbarber May 4, 2024
f614c1c
tweaks to settings:
analog-cbarber May 4, 2024
e86ac2b
Improve config settings command line options
analog-cbarber May 4, 2024
b07da60
Add api doc for settings module
analog-cbarber May 4, 2024
f7da3c9
Settings documentation
analog-cbarber May 4, 2024
bb3a5f8
Test config settings options
analog-cbarber May 4, 2024
5699e92
don't use is_relative_to in test (not in python 3.8)
analog-cbarber May 4, 2024
ac9c3f5
try to fix config test
analog-cbarber May 4, 2024
72300f3
another try to fix config test
analog-cbarber May 4, 2024
8c34850
another try to fix config test
analog-cbarber May 4, 2024
4602143
Release procedure documentation (#27)
analog-cbarber May 5, 2024
545f73d
Update stderenames table
analog-cbarber May 5, 2024
e91a91a
fix docstring formatting
analog-cbarber May 5, 2024
4a2e004
Do not include internal doc in doc build
analog-cbarber May 5, 2024
f18089a
Update 24.5.0 release date
analog-cbarber May 5, 2024
7852a2b
Add doc deploy to release process
analog-cbarber May 5, 2024
2711736
Update mike version
analog-cbarber May 5, 2024
90d4977
Tweak a few PEP links
analog-cbarber May 5, 2024
ae38f35
Add a TODO to the Makefile
analog-cbarber May 5, 2024
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: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# whl2conda changes

## [24.5.0] - 2024-5-5
### Features
* Added persistent user settings for:
* default conda format
* whether to automatically update stdrenames table
* specify aliases for extra pypi indexes

## [24.4.0] - 2024-4-14
### Changes
* Only use classic installer in `whl2conda install` environments if
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ html-coverage: htmlcov/index.html
open-coverage: htmlcov/index.html
$(OPEN) $<

# TODO-
# add target for running tests on built wheel or conda package
# use tox?
# Needs test dependencies: pytest, build, hatchling

#
# Documentation targets
#
Expand Down
23 changes: 23 additions & 0 deletions doc/guide/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ to do this download for you, for example:
$ whl2conda convert --from-pypi 'some-package ==1.2.3'
```

The `--from-index` option expects either the full URL of the pypi index to
download from or an alias, which may either be taken from a repository entry
in your [~/.pypirc][pypirc] file or from an entry in the users persistent
whl2conda configuration. For instance, you could register a new index using
a command like:

```bash
$ whl2conda config --set pypi-index.myindex https://myindex.com/pypi/
```
and then convert using:

```bash
$ whl2conda convert --from-index myindex 'some-package'
```

## Building from project directories

If you are creating a conda package for your own python project that uses
Expand Down Expand Up @@ -85,11 +100,19 @@ Reading mypackage-1.2.3-py3-none-any.whl
Writing mypackage-1.2.3-py_0.tar.bz2
```

You can change the default output format through a persistent user setting, .e.g:

```bash
$ whl2conda config --set conda-format V1
```

You can also specify the format `tree` to generate the conda package
as a directory tree, so that you can examine its contents for
debugging purposes.

[pip-download]: https://pip.pypa.io/en/stable/cli/pip_download/
[pip-wheel]: https://pip.pypa.io/en/stable/cli/pip_wheel/
[pypi]: https://pypi.org
[pypirc]: https://packaging.python.org/en/latest/specifications/pypirc/


7 changes: 7 additions & 0 deletions doc/guide/renaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ there is package new to [conda-forge] that may have appeared since installing
$ whl2conda --update-std-renames
```

You can also configure whl2conda to automatically update the standard rename
mappings prior to operations that require via a persistent user setting:

```bash
$ whl2conda config --set auto-update-std-renames true
```

The cache file is kept in a location in your user directory that is specific
to your operating system:

Expand Down
89 changes: 89 additions & 0 deletions doc/internal/release-process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# whl2conda release process

The release process is currently entirely manual:

## Prerequistes

* [ ] Tests should be added for all new features or changed behavior.
* [ ] All tests must pass locally and in CI jobs.
* [ ] Significant changes should be described in `CHANGELOG.md`
* [ ] New features and changes must be documented.

## Release procedure

### Package release

1. Update version in `src/whl2conda/VERSION`.

We use calver scheme of the form `YY.M.<patch>`, so the first release
in June 2024 would be `24.6.0`. Increment the last number if there already
was a release in the month. It may be surprising to users to see signficant
changes introduced in a patch release, so it probably is best to delay such
releases to the next month.

2. Update the checked in copy of the standard renames table:

```bash
$ make update-std-rename
```

commit the changed `src/whl2conda/api/stdrename.json` file.

3. After all changes have been merged, check out `main` branch.

4. Build wheel and conda package

```bash
$ make build-wheel
```
5. Test built packages (*optional but recommended*)

Test the generated wheel and conda package by installing locally and
testing manually or by running `pytest test` in environment with installed
package.

6. When everything is ok, upload to pypi:

```bash
$ make check-upload
$ make upload
```

This assumes that you have permission to upload and have configured a token
in you `~/.pypirc`.

7. Watch for and accept merge request from conda-forge

Sometime after the pypi upload, the whl2conda-feedstock on conda-forge
will get an automatically generated merge request, and feedstock maintainers
will get a notification. Usually this happens within a day of the pypi upload.

If there are no breaking runtime dependencies, then nothing needs to be done
other than to accept the merge request. If dependencies have changed, it will
be necesssary to update the feedstock's conda-recipe.

### Documentation release

1. Build and review current documentation

```bash
$ make clean-doc
$ make doc
$ make doc-serve
```

2. Deploy version to gh-pages git branch using mike and verify

```bash
$ make doc-deploy
$ make doc-serve-all
```

3. Upload gh-pages

```bash
$ make doc-upload
```

The CI job will eventually install this at https://zuzukin.github.io/whl2conda/

3 changes: 3 additions & 0 deletions doc/reference/api/settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# whl2conda.settings

:::whl2conda.settings
4 changes: 2 additions & 2 deletions doc/reference/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* [Wheel metadata 1.1 (PEP 314)](https://peps.python.org/pep-0314/)
* [Wheel metadata 1.2 (PEP 345)](https://peps.python.org/pep-0345/)
* [Wheel metadata 2.1 (PEP 566)](https://peps.python.org/pep-0566/)
* [Wheel metadata 2.2 (PEP 643)](https://peps.python.org/pep-643/)
* [Wheel metadata 2.3 (PEP 685)](https://peps.python.org/pep-685/)
* [Wheel metadata 2.2 (PEP 643)](https://peps.python.org/pep-0643/)
* [Wheel metadata 2.3 (PEP 685)](https://peps.python.org/pep-0685/)

## pyproject.toml metadata format:

Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
- types-pyyaml >=6.0
# documentation
- black >=23.12
- mike >=1.1,<2.0
- mike >=2.0,<3.0
- mkdocs >=1.5,<2.0
- mkdocstrings-python >=1.7,<2.0
- mkdocs-material >9.1
Expand Down
9 changes: 4 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ site_dir: site
site_author: Christopher Barber
repo_name: GitHub
copyright: Copyright &copy; 2023 Christopher Barber
exclude_docs: |
/internal/

# https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/
#extra_css:
Expand All @@ -30,8 +32,8 @@ theme:
hljs_languages:
python
json
logo: whl2conda.svg
favicon: whl2conda.svg
logo: whl2conda.jpg
favicon: whl2conda.jpg
palette:
- media: "(prefers-color-scheme: light)"
scheme: default
Expand Down Expand Up @@ -113,6 +115,3 @@ markdown_extensions:
class: mermaid
# format: !!python/name:pymdownx.superfences.fence_code_format
- attr_list
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
4 changes: 3 additions & 1 deletion src/whl2conda/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
24.4.0
24.5.0


4 changes: 3 additions & 1 deletion src/whl2conda/api/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,16 @@ def __init__(
self,
wheel_path: Path,
out_dir: Path,
*,
update_std_renames: bool = False,
):
self.logger = logging.getLogger(__name__)
self.wheel_path = wheel_path
self.out_dir = out_dir
self.dependency_rename = []
self.extra_dependencies = []
# TODO - option to ignore this
self.std_renames = load_std_renames()
self.std_renames = load_std_renames(update=update_std_renames)

def convert(self) -> Path:
"""
Expand Down
Loading
Loading