Category : python-packaging

Sorry for the confusing title. I tried at least! Here is my directory structure: root mypackage __init__.py module.py main.py module.py print(‘inside module.py’) __init__.py print(‘inside __init__’) from . import module as m main.py import mypackage print(mypackage.m) print(mypackage.module) # <— Why does it work? and the output: inside __init__ inside module.py <module ‘mypackage.module’ from ‘C:Users…mypackagemodule.py’> <module ‘mypackage.module’ ..

Read more

A project I contribute to is using a Rust language bindings library called UniFFI to create Python language bindings from Rust code. The crate produces a native library (say libtinymath.dylib) and a Python module (say tinymath.py which imports and uses the native library. The python package layout looks like this: ❯ tree . ├── src ..

Read more

So I’m trying to create a python package "package" that has many functions (.py files on the root directory) and submodules (other folders inside the root directory) generated by google-protobuf. I’m building the package using python -m build on the _output folder that contains the google-protobuf generated files. When I try to import the package ..

Read more

I’ve developed a Python-based simulator and want to package it for the use of public. Here is my setup.py: import os import setuptools from setuptools import setup from mypackage.version import __name__, __version__, __author__, __email__, __license__, __url__, __description__, __keywords__, __classifiers__, __python_requires__ # ——————————————————————————————————— # GENERAL # ——————————————————————————————————— thelibFolder = os.path.dirname(os.path.realpath(__file__)) requirementPath = thelibFolder + ‘/requirements.txt’ install_requires ..

Read more

I have developed a framework (Python package) which can be installed locally using the following command: pip install .[extra_requirements] # For example I run the following link whenever I have activated virtualenv and currently on the same directory of the root of project pip install .[mysql] And it works perfectly. But whenever I want to ..

Read more

I have a project with the following structure: run.py |— /models |——- /adaboost |———— Adaboost.py |———— EstimatorFactory.py (used in Adaboost.py) |——- /me |———— Me.py I already added my project path to $PYTHONPATH hoping absolute imports would work, but i had no success when doing, for instance: #run.py import models.adaboost.Adaboost.AdaboostClassifier #class inside Adaboost.py #or from models.adaboost.Adaboost ..

Read more

I have a project with the following structure: run.py |— /models |——- /adaboost |———— Adaboost.py |———— EstimatorFactory.py (used in Adaboost.py) |——- /me |———— Me.py If current python versions don’t require an __init__.py file, is there a way to define what is exported by a module (i.e. i would like /adaboost module to export AdaboostClassifier by ..

Read more

In my current working directory is a sub-directory cpuimlearn, having the following structure: $ tree cpuimlearn cpuimlearn ├── AdaBoostM1.py ├── DECOC.py ├── DOAO.py ├── factory.py ├── FocalBoost.py ├── ImECOC.py ├── __init__.py └── SAMME.py 0 directories, 8 files The file factory.py implements a class FAC such that: class FAC: def __init__(self): pass … So all other ..

Read more