ClaasRostock / python_project_template

Template repository for a Python Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

my-package

my-package is an example package

my-package supports

  • ..

Installation

pip install my-package

Usage Example

API:

from my_package import ...

CLI:

my-package ...

For more examples and usage, please refer to my-package's documentation.

Development Setup

  1. Install Python 3.9 or higher, i.e. Python 3.10 or Python 3.11

  2. Update pip and setuptools:

    python -m pip install --upgrade pip setuptools
  3. 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
  4. 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 command nvidia-smi on your local system to find out the cuda version supported by the current graphics driver installed on your system. When then generating the pip 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 .
  5. Test that the installation works (in the my-package root folder):

    (.venv) $ pytest .

Meta

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

Contributing

  1. Fork it (https://github.com/Owner/my-package/fork)
  2. Create an issue in your GitHub repo
  3. Create your branch based on the issue number and type (git checkout -b issue-name)
  4. Evaluate and stage the changes you want to commit (git add -i)
  5. Commit your changes (git commit -am 'place a descriptive commit message here')
  6. Push to the branch (git push origin issue-name)
  7. Create a new Pull Request in GitHub

For your contribution, please make sure you follow the STYLEGUIDE before creating the Pull Request.

About

Template repository for a Python Project

License:MIT License


Languages

Language:Python 99.8%Language:Batchfile 0.2%