Run from project root directory:
. ./setup_dev_env.shsource venv/bin/activateThis will create a new venv and run pip install -r requirements-dev.txt.
Last line shows how to activate the environment.
To ensure code quality we use pre-commit hook with several checks. Setup it by:
pre-commit installAll updated files will be reformatted and linted before the commit.
Reformat and lint all files in the project:
pre-commit run --all-filesThe used linters are configured in .pre-commit-config.yaml. You can use pre-commit autoupdate to bump tools to the latest versions.
When you install project's package add below code (before imports) in your notebook:
# Load the "autoreload" extension
%load_ext autoreload
# Change mode to always reload modules: you change code in src, it gets loaded
%autoreload 2
Read more about different modes in documentation.
All code should be in src/ to make reusability and review straightforward, keep notebooks simple for exploratory data analysis.
See also Cookiecutter Data Science opinion.
In docs/ directory are Sphinx RST/Markdown files.
Build documentation locally:
./build_docs.shThen open public/index.html file.
Please read the official Sphinx documentation for more details.
Github Actions pipelines have documentation workflow which will build sphinx documentation automatically on release branch - and it will push it to a branch - it can be hosted on Github Pages if you enable it.
To access it, you need to enable it, on Github repository -> Settings -> Pages page select Deploy from a branch and select gh-pages. Link will appear here after deployment.
Please read more about it here.
To bump version of the library please use bump2version which will update all version strings.
NOTE: Configuration is in .bumpversion.cfg and this is a main file defining version which should be updated only with bump2version.
For convenience there is bash script which will create commit, to use it call:
./bump_version.sh minor./bump_version.sh major./bump_version.sh patchto see what is going to change run:
./bump_version.sh --dry-run majorScript updates VERSION file and setup.cfg automatically uses that version.
Follow these steps to build your Python package and upload a new version to PyPI:
-
Commit the latest changes Ensure all your recent changes are committed to your local repository.
-
Bump the package version Run the version bump script:
./bump_version.sh {minor/major/patch} -
Commit the version bump Add and commit the version change to your repository.
-
Remove the
distdirectory Delete the existingdistdirectory to clean previous builds. -
Build the package Create the source and wheel distributions using the
buildpackage:python -m build
-
Publish the package Upload the new version to PyPI using Twine:
twine upload dist/* -
Push to the remote GitHub repository Push all your commits to the remote repository.
