Skip to content

Commit 98854ab

Browse files
committed
Merge branch 'main' of github.com:LMFDB/lmfdb into cmdline
2 parents 806c01a + 518a962 commit 98854ab

220 files changed

Lines changed: 9597 additions & 1725 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/matrix_includes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
"server": "devmirror"
3131
},
3232
{
33-
"files": "lmfdb/tests/test_dynamic_knowls.py lmfdb/tests/test_root.py lmfdb/hecke_algebras/test_hecke_algebras.py lmfdb/tests/test_homepage.py lmfdb/tests/test_random_redirects.py lmfdb/elliptic_curves/test_ell_curves.py lmfdb/elliptic_curves/test_browse_page.py",
33+
"files": "lmfdb/tests/test_dynamic_knowls.py lmfdb/tests/test_root.py lmfdb/tests/test_code_coverage.py lmfdb/hecke_algebras/test_hecke_algebras.py lmfdb/tests/test_homepage.py lmfdb/tests/test_random_redirects.py lmfdb/elliptic_curves/test_ell_curves.py lmfdb/elliptic_curves/test_browse_page.py",
3434
"folders": "elliptic_curves hecke_algebras tests",
3535
"server": "proddb"
3636
},
3737
{
38-
"files": "lmfdb/tests/test_dynamic_knowls.py lmfdb/tests/test_root.py lmfdb/hecke_algebras/test_hecke_algebras.py lmfdb/tests/test_homepage.py lmfdb/tests/test_random_redirects.py lmfdb/elliptic_curves/test_ell_curves.py lmfdb/elliptic_curves/test_browse_page.py",
38+
"files": "lmfdb/tests/test_dynamic_knowls.py lmfdb/tests/test_root.py lmfdb/tests/test_code_coverage.py lmfdb/hecke_algebras/test_hecke_algebras.py lmfdb/tests/test_homepage.py lmfdb/tests/test_random_redirects.py lmfdb/elliptic_curves/test_ell_curves.py lmfdb/elliptic_curves/test_browse_page.py",
3939
"folders": "elliptic_curves hecke_algebras tests",
4040
"server": "devmirror"
4141
},

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
- name: checking that we didn't miss any test files
9191
shell: bash -l {0}
9292
# If this fails you need to update the file list above and file count
93-
run: test $(find lmfdb -name 'test_*.py' -or -name '*_test.py' | wc -l) -eq 41
93+
run: test $(find lmfdb -name 'test_*.py' -or -name '*_test.py' | wc -l) -eq 42
9494

9595
- name: Config LMFDB to run tests against proddb
9696
if: matrix.files != 'lint' && matrix.server == 'proddb'

.github/workflows/snippet_generate.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Generate Snippet Code Files
22

33
on:
44
push:
5+
branches:
6+
- main
57
paths:
68
- '**/code*.yaml'
79

@@ -26,5 +28,5 @@ jobs:
2628
with:
2729
commit-message: snippet code test files generated by action
2830
title: Code snippets from snippet-generate action
29-
body: This is an auto-generated PR with code snippets from yaml files
31+
body: This is an auto-generated PR with code snippets from yaml files.
3032
labels: code snippets, automated pr

Development.md

Lines changed: 86 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ Structural Conventions
3939

