Skip Navigation
Unable to include data files in python package with setuptools.

I want to build a python package using setuptools. The folder structure of the project is the following (some non-essential parts have been deleted): energy-monitor ├── config │ ├── config.yml │ └── secrets.yml ├── data │ └── cpu_tdp.json ├── energy_monitor │ ├── core │ │ ├── gui.py │ │ ├── __init__.py │ ├── data │ │ └── tableExport.json │ ├── __init__.py │ ├── main.py │ └── utils │ ├── api_calls.py │ └── __init__.py ├── energy-monitor.py ├── LICENSE ├── MANIFEST.in ├── pyproject.toml ├── README.md └── requirements.txt

The content of the pyproject.toml file is the following (some non-essential parts have been deleted): ``` [build-system] requires = ["setuptools>=68.0"] build-backend = "setuptools.build_meta"

[project] name = "energy_monitor" version = "0.0.1" description = "Energy monitor" readme = "README.md" requires-python = ">=3.11" license = {text = "GPLv3"} classifiers = [ "Programming Language :: Python :: 3", "Operating System :: OS Independent", ] dynamic = ["dependencies"]

[tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]}

[tool.setuptools] packages = [ "energy_monitor", "energy_monitor.core", "energy_monitor.utils" ] include-package-data = true

[project.scripts] energy-monitor = "energy_monitor.main:main" ```

Finally, the content of the MANIFEST.in file is the following: include README.md include LICENSE graft config

I generate the package with python -m build and install the .tar.gz archive with pipx. According to setuptools documentation, I expect to find my config folder, together with README and LICENSE in the interpreter directory (site-packages) after the installation. However, this doesn't happen and I cannot run the app becase it complains that it doesn't find the config. What am I missing?

3
Suggestions for a good TUI library?

I'm learning C++ and as starting project I'd like to build a simple TUI program, something like neofetch. Do you have any suggestions of a good library I can use to manage the TUI? After some research I sumbled upon ncurses, which seems quite old tho, and notcurses, which to me looks quite cool. Which of the two would you recommend? Are there any better libraries? I thought that maybe, being quite widely used, ncurses is more worth learning, but I'm open to different opinions.

2
Is desktop development still a thing?

I don't have a CS background (I graduated in Neuroscience) but now I decided I want to attempt a carrer in software development. When I looked at the possible different types of software developer I felt that the one I was most attracted to was desktop developer or system developer. In general, I like creating programs than run offline on a local machine, or even dealing with the low level operating system stuff.

I altready know how to program in Python so I decided to start learning C++ as well since it feels like exactly the language that can be used for developing desktop apps or working with kernels. In general, I like the level of abstraction at which C++ works and I would like to keep working at that level.

However, when looking around for some jobs or in general talking with people who work in the IT field, I feel like most of the work of a developer is polarised between two extremes: either creating web apps using tons of different front-end and back-end frameworks, or working with embedded systems for different kind of electronic devices. C++ specifically seems to be used nothing more than for gaming and embedded systems nowadays (according to my very subjective impression ofc).

So my question is: is it still possible to find a job were the main task is to develop and/or maintain desktop apps? And if so, is C++ (or other languages that work at the same abstraction level like Rust) the right language to do this? Or maybe, given my lack of a CS education, it's easier to start as a webdev and maybe change later?

Sorry if I said some nonsense or trivial stuff but I just started to enter the IT world and I still don't have a clear idea on how the job market for SWD works.

0
ModuleNotFoundError when installing a package with entry points using pipx
  • Yeah sorry I expressed myself wrongly, I mean that it looked like pipx didn't install the package in the dedicated venv, and that was actually the case because I didn't specify which packages to install in the pyproject.toml file apparently. I substituted these lines:

    [tool.setuptools.packages.find]
    where = ["energymonitor"]
    
    [tool.setuptools.package-data]
    data = ["data/*"]
    

    with these lines:

    [tool.setuptools]
    packages = ["energymonitor"]
    include-package-data = true
    

    and it worked!

  • ModuleNotFoundError when installing a package with entry points using pipx
  • I tried to change both the project name, which was energy-monitor, and the package name (energymonitor) to be the same and I set both to energy_monitor, but nothing changes...but if I open the python shell in the same folder as the project I can import the energy_monitor package with no errors, as soon as I change folder it doesn't find the package anymore. It looks like it didn't install the package system wide, but I thought that pipx should handle these kind of things.

  • ModuleNotFoundError when installing a package with entry points using pipx

    I'm writing a python package that I would like to distribute as a standalone terminal app. The structure of the project folder is the following:

    energy-monitor/ -- config/ -- doc/ -- tests/ -- energymonitor/ ---- init.py -> (empty) ---- main.py -> def main() ---- data/ ---- ..other packages.. -- project.toml

    I'm using setuptools to generate a .tar.gz archive, some relevant parts of the project.toml file are: ``` [build-system] requires = ["setuptools>=68.0"] build-backend = "setuptools.build_meta"

    [project] name = "energy-monitor" version = "0.0.1"

    ...

    [tool.setuptools.packages.find] where = ["energymonitor"]

    [tool.setuptools.package-data] data = ["data/*"]

    [project.scripts] energy-monitor = "energymonitor.main:main" I generate the .tar.gz and the .whl files with the command `python -m build`, then I run `pipx install path/to/energy-monitor.tar.gz`. The installation is succesful, but when calling energy-monitor from the command line I get: Traceback (most recent call last): File "/home/mattia/.local/bin/energy-monitor", line 5, in <module> from energymonitor.main import main ModuleNotFoundError: No module named 'energymonitor' ``` Why is this happening? I was not able to find any helpful solution online. It's the first that I build a python package so sorry if the issue is trivial.

    • python version: 3.11.3
    7
    Unable to export plotly image with kaleido
  • Unfortunatly I'm not using any virtual environments, the packages are installed system-wide and I checked that the python version where the package is installed matched the one used by jupyter. Also, installing from jupyter didn't work either :/

  • Unable to export plotly image with kaleido

    Hi, I'm trying to save a plotly image as a static .svg file using kaleido. I have kaleido-0.2.1 installed, but when I run this code on jupyter: fig1.write_image("../figures/supp1A.svg", format="svg", engine="kaleido") I get this error: ValueError: Image export using the "kaleido" engine requires the kaleido package, which can be installed using pip: $ pip install -U kaleido

    Why does this happens even tho kaleido is installed?

    3
    Does it feel like the fediverse is exclusively used by older tech nerds?
  • As many, I fit the description except for the age, but I hope this monoculture thing goes away. I don't want an entire social network to be a huge bubble. If I want a bubble I join one of the many communities populated by people similar to me, but I want to have the chance to look "for something completely different", getting in touch with world views completely opposte to mine.

  • Minecraft 1.20 new installation: worlds not present in "saves" folder

    Hi, I recently re-installed minecraft after a long time not playing it. I'm using Manjaro linux as OS, which is different from the Linux distro I used in the past to play minecraft (I think it was Ubuntu). I have my old worlds (from v1.16) saved under ~/.minecraft/saves and I hoped they would appear again in the new installation after restoring this folder, but this isn't the case. Also, I created a new world in the new installation but it doesn't appear in the ~/.minecraft/saves folder. Where should I look for it? Is the location of the minecraft folder changed with the new releases?

    0
    breadcrumb breadcrumb @lemmy.world
    Posts 6
    Comments 4