Git Product home page Git Product logo

python-external-data-packaging-example's Introduction

Python External Data Packaging Example

This is a proof of concept that shows how to include auxiliary/external data in your Python wheels, without having to include that data in your source code directory. You can have that data in completely separate directories, and it will be installed into specific system directories from where you can access it.

Detailed Description

https://blag.kazeno.net/development/python/package-and-access-external-data-files-in-your-python-wheels-with-pdm

Instructions for Seeing It in Action

1. Download the repository files

The following instructions assume you're inside the repository's main directory, unless noted otherwise.

2. Install PDM

On your terminal:

pip install --upgrade pdm

3. Build the wheel package

On your terminal:

pdm build

This should create a file with .whl extension in the dist subdirectory.

4. Install the wheel

On your terminal:

pip install dist/%YOUR_WHEEL_FILE_NAME%

where you need to substitute %YOUR_WHEEL_FILE_NAME% for the filename of your wheel, which was created in the previous step.

5. Go into some other directory for testing

On your terminal:

cd %SOME_OTHER_DIRECTORY_PATH%

where you need to substitute %SOME_OTHER_DIRECTORY_PATH% for the path of some other directory, to test the installed package.

6. Run the package as a script

This is the easiest way to test, but of course you can now import the package into any scripts in your environment. On your terminal:

python -m awesome_package.awesome_module

This should copy the auxiliary data files into your testing directory, and print the outputs of the auxiliary scripts.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.