-
Notifications
You must be signed in to change notification settings - Fork 8
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 new Package Management system based on hatch #90
Conversation
… to pyproject.toml
… rename bin's scripts)
… (remove update of TEXINPUTS variable)
…t for calculated parser
…oml + decalre all test in tests' __init__.py
283b038
to
33ba3ac
Compare
[tool.hatch.build] | ||
packages = ["amc2moodle"] | ||
# only-packages = true | ||
ignore-vcs = false |
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.
to be checked
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.
done
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.
With this all files in the source tree not filtered with the .gitignore are included in the sdist and in the whl.
The approach with the include seems perhaps better finally.
include =[
"LICENSE",
"README.md",
"amc2moodle/moodle2amc/README.md",
"amc2moodle/amc2moodle/README.md",
"amc2moodle/amc2moodle/bin/amc2moodle",
"amc2moodle/amc2moodle/*.xslt",
"amc2moodle/amc2moodle/*sty.ltxml",
"tests/payload_test_amc2moodle/Figures/*",
"tests/payload_test_amc2moodle/Figures/other/*",
"tests/payload_test_amc2moodle/4.png",
"tests/payload_test_amc2moodle/QCM.pdf",
"tests/payload_test_amc2moodle/QCM.tex",
"tests/payload_test_amc2moodle/QCM.xml",
"tests/payload_test_amc2moodle/QCM_wo-tikz.tex",
"tests/payload_test_amc2moodle/QCM_wo-tikz.xml",
"tests/payload_test_amc2moodle/tikz.tex",
"tests/payload_test_amc2moodle/common-bank.tex",
"tests/payload_test_amc2moodle/numerical.tex",
"tests/payload_test_amc2moodle/numerical.xml",
"tests/payload_test_amc2moodle/cleaning.tex",
"tests/payload_test_amc2moodle/cleaning.xml",
"tests/payload_test_amc2moodle/element.tex",
"tests/payload_test_amc2moodle/includestyles.tex",
"amc2moodle/moodle2amc/bin/moodle2amc",
"amc2moodle/moodle2amc/html2tex.xslt",
"amc2moodle/moodle2amc/struc2tex.xslt",
"tests/payload_test_moodle2amc/automultiplechoice.sty",
"tests/payload_test_moodle2amc/moodle-bank-exemple.xml",
"tests/payload_test_moodle2amc/moodle-bank-exemple.tex",
"tests/payload_test_moodle2amc/moodle-bank-exemple.pdf"]
doesn't seems to prevent other files to be added.
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.
I was expecting that hatch can use .gitignore filter + use only tracked file but it doesn't seem possible. To build, a clean working directory is still needed :-(
So finally gitignore seems perhaps the simplest way...
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.
Run hatch build
and unzip -l dist/amc2moodle-2.11.0-py3-none-any.whl
- with
ignore-vcs=false
:
Archive: dist/amc2moodle-2.11.0-py3-none-any.whl
Length Date Time Name
--------- ---------- ----- ----
1214 02-02-2020 00:00 amc2moodle/__init__.py
23 02-02-2020 00:00 amc2moodle/_version.py
14865 02-02-2020 00:00 amc2moodle/amc2moodle/README.md
0 02-02-2020 00:00 amc2moodle/amc2moodle/__init__.py
14237 02-02-2020 00:00 amc2moodle/amc2moodle/amc2moodle_class.py
9030 02-02-2020 00:00 amc2moodle/amc2moodle/automultiplechoice.sty.ltxml
43296 02-02-2020 00:00 amc2moodle/amc2moodle/convert.py
2350 02-02-2020 00:00 amc2moodle/amc2moodle/fp.sty.ltxml
370 02-02-2020 00:00 amc2moodle/amc2moodle/mhchem.sty.ltxml
4864 02-02-2020 00:00 amc2moodle/amc2moodle/transform.xslt
15439 02-02-2020 00:00 amc2moodle/amc2moodle/transform2html.xslt
741 02-02-2020 00:00 amc2moodle/amc2moodle/transform_ns.xslt
4581 02-02-2020 00:00 amc2moodle/amc2moodle/transform_qtype.xslt
6893 02-02-2020 00:00 amc2moodle/amc2moodle/bin/amc2moodle.py
3606 02-02-2020 00:00 amc2moodle/moodle2amc/README.md
169 02-02-2020 00:00 amc2moodle/moodle2amc/__init__.py
24322 02-02-2020 00:00 amc2moodle/moodle2amc/_questions.py
13056 02-02-2020 00:00 amc2moodle/moodle2amc/_quiz.py
5691 02-02-2020 00:00 amc2moodle/moodle2amc/html2tex.xslt
2708 02-02-2020 00:00 amc2moodle/moodle2amc/struc2tex.xslt
5905 02-02-2020 00:00 amc2moodle/moodle2amc/bin/moodle2amc.py
1512 02-02-2020 00:00 amc2moodle/tests/__init__.py
18807 02-02-2020 00:00 amc2moodle/tests/test_amc2moodle.py
4200 02-02-2020 00:00 amc2moodle/tests/test_moodle2amc.py
7532 02-02-2020 00:00 amc2moodle/tests/test_utils_calculatedParser.py
2616 02-02-2020 00:00 amc2moodle/tests/test_utils_text.py
1312 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/4.png
187722 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM.pdf
2981 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM.tex
63905 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM.xml
2983 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.tex
59980 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.xml
3143 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/cleaning.tex
2171 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/cleaning.xml
10906 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/common-bank.tex
2573 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/element.tex
440 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/includestyles.tex
4397 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/numerical.tex
4392 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/numerical.xml
484 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/tikz.tex
3386 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/Figures/tinymonk.pdf
3896 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/Figures/other/4r.png
14813 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/Figures/other/schema_interpL.png
48501 02-02-2020 00:00 amc2moodle/tests/payload_test_moodle2amc/automultiplechoice.sty
141172 02-02-2020 00:00 amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.pdf
10728 02-02-2020 00:00 amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.tex
29495 02-02-2020 00:00 amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.xml
0 02-02-2020 00:00 amc2moodle/utils/__init__.py
18196 02-02-2020 00:00 amc2moodle/utils/calculatedParser.py
6151 02-02-2020 00:00 amc2moodle/utils/customLogging.py
5658 02-02-2020 00:00 amc2moodle/utils/flatex.py
2891 02-02-2020 00:00 amc2moodle/utils/misc.py
2656 02-02-2020 00:00 amc2moodle/utils/text.py
50136 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/METADATA
87 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/WHEEL
126 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/entry_points.txt
35139 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/licenses/LICENSE
5719 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/RECORD
--------- -------
934166 58 files
- with
ignore-vcs=true
Archive: dist/amc2moodle-2.11.0-py3-none-any.whl
Length Date Time Name
--------- ---------- ----- ----
1214 02-02-2020 00:00 amc2moodle/__init__.py
23 02-02-2020 00:00 amc2moodle/_version.py
14865 02-02-2020 00:00 amc2moodle/amc2moodle/README.md
0 02-02-2020 00:00 amc2moodle/amc2moodle/__init__.py
16347 02-02-2020 00:00 amc2moodle/amc2moodle/amc2moodle_class.latexml.log
14237 02-02-2020 00:00 amc2moodle/amc2moodle/amc2moodle_class.py
9030 02-02-2020 00:00 amc2moodle/amc2moodle/automultiplechoice.sty.ltxml
43296 02-02-2020 00:00 amc2moodle/amc2moodle/convert.py
2350 02-02-2020 00:00 amc2moodle/amc2moodle/fp.sty.ltxml
370 02-02-2020 00:00 amc2moodle/amc2moodle/mhchem.sty.ltxml
4864 02-02-2020 00:00 amc2moodle/amc2moodle/transform.xslt
15439 02-02-2020 00:00 amc2moodle/amc2moodle/transform2html.xslt
741 02-02-2020 00:00 amc2moodle/amc2moodle/transform_ns.xslt
4581 02-02-2020 00:00 amc2moodle/amc2moodle/transform_qtype.xslt
6893 02-02-2020 00:00 amc2moodle/amc2moodle/bin/amc2moodle.py
3606 02-02-2020 00:00 amc2moodle/moodle2amc/README.md
169 02-02-2020 00:00 amc2moodle/moodle2amc/__init__.py
24322 02-02-2020 00:00 amc2moodle/moodle2amc/_questions.py
13056 02-02-2020 00:00 amc2moodle/moodle2amc/_quiz.py
5691 02-02-2020 00:00 amc2moodle/moodle2amc/html2tex.xslt
2708 02-02-2020 00:00 amc2moodle/moodle2amc/struc2tex.xslt
5905 02-02-2020 00:00 amc2moodle/moodle2amc/bin/moodle2amc.py
1512 02-02-2020 00:00 amc2moodle/tests/__init__.py
18807 02-02-2020 00:00 amc2moodle/tests/test_amc2moodle.py
4200 02-02-2020 00:00 amc2moodle/tests/test_moodle2amc.py
7532 02-02-2020 00:00 amc2moodle/tests/test_utils_calculatedParser.py
2616 02-02-2020 00:00 amc2moodle/tests/test_utils_text.py
1312 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/4.png
187722 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM.pdf
2981 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM.tex
63905 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM.xml
14198 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM_iptjftm5_magic.tex
2983 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.tex
59980 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz.xml
13737 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/QCM_wo-tikz_9tvop5bq_magic.tex
3143 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/cleaning.tex
2171 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/cleaning.xml
3143 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/cleaning_8e6huv9h_magic.tex
10906 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/common-bank.tex
2573 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/element.tex
440 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/includestyles.tex
4397 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/numerical.tex
4392 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/numerical.xml
484 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/tikz.tex
2370 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/xmlclean67042zf5
3386 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/Figures/tinymonk.pdf
3896 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/Figures/other/4r.png
14813 02-02-2020 00:00 amc2moodle/tests/payload_test_amc2moodle/Figures/other/schema_interpL.png
48501 02-02-2020 00:00 amc2moodle/tests/payload_test_moodle2amc/automultiplechoice.sty
141172 02-02-2020 00:00 amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.pdf
10728 02-02-2020 00:00 amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.tex
29495 02-02-2020 00:00 amc2moodle/tests/payload_test_moodle2amc/moodle-bank-exemple.xml
0 02-02-2020 00:00 amc2moodle/utils/__init__.py
18196 02-02-2020 00:00 amc2moodle/utils/calculatedParser.py
6151 02-02-2020 00:00 amc2moodle/utils/customLogging.py
5658 02-02-2020 00:00 amc2moodle/utils/flatex.py
2891 02-02-2020 00:00 amc2moodle/utils/misc.py
2656 02-02-2020 00:00 amc2moodle/utils/text.py
50136 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/METADATA
87 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/WHEEL
126 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/entry_points.txt
35139 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/licenses/LICENSE
6316 02-02-2020 00:00 amc2moodle-2.11.0.dist-info/RECORD
--------- -------
984558 63 files
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.
Note in the second case, 3 addtional files that are not managed by VCS (*_magic.tex
and xmlcleanXXX
). So we can use ignore-vcs=false
.
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.
yep, with a clean working environment :-)
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.
In my case, when I ran thes tests, my cwd was not clean at all but I obtain the previous results.
…it) using ignore-vcs = false
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.
Good job !
I listed few small points in the review that could be clean-up.
amc2moodle/tests/__init__.py
Outdated
from .test_utils_calculatedParser import * | ||
from .test_utils_text import * | ||
# import glob | ||
# import unittest |
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.
Not sure it is required.
hatch test
works without these four lines
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.
I clean the __init__.py
. Note that pytest --pyargs amc2moodle
will continue to work properly.
[tool.hatch.build] | ||
packages = ["amc2moodle"] | ||
# only-packages = true | ||
ignore-vcs = false |
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.
With this all files in the source tree not filtered with the .gitignore are included in the sdist and in the whl.
The approach with the include seems perhaps better finally.
include =[
"LICENSE",
"README.md",
"amc2moodle/moodle2amc/README.md",
"amc2moodle/amc2moodle/README.md",
"amc2moodle/amc2moodle/bin/amc2moodle",
"amc2moodle/amc2moodle/*.xslt",
"amc2moodle/amc2moodle/*sty.ltxml",
"tests/payload_test_amc2moodle/Figures/*",
"tests/payload_test_amc2moodle/Figures/other/*",
"tests/payload_test_amc2moodle/4.png",
"tests/payload_test_amc2moodle/QCM.pdf",
"tests/payload_test_amc2moodle/QCM.tex",
"tests/payload_test_amc2moodle/QCM.xml",
"tests/payload_test_amc2moodle/QCM_wo-tikz.tex",
"tests/payload_test_amc2moodle/QCM_wo-tikz.xml",
"tests/payload_test_amc2moodle/tikz.tex",
"tests/payload_test_amc2moodle/common-bank.tex",
"tests/payload_test_amc2moodle/numerical.tex",
"tests/payload_test_amc2moodle/numerical.xml",
"tests/payload_test_amc2moodle/cleaning.tex",
"tests/payload_test_amc2moodle/cleaning.xml",
"tests/payload_test_amc2moodle/element.tex",
"tests/payload_test_amc2moodle/includestyles.tex",
"amc2moodle/moodle2amc/bin/moodle2amc",
"amc2moodle/moodle2amc/html2tex.xslt",
"amc2moodle/moodle2amc/struc2tex.xslt",
"tests/payload_test_moodle2amc/automultiplechoice.sty",
"tests/payload_test_moodle2amc/moodle-bank-exemple.xml",
"tests/payload_test_moodle2amc/moodle-bank-exemple.tex",
"tests/payload_test_moodle2amc/moodle-bank-exemple.pdf"]
doesn't seems to prevent other files to be added.
@@ -34,6 +34,15 @@ | |||
# Catch Logger | |||
Logger = logObj.getLogger() | |||
|
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.
In all test files, I suggest to remove __NAME__
and to use _NAME
.
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.
fixed
[tool.hatch.build] | ||
packages = ["amc2moodle"] | ||
# only-packages = true | ||
ignore-vcs = false |
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.
I was expecting that hatch can use .gitignore filter + use only tracked file but it doesn't seem possible. To build, a clean working directory is still needed :-(
So finally gitignore seems perhaps the simplest way...
amc2moodle/tests/test_moodle2amc.py
Outdated
@@ -47,17 +58,25 @@ class TestSuite(unittest.TestCase): | |||
teacher / sandbox | |||
|
|||
""" | |||
|
|||
@decorator_set_cwd(__OUTPUT_TEST_DIR__) |
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.
We need to check if it is really required.
If it is required, could you add a comment mentioning the reason (the latex compilation ?)
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.
Currently required by the LaTeX compilation (in order to find package automultiplechoice
during testing). Could be remove with resolving #86 (proposing of fix are in branch branch fix-artifacts-behavior
. Comment added
amc2moodle/tests/test_moodle2amc.py
Outdated
@@ -19,10 +19,11 @@ | |||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
""" | |||
from amc2moodle.utils.customLogging import customLogger | |||
from amc2moodle.amc2moodle.test import check_hash | |||
from amc2moodle.utils.misc import check_hash, for_all_methods, decorator_set_cwd |
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.
for_all_methods
imported but not used.
If you modified the file, there is few whitespace on blank lines
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.
done
|
||
# Distribution / packaging | ||
*.egg-info/ | ||
build/ | ||
dist/ | ||
|
||
# pdoc |
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.
# tests
output_tests/*
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.
done
command_line = "-m unittest discover -s amc2moodle/tests/" | ||
|
||
[tool.coverage.html] | ||
directory = "coverage_html_report" |
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.
I didn't see how to see the html report with hatch.
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.
you can run hatch run coverage html
. Improvement of coverage support are proposed in #92 other extension could be to redefine hatch test
based on pypa/hatch#1477
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.
or maybe hatch test -c
…s and formatting issues
For me it is fine. Thanks! I let you merge the PR if you have few things to polish. |
The main idea is to use more moderne approach based on hatch PDM. This approach allow to use for instance the following commands: