-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add essence-feature-usage-stats tool #31
Changes from 2 commits
1f81e3d
39fb6c7
07bd9a4
5ba0e0d
557e076
36e8232
39b5b40
88d6da7
496cf70
582dfd9
bedb554
11b6066
b6fd931
d1cd45a
d530926
7d0da09
8fe1f58
59e6089
39feed8
9d49b5b
d33a7dc
4d8e7a6
0f4698a
d42e3f4
81190ac
7601396
a5d349b
6c9ba65
c2d25b4
9a14b34
6e25867
46b579b
a9b2611
8fbfeb3
a6012ac
7d69e21
e259723
4f410fd
3106580
5c82afb
f185def
5eb01ea
e0bb7ba
9c915fd
9ca0372
79c9abf
411635b
4f91943
0aa886a
131e660
9ee2a53
8137d1c
7e4dd6c
2e4d67c
7df03e4
9e9ff18
95b83f1
5cdb63d
04424fa
2264d8f
a422de1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
target | ||
|
||
solvers/**/vendor/build | ||
tools/essence-feature-usage-stats/.venv | ||
tools/essence-feature-usage-stats/stats/__pycache__ | ||
tools/essence-feature-usage-stats/utils/__pycache__ | ||
tools/essence-feature-usage-stats/.idea | ||
tools/essence-feature-usage-stats/test/__pycache__ | ||
tools/essence-feature-usage-stats/web/__pycache__ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ESSENCE_DIR=/home/mayday/Coding/VIP/EssenceCatalog | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are these local paths still needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the whole .env file is just for local testing. All the necessary env vars are in the GitHub Action There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we remove them from the repo then? As they are, they won't work on anybody else's computer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True! I have removed the file, just waiting for the CI to complete and the commit will appear here |
||
CONJURE_DIR=/home/mayday/Coding/VIP/conjure-v2.5.0-linux-with-solvers | ||
ESSENCE_EXAMPLES_REPO=https://github.com/conjure-cp/EssenceCatalog.git | ||
KEYWORD_BLOCKLIST="mInfo,finds,givens,enumGivens,enumLettings,lettings, | ||
unnameds,strategyQ,Auto,Interactive,strategyA,trailCompact, | ||
nameGenState,nbExtraGivens,representations,representationsTree, | ||
originalDomains,trailGeneralised,trailVerbose,trailRewrites, | ||
mLanguage,language,version,mStatements,Name,Declaration,FindOrGiven, | ||
SuchThat,Op" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# essence-feature-usage-stats | ||
|
||
## About | ||
|
||
This is an internal tool for the [conjure-oxide](https://github.com/conjure-cp/conjure-oxide) project. | ||
|
||
It does the following: | ||
- Given a directory containing Essence files, go through it and count how often every Essence language feature is used | ||
- Display this data as a simple web page with a table | ||
|
||
The purpose of this is to make it easier to find Essence examples to test specific Essence language features, which should be useful over the course of rewriting the conjure tool stack in Rust | ||
|
||
|
||
## Usage | ||
|
||
> This is heavily WIP and I am planning to make this more usable in the future. | ||
> Eventually, this will be a Flask web server to host the web page, a better frontend (to make it searchable, sortable, etc), and the page will auto-update on changes to the relevant Essence example repos | ||
|
||
For now, though: | ||
|
||
- Put paths to conjure directory and Essence file directory in .env | ||
- Run the main.py file | ||
- See the generated HTML file | ||
|
||
|
||
## ToDo | ||
|
||
- [x] Get basic stats in JSON format | ||
- [x] Get basic stats as HTML table | ||
- [ ] Table sorting | ||
- [x] Code refactoring | ||
- [ ] Documentation | ||
- [ ] Show/Hide table rows/columns | ||
- [ ] Web server for hosting the HTML page | ||
- 🏗️ GitHub Actions integration | ||
- [x] Extra stats, e.g. file line count | ||
- [ ] Sorting using these stats | ||
|
||
|
||
------------------------------------------ | ||
|
||
- Georgii Skorokhod and Hannah Zheng, 2023 | ||
- University of St Andrews | ||
- Developed as part of a Vertically Integrated Project by Ozgur Akgun et al | ||
- (See [main repos](https://github.com/conjure-cp)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from dotenv import load_dotenv | ||
|
||
from stats.essence_stats import EssenceStats | ||
from web.server import create_server | ||
|
||
ENV_PATH = Path("./.env").resolve() | ||
load_dotenv(dotenv_path=ENV_PATH) | ||
|
||
KEYWORD_BLOCKLIST = [x.strip() for x in os.getenv("KEYWORD_BLOCKLIST").split(",")] | ||
ESSENCE_DIR = os.getenv("ESSENCE_DIR") | ||
CONJURE_DIR = os.getenv("CONJURE_DIR") | ||
ESSENCE_EXAMPLES_REPO = os.getenv("ESSENCE_EXAMPLES_REPO") | ||
CONJURE_BIN = Path(CONJURE_DIR) / "conjure" | ||
|
||
if __name__ == "__main__": | ||
stats = EssenceStats( | ||
ESSENCE_DIR, | ||
CONJURE_BIN, | ||
ESSENCE_EXAMPLES_REPO, | ||
blocklist=KEYWORD_BLOCKLIST, | ||
) | ||
|
||
app = create_server(stats) | ||
app.run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.venv
pycache
.idea