Skip to content

"Modernise GrainSizeTools: uv, importable package, and PyPI release"#20

Open
jwestraadt wants to merge 7 commits intomarcoalopez:masterfrom
jwestraadt:develop
Open

"Modernise GrainSizeTools: uv, importable package, and PyPI release"#20
jwestraadt wants to merge 7 commits intomarcoalopez:masterfrom
jwestraadt:develop

Conversation

@jwestraadt
Copy link

This PR modernises the GrainSizeTools project with the following changes:

Package management

  • Migrated from pip/conda to uv for dependency and environment management
  • Added pyproject.toml with all dependencies (including pyyaml which was previously missing)
  • Pinned Python to 3.11 via .python-version
  • Published package to PyPI as grainsizetools-jwestraadt with an optional [jupyter] extra

Importable package

  • Converted grain_size_tools/ into a proper Python package with __init__.py
  • All functionality now accessible via import grain_size_tools as gst
  • Fixed package-relative YAML path in piezometers.py (Path(__file__).parent)
  • Fixed averages module-level import in GrainSizeTools_script.py
  • Removed emoji characters from plot.py causing UnicodeEncodeError on Windows

Documentation

  • Updated all DOCS notebooks (quatifying_grain_size_pops.ipynb, paleopiezometry_module.ipynb,
    stereology_module.ipynb) to use new gst.* import style
  • Updated all DOCS markdown files to reflect new API:
    • Install instructions: Anaconda → uv / PyPI
    • All plot.*gst.plot.*, stereology.*gst.stereology.*, etc.
    • Replaced hardcoded local filepaths with remote URLs
    • Replaced calc_shape() with two_step() in stereology docs
    • Updated piezometers API throughout
    • Added deprecation notice to legacy v2.0 tutorial (brief_tutorial.md)
  • Updated README.md with PyPI and uv install instructions

Test plan

  • pip install "grainsizetools-jwestraadt[jupyter]" installs correctly
  • import grain_size_tools as gst works after install
  • gst.summarize(), gst.plot.distribution(), gst.stereology.Saltykov(),
    gst.piezometers.calc_diffstress() all function correctly
  • All three DOCS notebooks run without errors end-to-end

🤖 Generated with Claude Code"

jwestraadt and others added 7 commits February 28, 2026 09:39
- Add pyproject.toml with project metadata and dependencies (including
  pyyaml which was missing from requirements.txt)
- Add uv.lock for reproducible installs
- Pin Python 3.11 via .python-version
- Update README.md with uv installation instructions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add grain_size_tools/__init__.py exposing summarize, get_filepath,
  function_list and all submodules (averages, plot, stereology,
  piezometers, template)
- Fix GrainSizeTools_script.py: move averages import to module level
  so summarize() works when imported (not just when %run)
- Fix piezometers.py: resolve piezometric_database.yaml via
  Path(__file__).parent so it loads correctly from any working directory
- Fix plot.py: remove emoji characters causing UnicodeEncodeError on Windows
- Update DOCS notebooks to use new import style (import grain_size_tools as gst)
  replacing all %run usage and hardcoded local paths
- Update README.md with Usage section and import examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace Anaconda/pip install instructions with uv workflow in
  _first_steps.md and getting started_src.md
- Replace '%run GrainSizeTools_script.py' with 'import grain_size_tools as gst'
  throughout all docs
- Update all module calls: plot.* -> gst.plot.*, stereology.* -> gst.stereology.*,
  averages.* -> gst.averages.*, summarize() -> gst.summarize()
- Update piezometers API: old piezometers.quartz() -> load_piezometers_from_yaml()
  + list_piezometers(db) + calc_diffstress(db.phase.__dict__['name'], grain_size=x)
- Replace hardcoded local filepaths with URL in stereology_module.md, _describe.md,
  _Paleopizometry.md
- Replace calc_shape() with two_step() in stereology_module.md
- Remove emoji from _Plot_module.md console output
- Update Step 4 package structure description in getting started_src.md
- Add deprecation notice to brief_tutorial.md (legacy v2.0 docs)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename package to grainsizetools-jwestraadt
- Update author/maintainer to Johan Westraadt
- Update repository URL to jwestraadt fork, keep original project link
- Add optional jupyter extra for jupyterlab
- Bump version to 3.2.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add Option A: pip install from PyPI (with jupyter extra)
- Rename Option B: install from source using uv
- Update clone URL to jwestraadt fork

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant