From bb91f4acc4bc581b3895fe437768c6afe120aead Mon Sep 17 00:00:00 2001 From: Ryuichi Arafune Date: Mon, 18 Nov 2024 13:39:12 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20=20Use=20uv=20instead=20of=20rye?= =?UTF-8?q?.=20(#50)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🚧 Update description (rye -> uv) in docs * 💚 Use strategy in github actions * 💚 Add 3.12 in matrix in github actions --- .github/workflows/python-app.yml | 31 +++++++++++---------- .gitignore | 1 + README.rst | 19 ++++++------- TODO.md | 3 -- docs/source/dev-guide.rst | 9 +++--- docs/source/index.rst | 6 ++-- docs/source/installation.rst | 24 ++++++---------- pyproject.toml | 48 ++++++++++++++++---------------- 8 files changed, 65 insertions(+), 76 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 7a00607a..1ab5e71d 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -15,31 +15,34 @@ permissions: jobs: build: runs-on: ubuntu-latest - + strategy: + matrix: + python-version: + - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: Install rye - uses: eifinger/setup-rye@v4 - id: setup-rye + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: - enable-cache: true - version: "latest" + python-version: ${{ matrix.python-version }} + - name: Install uv + uses: eifinger/setup-uv@v3 + + - name: Set up Python + run: uv python install ${{ matrix.python-version }} - name: Install libhdf5-dev by apt run: | sudo apt -y update sudo apt -y install libhdf5-dev libnetcdf-dev make pandoc - - name: Rye activation + - name: uv sync run: | - rye sync + uv sync --all-extras --dev - - name: test with rye - run: rye run pytest -vv --color=yes --cov=./ --cov-report=xml + - name: test with uv + run: uv run pytest -vv --color=yes --cov=./ --cov-report=xml - name: Build docs run: | diff --git a/.gitignore b/.gitignore index 2eef6ef7..89ba9ed8 100644 --- a/.gitignore +++ b/.gitignore @@ -178,3 +178,4 @@ com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties +uv.lock diff --git a/README.rst b/README.rst index 4fb30c77..89e83737 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ .. |Documentation| image:: https://img.shields.io/badge/api-reference-blue.svg :target: https://arpes-v4.readthedocs.io/en/daredevil/ -|coverage| |docs_status| |code_format| |code style| |rye| +|coverage| |docs_status| |code_format| |code style| |uv| .. |docs_status| image:: https://readthedocs.org/projects/arpes-v4/badge/?version=stable&style=flat @@ -18,9 +18,10 @@ :target: https://github.com/psf/black .. |code_format| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json :target: https://github.com/astral-sh/ruff -.. |rye| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/rye/main/artwork/badge.json - :target: https://rye-up.com - :alt: Rye +.. |uv| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json + :target: https://github.com/astral-sh/uv + :alt: uv + PyARPES corrected (V4) ======================= @@ -95,15 +96,13 @@ Local installation from source If you want to modify the source for PyARPES as you use it, you might prefer a local installation from source. Details can be found on `the documentation site`_. - - Suggested steps --------------- -1. install `rye `__. +1. Install `uv `__ 2. Clone or duplicate the folder structure in this repository by `git clone https://github.com/arafune/arpes.git` -3. ``rye sync`` in ``arpes`` directory -4. Activate ``arpes`` environment (the way to activate depends on the OS/shell: I have confirmed the arpes-V4 works on Mac/Linux/Windows). +3. In the ``arpes`` directory, make the virtual environment, and activate it. The way of activation depends on your shell (bash, fish, zsh, powershell, etc.). +4 . ``uv sync`` in ``arpes`` directory Contact ======= @@ -113,8 +112,6 @@ Very unfortunately, we cannot get any responses from the original author. The c Questions, difficulties, and suggestions can be directed to Conrad Stansbury (chstan@berkeley.edu) or added to the repository as an issue. In the case of trouble, also check the `FAQ`_. - - Copyright |copy| 2018-2019 by Conrad Stansbury, all rights reserved. PyArpes contribution after `cadaaae`_, |copy| 2023-2024 by Ryuichi Arafune, all rights reserved. diff --git a/TODO.md b/TODO.md index 5ffcd97f..5ad99f3c 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,3 @@ fixed by myself. Here is the guideline to maintain the code. - .band_analysis_utils import param_getter, param_stderr_getter - Check type of the argument set at lf.Mmodel: Is it really lf.Model? lf.ModelResult is better? - -- rye for packaging - - tidy up yaml files diff --git a/docs/source/dev-guide.rst b/docs/source/dev-guide.rst index cd6e0ffd..39c5482d 100644 --- a/docs/source/dev-guide.rst +++ b/docs/source/dev-guide.rst @@ -7,18 +7,17 @@ Topics Installing an editable copy of PyARPES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -1. Install `rye ` to make an isolated environment for development. +1. Install `uv ` to make an isolated environment for development. 2. Clone the respository .. code:: bash git clone https://gitlab.com/arafune/arpes -3. Install libraries to develop PyARPES with +3. Make virtual environment in the cloned directory, and activate it. +4. Install libraries to develop PyARPES with - ``rye sync``. - -4. After that, activate the .venv/ environment. + ``uv sync``. Tests (with coverage information) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/source/index.rst b/docs/source/index.rst index 67814195..9dd15234 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,10 +8,10 @@ That is likely th main reason he has not maintained it. There is no motivation to maintain codes that is not being used. Since the previous version release, the python ecosystem has been improved significantly. -Conda is no longer necessarily the best system, especially for Macintosh users. +Conda is no longer necessarily the best system, especially for the Macintosh users. In fact, I believe that it can sometimes cause confusion. -Therefore, I have decided to drop the Conda-related support. Instead, -I strongly recommend to use "rye". +Thus, I have decided to drop the Conda-related support. Instead, +I strongly recommend to use "uv". While I have added many type hints in the codes to improve usability and maintainability, I still feel that the current package is not very user-friencdly for less experienced Python users. diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 09a7b7aa..daff78ec 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -20,25 +20,21 @@ frequently change the source of PyARPES as you work. You can use code available either from the main repository at `GitHub `. -1. Install `rye `__ +1. Install `uv `__ 2. Clone or otherwise download the respository .. code:: bash git clone https://github.com/arafune/arpes -3. Make a python environment according to our provided specification +3. Make a python environment according to our provided specification, and activate .. code:: bash - cd path/to/python-arpes - rye sync - -3. Activate the environment - -.. code:: bash - - activate .venv/bin/activate + cd path/to/pyarpes + uv venv (if path/to/pyarpes/.venv does not exist.) + source .venv/bin/activate (Activation way depends on your shell.) + uv sync 4. *Recommended:* Configure IPython kernel according to the **Barebones Kernel Installation** below. Especially, to use pyarpes on JupyterLab, @@ -48,14 +44,10 @@ available either from the main repository at python -m ipykernel install --user --display-name "My Name Here" Additional Suggested Steps -~~~~~~~~~~~~~~~~~~~~~~~~~~ - - +~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Install and configure standard tools like - `Jupyter `__ or `Jupyter Lab `__. Notes on - installing and configuring Jupyter based installations can be found - in ``jupyter.md`` + `Jupyter `__ or `Jupyter Lab `__. 2. Explore the documentation and example notebooks at `the documentation site `__. diff --git a/pyproject.toml b/pyproject.toml index 739dad16..c9272c82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,28 +10,28 @@ readme = "README.rst" requires-python = ">= 3.11" dependencies = [ - "holoviews>=1.16.0", - "astropy>=6.1", - "xarray>=2023.9.0", - "lmfit>=1.3.1", - "matplotlib>=3.8.0", - "pint>=0.22", - "h5py>=3.11.0", - "ase>=3.23.0", - "dill>=0.3.6", - "tqdm>=4.65.0", - "numba>=0.57.1", - "scikit-learn>=1.4.2", - "scikit-image>=0.20.0", - "rx>=3.2.0", - "jupyter_server>=2.8", - "hvplot>=0.10", - "ipywidgets", - "ipykernel", - "more-itertools>=10.2.0", - "igorpy @ git+https://github.com/arafune/igorpy.git", - "titlecase>=2.4.1", - "h5netcdf>=1.3.0", + "holoviews>=1.16.0", + "astropy>=6.1", + "xarray>=2023.9.0", + "lmfit>=1.3.1", + "matplotlib>=3.8.0", + "pint>=0.22", + "h5py>=3.11.0", + "ase>=3.23.0", + "dill>=0.3.6", + "tqdm>=4.65.0", + "numba>=0.57.1", + "scikit-learn>=1.4.2", + "scikit-image>=0.20.0", + "rx>=3.2.0", + "jupyter_server>=2.8", + "hvplot>=0.10", + "ipywidgets", + "ipykernel", + "more-itertools>=10.2.0", + "igorpy @ git+https://github.com/arafune/igorpy.git", + "titlecase>=2.4.1", + "h5netcdf>=1.3.0", ] [build-system] @@ -39,7 +39,7 @@ requires = ["hatchling"] build-backend = "hatchling.build" -[tool.rye] +[tool.uv] managed = true dev-dependencies = [ "colorama>=0.4.6", @@ -58,7 +58,7 @@ dev-dependencies = [ "pydata-sphinx-theme", "neovim", "mypy", - "nbstripout" + "nbstripout", ] [tool.hatch.metadata]