Skip to content

Commit

Permalink
🚧 Use uv instead of rye. (#50)
Browse files Browse the repository at this point in the history
* 🚧  Update description (rye -> uv) in docs

* 💚  Use strategy in github actions

* 💚  Add 3.12 in matrix in github actions
  • Loading branch information
arafune authored Nov 18, 2024
1 parent fbc8b63 commit bb91f4a
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 76 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,4 @@ com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
uv.lock
19 changes: 8 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
=======================
Expand Down Expand Up @@ -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 <https://rye-up.com>`__.
1. Install `uv <https://docs.astral.sh/uv/guides/projects/>`__
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
=======
Expand All @@ -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 ([email protected])
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.
Expand Down
3 changes: 0 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 4 additions & 5 deletions docs/source/dev-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ Topics
Installing an editable copy of PyARPES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Install `rye <https://rye-up.com/>` to make an isolated environment for development.
1. Install `uv <https://docs.astral.sh/uv/guides/projects/>` 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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 8 additions & 16 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/arafune/arpes>`.

1. Install `rye <https://rye-up.com>`__
1. Install `uv <https://docs.astral.sh/uv/guides/projects/>`__
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,
Expand All @@ -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 <https://jupyter.org/>`__ or `Jupyter Lab <https://jupyterlab.readthedocs.io/en/latest>`__. Notes on
installing and configuring Jupyter based installations can be found
in ``jupyter.md``
`Jupyter <https://jupyter.org/>`__ or `Jupyter Lab <https://jupyterlab.readthedocs.io/en/latest>`__.
2. Explore the documentation and example notebooks at
`the documentation site <https://arpes-v4.readthedocs.io/en/daredevil/>`__.

Expand Down
48 changes: 24 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,36 @@ 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]
requires = ["hatchling"]
build-backend = "hatchling.build"


[tool.rye]
[tool.uv]
managed = true
dev-dependencies = [
"colorama>=0.4.6",
Expand All @@ -58,7 +58,7 @@ dev-dependencies = [
"pydata-sphinx-theme",
"neovim",
"mypy",
"nbstripout"
"nbstripout",
]

[tool.hatch.metadata]
Expand Down

0 comments on commit bb91f4a

Please sign in to comment.