my-package is an example package
my-package supports
- ..
pip install my-package
API:
from my_package import ...
CLI:
my-package ...
For more examples and usage, please refer to my-package's documentation.
-
Install Python 3.9 or higher, i.e. Python 3.10 or Python 3.11
-
Update pip and setuptools:
python -m pip install --upgrade pip setuptools
-
git clone the my-package repository into your local development directory:
git clone https://github.com/dnv-innersource/my-package path/to/your/dev/my-package
-
In the my-package root folder:
Create a Python virtual environment:
python -m venv .venv
Activate the virtual environment:
..on Windows:
> .venv\Scripts\activate.bat
..on Linux:
source .venv/bin/activate
Update pip and setuptools:
(.venv) $ python -m pip install --upgrade pip setuptools
(Optional) If you want PyTorch cuda support on your local machine (i.e. to use your GPU for torch operations), you should preferably install PyTorch with cuda support first, before installing all other dependendencies. On the official PyTorch website you can generate a pip install command matching your local machine's operating system, using a wizard. If you are on Windows, the resulting pip install command will most likely look something like this:
(.venv) $ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
Hint: If you are unsure which cuda version to indicate in above
pip install .. /cuXXX
command, you can use the shell commandnvidia-smi
on your local system to find out the cuda version supported by the current graphics driver installed on your system. When then generating thepip install
command with the wizard from the PyTorch website, select the cuda version that matches the major version of what your graphics driver supports (major version must match, minor version may deviate).Install my-package's dependencies.
(.venv) $ pip install -r requirements-dev.txt
This should return without errors.
Finally, install my-package itself, yet not as a regular package but as an editable package instead, using the pip install option -e:
(.venv) $ pip install -e .
-
Test that the installation works (in the my-package root folder):
(.venv) $ pytest .
Copyright (c) 2024 Owner . All rights reserved.
Author One - @LinkedIn - author.one@xyz.com
Author Two - @LinkedIn - author.two@xyz.com
Author Three - @LinkedIn - author.three@xyz.com
@TODO: (1) Adapt to chosen license (or delete if no license is applied).
@TODO: (2) Adapt or delete the license file (LICENSE.md)
@TODO: (3) Adapt or delete the license entry in setup.cfg
Distributed under the MIT license. See LICENSE for more information.
https://github.com/Owner/my-package
- Fork it (https://github.com/Owner/my-package/fork)
- Create an issue in your GitHub repo
- Create your branch based on the issue number and type (
git checkout -b issue-name
) - Evaluate and stage the changes you want to commit (
git add -i
) - Commit your changes (
git commit -am 'place a descriptive commit message here'
) - Push to the branch (
git push origin issue-name
) - Create a new Pull Request in GitHub
For your contribution, please make sure you follow the STYLEGUIDE before creating the Pull Request.