Select to view content in your preferred language

Make the Ruff Python library available in ArcGIS Pro's conda environment

739
3
04-03-2024 06:47 AM
Status: Closed
Labels (1)
Skyler
by
Occasional Contributor

ArcGIS Pro's default conda environment includes the Flake8 library for linting and the Black library for autoformatting. (See ArcGIS Blog: Improve Your Scripts with Linting and Automatic Code Formatting.) Several other Python code quality tools are available to be installed through the Package Manager, including isort, pydocstyle, and pep8-naming.

Ruff is a Python library that combines the functionality of all the tools mentioned above, plus more, while performing many times faster than any of them. Several mature projects have switched to using Ruff, such as Mozilla Firefox, pandas, pip, Project Jupyter, and SciPy. (See astral-sh/ruff: Who's Using Ruff?)

It would be great for Ruff either to be included in the default conda environment, or at least to be available to be installed through the Package Manager.

3 Comments
HannesZiegler
Status changed to: Closed

Though not by our doing, Anaconda is now hosting `ruff` on defaults since this May: https://anaconda.org/main/ruff/files

That means ruff is now available for install from the Package Manager in ArcGIS Pro (it pulls from Anaconda's defaults channel).

At this time, we do not plan on incorporating this package into the default Python environment for ArcGIS Pro, arcgispro-py3.

Because the package can be successfully installed from the Package Manager into a custom environment (clone of arcgispro-py3), I am closing this idea now.

Skyler
by

@HannesZiegler: ruff is still not showing up for me as a package that's available to install in the ArcGIS Pro Package Manager. I am on ArcGIS Pro version 3.3.2.

Skyler_0-1728402951217.png

 

HannesZiegler

@Skyler I confirmed that in 3.3 ruff does not show up in the backstage, but it does show up in 3.4 (next release). You should be able to install it now using the command prompt:

Using a clone of arcgispro-py3 (do not modify arcgispro-py3 directly)

  1. Open Python Command Prompt
  2. Activate the clone by running: activate <your clone name>
  3. Install ruff by running: conda install ruff