- Notifications
You must be signed in to change notification settings - Fork17
Dynamically create python functions with a proper signature.
License
smarie/python-makefun
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Small library to dynamically create python functions.
This is the readme for developers. The documentation for users is available here:https://smarie.github.io/python-makefun/
Contributions are welcome ! Simply fork this project on github, commit your contributions, and create pull requests.
Here is a non-exhaustive list of interesting open topics:https://github.com/smarie/python-makefun/issues
This project usesnox
to define all lifecycle tasks. In order to be able to run those tasks, you should create python 3.7 environment and install the requirements:
>>> conda create -n noxenv python="3.7">>> activate noxenv(noxenv) >>> pip install -r noxfile-requirements.txt
You should then be able to list all available tasks using:
>>> nox --listSessions defined in <path>\noxfile.py:* tests-2.7 -> Run the test suite, including test reports generation and coverage reports.* tests-3.5 -> Run the test suite, including test reports generation and coverage reports.* tests-3.6 -> Run the test suite, including test reports generation and coverage reports.* tests-3.8 -> Run the test suite, including test reports generation and coverage reports.* tests-3.7 -> Run the test suite, including test reports generation and coverage reports.- docs-3.7 -> Generates the doc and serves it on a local http server. Pass '-- build' to build statically instead.- publish-3.7 -> Deploy the docs+reports on github pages. Note: this rebuilds the docs- release-3.7 -> Create a release on github corresponding to the latest tag
This project usespytest
so runningpytest
at the root folder will execute all tests on current environment. However it is a bit cumbersome to manage all requirements by hand ; it is easier to usenox
to runpytest
on all supported python environments with the correct package requirements:
nox
Tests and coverage reports are automatically generated under./docs/reports
for one of the sessions (tests-3.7
).
If you wish to execute tests on a specific environment, use explicit session names, e.g.nox -s tests-3.6
.
This project usesmkdocs
to generate its documentation page. Therefore building a local copy of the doc page may be done usingmkdocs build -f docs/mkdocs.yml
. However once again things are easier withnox
. You can easily build and serve locally a version of the documentation site using:
>>> nox -s docsnox> Running session docs-3.7nox> Creating conda envin .nox\docs-3-7 with python=3.7nox> [docs] Installing requirements with pip: ['mkdocs-material','mkdocs','pymdown-extensions','pygments']nox> python -m pip install mkdocs-material mkdocs pymdown-extensions pygmentsnox> mkdocs serve -f ./docs/mkdocs.ymlINFO - Building documentation...INFO - Cleaning site directoryINFO - The following pages existin the docs directory, but are not includedin the"nav" configuration: - long_description.mdINFO - Documentation builtin 1.07 secondsINFO - Serving on http://127.0.0.1:8000INFO - Start watching changes...
While this is running, you can edit the files under./docs/
and browse the automatically refreshed documentation at the localhttp://127.0.0.1:8000 page.
Once you are done, simply hit<CTRL+C>
to stop the session.
Publishing the documentation (including tests and coverage reports) is done automatically bythe continuous integration engine, using thenox -s publish
session, this is not needed for local development.
This project usessetuptools_scm
to synchronise the version number. Therefore the following command should be used for development snapshots as well as official releases:python setup.py sdist bdist_wheel
. However this is not generally needed sincethe continuous integration engine does it automatically for us on git tags. For reference, this is done in thenox -s release
session.
Ax explained in github ('get commandline instructions'):
git checkout -b<git_name>-<feature_branch> maingit pull https://github.com/<git_name>/python-makefun.git<feature_branch> --no-commit --ff-only
if the second step does not work, do a normal auto-merge (do not userebase!):
git pull https://github.com/<git_name>/python-makefun.git<feature_branch> --no-commit
Finally review the changes, possibly perform some modifications, and commit.
About
Dynamically create python functions with a proper signature.