4040
Below, we describe several of the structural conventions used in the LMFDB. Note
4141
that we also have styling conventions for the content of individual pages. These
42-
styling conventions are described in
43-
[StyleGuide.md](https://github.com/LMFDB/lmfdb/blob/main/StyleGuide.md).
42+
styling conventions are described in [StyleGuide.md](./StyleGuide.md).
4443

4544
Pages in the LMFDB
4645
------------------
@@ -206,11 +205,11 @@ should be
206205
Here and throughout this document, we say "should" instead of "must", with
207206
the understanding that some compromises will be inevitable.
208207

209-
Here are some principles:
208+
Here are some conventions the LMFDB uses:
210209

211210
1. If X is the URL of an object, then L/X is the URL of its standard
212211
L-function. According to the Langlands program, other L-functions
213-
associated to X have the form L(s, X, rho). Examples include
212+
associated to X may be written on the the form L(s, X, rho). Examples include
214213

215214
- L(s, f, sym^2)
216215
- L(s, f, spin)
@@ -261,8 +260,7 @@ Here are some principles:
261260
should be considered permanent:
262261

263262
- `/ArtinRepresentation/\<dim>/\<conductor>/\<label>`
264-
- `/Character/Dirichlet/\<modulus>/\<number>`
265-
- `/Character/Hecke/\<number_field>/\<modulus>/\<number>`
263+
- `/Character/Dirichlet/\<modulus>/\<label>`
266264
- `/EllipticCurve/Q/\<label>`
267265
- `/GaloisGroup/\<label>`
268266
- `/padicField/\<label>`
@@ -337,7 +335,7 @@ Code Attribution
337335
----------------
338336

339337
Each file should begin with a short copyright information, mentioning the people
340-
who are mainly involved in coding this particular python file. In practice,
338+
who are mainly involved in coding this particular python file.
341339

342340

343341
Testing
@@ -356,106 +354,111 @@ Testing
356354

357355
- A code coverage diagnostic can be obtained via
358356
```
359-
./test.sh html
357+
./test.sh coverage
360358
```
361-
it produces beautiful coverage scores in `lmfdb/cover/index.html`
359+
which produces coverage scores saved in `lmfdb/htmlcov`.
362360

363-
Pro Tip: Debugging
364-
-------------------
361+
Code Snippets
362+
-------------
365363

366-
Just add
364+
Many of the LMFDB pages include code snippets which describe how to generate the objects on the page using computer algebra systems such as SageMath, Magma, pari/GP or Oscar. To add code snippets to a new page, the relevant code is placed in a file named `code.yaml`. The file should always define the languages used using the `prompt` tag, for example:
367365
```
368-
import pdb; pdb.set_trace()
366+
prompt:
367+
sage: 'sage'
368+
pari: 'gp'
369+
magma: 'magma'
370+
oscar: 'oscar'
369371
```
370-
somewhere (e.g. protected inside a sensible if) this magic
371-
line and you will end up inside the interactive python
372-
debugger. there, you can check for the local variables with dir()
373-
you can execute python code (e.g. to introspect objects)
374-
and use "pp <var name>" to pretty print variables and
375-
to continue executing code use the "n" command.
376-
When you get lost, the command "bt" shows you exactly where you
377-
are and "up" helps you to get on step up on the stack.
378-
Of course, "help `<command>`" will tell you more...
379-
380-
Git Tips
381-
=========
382-
383-
global .gitignore
384-
-----------------
385372

386-
Please configure Git to have a global .gitignore for all your projects.
387-
It should contain all the files which are not project specific, but happen
388-
on your machine. E.g. temporary files ending in `...~` or `.DS_store`.
389-
390-
[copy paste ready instructions on github](https://help.github.com/articles/ignoring-files#global-gitignore)
391-
392-
.gitconfig
393-
----------
394-
395-
In your home directory, in the file ~/.gitconfig
396-
397-
```
398-
[alias]
399-
st=status
400-
aliases=!git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
401-
ci=commit
402-
br=branch
403-
co=checkout
404-
df=diff
405-
who=shortlog -s --
406-
ll = log --oneline --graph --decorate -25
407-
lla = log --oneline --graph --decorate --all -25
408-
wdiff=diff --word-diff=color
409-
[color]
410-
ui = auto
411-
branch = auto
412-
diff = auto
413-
interactive = auto
414-
status = auto
373+
The code snippets should be formatted as template strings, which will then be formatted in the code when the page is loaded.
374+
```yaml # From number_fields/code.yaml
375+
field:
376+
comment: Define the number field
377+
sage: x = polygen(QQ); K.<a> = NumberField(%s)
378+
pari: K = bnfinit(%s, 1)
379+
magma: R<x> := PolynomialRing(Rationals()); K<a> := NumberField(%s);
380+
oscar: Qx, x = polynomial_ring(QQ); K, a = number_field(%s)
415381
```
416382
417-
List-table should always be like
418-
--------------------------------
383+
### Snippet testing
384+
385+
Sometimes computer algebra systems make breaking changes which render the code snippets invalid. To catch this, there's a testing system for snippets implemented in `lmfdb/tests/generate_snippet_tests.py`. This runs the code line by line in the various CAS-es, excluding magma. It does not test correctness of the results, only consistency, by comparing with previous results stored in the `lmfdb/tests/snippet_tests` directory. Normally (and at the time of writing), this is run automatically by Github Actions, which generates the relevant log files. However, it is possible to run it manually using the CLI tool
419386

387+
```bash
388+
sage --python ./lmfdb/tests/generate_snippet_tests.py -h
420389
```
421-
<table class="ntdata">
422-
<thead><tr><td>...</td></tr></thead>
423-
424-
<tbody>
425-
<tr class="odd"> <td>...</td></tr>
426-
<tr class="even"><td>...</td></tr>
427-
<tr class="odd"> <td>...</td></tr>
428-
...
429-
</tbody>
430-
</table>
390+
which takes a number of arguments (of which one of the positional arguments `generate` and `test` are required).
391+
392+
To specify which code snippets should be tested in the Github Action, add a tag of the form
393+
394+
```yaml
395+
# e.g. in /lmfdb/number_fields/code.yaml
396+
...
397+
snippet_test:
398+
testQ:
399+
label: 1.1.1.1
400+
langs:
401+
- sage
402+
- magma
403+
- oscar
404+
- gp
405+
url: NumberField/1.1.1.1/download/{lang}
431406
```
432407

433-
... we might also switch to CSS3's nth-element selector and forget about this.
408+
The tag `langs` here is optional, and if omitted, all (available) languages in the `prompt` tag will be used.
434409

410+
### Snippet test and generate Github Actions
435411

436-
Properties
437-
----------
412+
Part of the code snippet testing system is a pair of code actions to generate evaluation log files automatically. The first one runs when a change to a `code*.yaml` file is pulled to the main branch, and if so, regenerates the evaluation files. If the output is different from the previous evaluation files, it will make a pull request, allowing you to manually check that the output is as expected. The logic is in `.github/workflows/snippet_generate.yml`.
438413

439-
The table on the right renders Strings formatted in the following datastructure:
414+
Additionally, there's a second CI action which runs twice a month and checks that the evaluations are consistent - it can also be run on demand. This ensures that if and when SageMath (or another CAS) deprecates a function, we'll know without having to wait for someone to update the yaml files, rerun the code or submit a bug report. If this action generates a different output than what's stored in the evaluation files, it will error, and upload the diff as an artifact. This is in `.github/workflows/snippet_test.yml`. Furthermore, it will create/update an issue (see https://github.com/LMFDB/lmfdb/issues/6810 for example) which keeps track of all the evaluation errors.
440415

441-
```
442-
prop = [ ( '<description>', [ '<value 1>', '<value 2>', ...] ), ... ]
443-
```
444416

445-
or
417+
Pro Tip: Debugging
418+
-------------------
446419

420+
Adding
447421
```
448-
prop = [ ( '<description>', '<value>'), ('<description>', '<value>'), ... ]
422+
import pdb; pdb.set_trace()
449423
```
424+
somewhere in a python file (e.g. protected inside a sensible if) will pause the execution of the program;
425+
this puts you inside an interactive python debugger, where you can:
450426
451-
you can mix list or non-list.
427+
- check for the local variables with `dir()`,
428+
- you can execute arbitrary python code (e.g. to inspect objects),
429+
- use `pp <var name>` to pretty print variables,
430+
- continue executing code using the `n` command.
452431
432+
If you get lost, the command `bt` shows you exactly where you
433+
are, and `up` helps you to get on step up on the stack.
434+
Of course, `help <command>` will tell you more.
453435
454-
LaTeX Macros
455-
------------
456-
457-
Latex macros are documented in a knowl that will appear when you start editing one.
436+
Git Tips
437+
=========
458438
439+
Contributing to the LMFDB requires some familiarity with git, a popular version control system which LMFDB uses. The LMFDB code base is hosted on Github, which is a common hosting service owned by Microsoft.
440+
- [Official git tutorial](https://git-scm.com/docs/gittutorial) and [Github's git guide](https://github.com/git-guides)
441+
- Use a global .gitignore file to exclude temporary files like `.DS_store` or `main.py~`; [copy-paste ready instructions on github](https://help.github.com/articles/ignoring-files#global-gitignore).
442+
- Configure your global .gitconfig for shortcuts or global configuration options; for example:
443+
```
444+
[alias]
445+
st=status
446+
aliases=!git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
447+
ci=commit
448+
br=branch
449+
co=checkout
450+
df=diff
451+
who=shortlog -s --
452+
ll = log --oneline --graph --decorate -25
453+
lla = log --oneline --graph --decorate --all -25
454+
wdiff=diff --word-diff=color
455+
[color]
456+
ui = auto
457+
branch = auto
458+
diff = auto
459+
interactive = auto
460+
status = auto
461+
```
459462

460463
Server Hook
461464
-----------

lmfdb/abvar/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
from lmfdb.app import app
2-
from lmfdb.logger import make_logger
32
from flask import Blueprint
43

54
abvar_page = Blueprint(
65
"abvar", __name__, template_folder="templates", static_folder="static"
76
)
8-
abvar_logger = make_logger(abvar_page)
97

108

119
@abvar_page.context_processor

lmfdb/abvar/fq/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11

22
from lmfdb.app import app
3-
from lmfdb.logger import make_logger
43
from flask import Blueprint
54

65
abvarfq_page = Blueprint("abvarfq", __name__, template_folder="templates", static_folder="static")
7-
abvarfq_logger = make_logger(abvarfq_page)
86

97

108
@abvarfq_page.context_processor

lmfdb/abvar/fq/isog_class.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from collections import Counter
1313

1414
from lmfdb.utils import encode_plot, display_float
15-
from lmfdb.logger import make_logger
1615

1716
from lmfdb import db
1817
from lmfdb.app import app
@@ -44,9 +43,6 @@ def maxq(g, p):
4443
return maxgen[g]
4544

4645

47-
logger = make_logger("abvarfq")
48-
49-
5046
#########################
5147
# Label manipulation
5248
#########################

lmfdb/abvar/fq/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from sage.databases.cremona import cremona_letter_code
77

88
from lmfdb import db
9-
from lmfdb.logger import make_logger
109
from lmfdb.utils import (
1110
to_dict, flash_error, integer_options, display_knowl, coeff_to_poly,
1211
SearchArray, TextBox, TextBoxWithSelect, SkipBox, CheckBox, CheckboxSpacer, YesNoBox,
@@ -25,8 +24,6 @@
2524
from lmfdb.abvar.fq.download import AbvarFq_download
2625
from lmfdb.utils.search_parsing import parse_primes
2726

28-
logger = make_logger("abvarfq")
29-
3027
#########################
3128
# Top level
3229
#########################

lmfdb/abvar/fq/stats.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
from lmfdb import db
55
from lmfdb.utils import comma, display_knowl, StatsDisplay, proportioners, totaler
66
from psycodict.utils import range_formatter
7-
from lmfdb.logger import make_logger
87
from sage.misc.lazy_attribute import lazy_attribute
98
from sage.misc.cachefunc import cached_method
109

11-
logger = make_logger("abvarfq")
1210
def yn(t):
1311
return "yes" if (t and t != "no") else "no"
1412
def ynu(t):

lmfdb/api/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11

22
from lmfdb.app import app
3-
from lmfdb.logger import make_logger
43
from flask import Blueprint
54

65
api_page = Blueprint("API", __name__, template_folder='templates', static_folder="static")
7-
api_logger = make_logger(api_page)
86

97
@api_page.context_processor
108
def body_class():

0 commit comments

Comments
 (0)