setuptools

Execute post installation task with pip

本小妞迷上赌 提交于 2021-02-19 08:19:16
问题 My Project Tree Structure . ├── example.gif ├── funmotd │ ├── config.json │ ├── __init__.py │ └── quotes_db.py ├── LICENSE ├── README.md └── setup.py setup.py (Removed some code in order to have less code) import sys import os import setuptools from setuptools.command.install import install class PostInstall(install): def run(self): mode = 0o666 bashrc_file = os.path.join(os.path.expanduser('~'), ".bashrc") install.run(self) # Added CLI to .bashrc # Change "config.json" file permission

Check whether a python package has been installed in 'editable' (egg-link) mode or not?

江枫思渺然 提交于 2021-02-19 02:15:38
问题 Is there any way to check whether a Python package has been installed normally ( pip install / setup.py install ) or in editable/egg-link mode ( pip install -e / setup.py develop )? I know I could check whether the path to the package contains site-packages which would most likely mean it's a "non-editable" install, but this feels extremely dirty and I would rather avoid this. The reason I'm trying to check this is that my application is checking for config files in various places, such as

Basic tox setup to test a package

别来无恙 提交于 2021-02-17 01:59:53
问题 I am trying to use tox to test a package I am writing and I cannot get it to work. My setup.cfg contains the following section: [tox] envlist = py36,py37,py36-black [testenv] deps = pytest commands = pytest tests [testenv:py36-black] deps = black flake8 flake8-black mypy commands = black --check --diff setup.py mypackage tests flake8 mypackage tests mypy mypackage tests I have a setup.py file to install my module, and if I run pip install -e . , everything works well and I can use the module

How to share a C-singleton between multiple C-extensions

冷暖自知 提交于 2021-02-15 05:16:44
问题 I have a static library (or a bunch of c/cpp-files for that matter) which contains a singleton and is used by/linked to two different C-extensions. However, the singleton from the C-library doesn't behave like a singleton anymore: import getter import setter # set singleton: setter.set(21) # get singleton: print("singleton: ", getter.get()) #prints the old value:42 Here is a minimal example illustrating this problem using Cython for the sake of simplicity (all files are in the same folder): C

How to share a C-singleton between multiple C-extensions

我与影子孤独终老i 提交于 2021-02-15 05:16:24
问题 I have a static library (or a bunch of c/cpp-files for that matter) which contains a singleton and is used by/linked to two different C-extensions. However, the singleton from the C-library doesn't behave like a singleton anymore: import getter import setter # set singleton: setter.set(21) # get singleton: print("singleton: ", getter.get()) #prints the old value:42 Here is a minimal example illustrating this problem using Cython for the sake of simplicity (all files are in the same folder): C

How to share a C-singleton between multiple C-extensions

十年热恋 提交于 2021-02-15 05:14:48
问题 I have a static library (or a bunch of c/cpp-files for that matter) which contains a singleton and is used by/linked to two different C-extensions. However, the singleton from the C-library doesn't behave like a singleton anymore: import getter import setter # set singleton: setter.set(21) # get singleton: print("singleton: ", getter.get()) #prints the old value:42 Here is a minimal example illustrating this problem using Cython for the sake of simplicity (all files are in the same folder): C

Cython binary package compile issues

家住魔仙堡 提交于 2021-02-11 18:24:46
问题 I would like to compile a python3 package into a distributable binary form (without sourcecode) from within the x64 Native Tools Command Prompt for VS 2019 using python 3.6 (64bit). However, i have problems specifying the correct paths to the files the package should contain. The produced folder structure in the site-packages directory is all wrong and not what i expect from my source folder structure and my setup.py . It seems for me that the modules from the top level package are treated

Cython binary package compile issues

[亡魂溺海] 提交于 2021-02-11 18:24:13
问题 I would like to compile a python3 package into a distributable binary form (without sourcecode) from within the x64 Native Tools Command Prompt for VS 2019 using python 3.6 (64bit). However, i have problems specifying the correct paths to the files the package should contain. The produced folder structure in the site-packages directory is all wrong and not what i expect from my source folder structure and my setup.py . It seems for me that the modules from the top level package are treated

Add custom action to setup.py

狂风中的少年 提交于 2021-02-10 15:52:41
问题 I have the project with such structure: Project/ Project/ __init__.py config.py setup.py .gitignore config.py contains two variables ( LOGIN , PASS ) and is added to .gitignore . I would like to add custom action to setup.py then run python setup.py install than triggered creating config.py with some inputs("Please write your login/pass") prior to installation of package. How to do it right? 回答1: It is not a good idea to do any customization at install time . It is good practice to do

Add custom action to setup.py

為{幸葍}努か 提交于 2021-02-10 15:48:38
问题 I have the project with such structure: Project/ Project/ __init__.py config.py setup.py .gitignore config.py contains two variables ( LOGIN , PASS ) and is added to .gitignore . I would like to add custom action to setup.py then run python setup.py install than triggered creating config.py with some inputs("Please write your login/pass") prior to installation of package. How to do it right? 回答1: It is not a good idea to do any customization at install time . It is good practice to do