-
Notifications
You must be signed in to change notification settings - Fork 8
Setup tooling #68
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
Setup tooling #68
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
A common tool that is used for automating these tests and formatting rules is |
|
I tried the setup and activated my environment, and ran I'm getting errors like these, even though I have podman installed on my Intel MacBook Pro. Any clues why that would be happening? |
Overview
This PR adds some extra tooling and introduces a change in how tests are conducted. The tooling introduced is:
To get started with this PR, all you need is
uv. After checking out this branch, you can runuv sync --all-groupswhich will create a virtual environment in the project directory. You can activate this virtual environment just like any otherpyenvorvirtualenvwithsource .venv/bin/activate(making sure to grab the right activation script if your default shell is notbash,sh, orzsh).All the tests that previously existed only within jupyter notebooks have been cloned as standard
pytesttests. These reside under thetest/directory. Each test will spin up a companion container with either podman or docker for the duration of the tests, so it's crucial that one of the two binaries is available. Furthermore, the interactions betweenfirefly_clientand the web browser have been mocked. You can run these tests withpytestwith no extra arguments, as all arguments are defined in thepyproject.tomlunder[tool.pytest.ini_options].Additionally,
toxhas been added for testing across python versions. To run these tests, use the commandtox- again with no added arguments. When you invoketoxit will leverageuvto install python versions 3.10-3.14 and then run thepytesttests against each version of python.Lastly, ruff was added and configured with sensible defaults for code quality. To ensure standard code formatting, you can run
ruff format, which will format all files (including the jupyter notebooks) following the PEP standards and the configuration stated in the[tool.ruff]sections of thepyproject.toml. To ensure standard linting and to stay up to date with general python code standards, you can also runruff checkto lint all files. This will output all linting errors, warnings, and suggestions. You may also useruff check --fixto automatically fix the linting rules that have auto-corrections. Note thatruff formatnorruff check --fixwill rewrite any logic. These commands will only modify the syntax of the code.Similarly to
condaandpip, one ready to release,uvprovides theuv buildanduv publishcommands for managing the package. A good place to begin exploringuvbeyond the documentation is by simply runninguv help.Disclaimer:
I made some minor modifications to the package. These changes were to support python type checking, as the codebase was failing
rufftype checks.Using Ruff:
Ruff can be added to your code editor, with extensions for NeoVim, VS Code, Sublime, and many other IDEs. With the Ruff tooling extensions, you will get live linting results as you code. This is the recommended way to work with Ruff.
Code Consistency Improvements:
examples/basic-demo-tableload.ipynb: Standardized the use of double quotes for strings and improved formatting for multi-line strings. [1] [2] [3] [4] [5] [6]examples/demo-3color.ipynb: Replaced single quotes with double quotes for strings and adjusted formatting for better readability. [1] [2] [3] [4] [5] [6]examples/demo-HiPS.ipynb: Updated string quotes to double quotes and reformatted code blocks for clarity. [1] [2] [3] [4] [5] [6] [7]examples/demo-advanced-all.ipynb: Changed single quotes to double quotes for strings and added spacing for improved readability. [1] [2]Build Process Update:
docs/Makefile: Modified theSPHINXBUILDcommand to useuv run sphinx-buildinstead ofsphinx-buildfor building documentation.