Skip to content

build: drop the BLAS and gfortran apt packages from CI - #170

Open
feanil wants to merge 2 commits into
masterfrom
feanil/drop-scipy-apt-packages
Open

feanil wants to merge 2 commits into
masterfrom
feanil/drop-scipy-apt-packages

Conversation

@feanil

@feanil feanil commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Stacked on #169. With scipy gone, the apt step that installed libblas-dev, liblapack-dev and gfortran to build it has nothing left to do, so this removes it.

@ormsbee can you take a look? If you'd rather fold it into #169, feel free to cherry-pick the commit.

ormsbee and others added 2 commits November 19, 2026 23:59
Importing nltk is slow, mostly because it imports scipy.stats. Every
LMS worker pays that cost, and so does each codejail run that uses
chemcalc.

The grammar is now written in pyparsing, which chemcalc already used
for tokenizing. Parse actions build the same trees as before, in a
small Tree class that keeps nltk.tree.Tree's equality and ordering.
The rendering and comparison code is unchanged.

Parse actions take all three of pyparsing's arguments. With fewer,
pyparsing works out the count on the first call, which isn't
thread-safe and can leave an action raising TypeError from then on.

Also drops scipy, which chem hasn't imported since 2013.
openedx-platform stopped importing it in
openedx/openedx-platform#39410.

Behavior changes:

* { or } in the input is a parse error. It used to raise ValueError.
* Brackets nested more than 20 deep (MAX_NESTING) are a parse error.
  The old parser took about 245 levels, then raised RecursionError.

Tests:

* chemcalc_baseline.json records what chem 2.0.1, the last nltk
  release, returned for about 1,460 expressions and pairs.
  test_chemcalc_baseline checks the current code against it.
* Four quirks that are probably bugs are kept so that grading doesn't
  change: charge-starting-with-1, space-inside-number, float-factors
  and zero-count-raises. Each has a test in test_chemcalc_quirks.py.
  Baseline entries that depend on one are tagged and checked
  separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
They were only there to build scipy from source.  #169
drops scipy, and numpy installs from a wheel on Python 3.12, so nothing in
the test run needs them any more.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@feanil
feanil requested a review from ormsbee November 20, 2026 17:08
@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.06%. Comparing base (0bec9f2) to head (bb34681).

Additional details and impacted files
@@                     Coverage Diff                     @@
##           ormsbee/chemcalc-drop-nltk     #170   +/-   ##
===========================================================
  Coverage                       97.06%   97.06%           
===========================================================
  Files                               4        4           
  Lines                             307      307           
  Branches                           62       62           
===========================================================
  Hits                              298      298           
  Misses                              4        4           
  Partials                            5        5           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@feanil
feanil marked this pull request as ready for review November 20, 2026 17:14
Base automatically changed from ormsbee/chemcalc-drop-nltk to master November 21, 2026 01:15

@ormsbee ormsbee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a couple of changes on my pyparsing PR, so this won't rebase cleanly But ✔️ on the build commit.

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.

2 participants