breadcrumb

joined 1 year ago
 

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?

 

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.

[–] breadcrumb 4 points 1 year ago

Oh I didn't consider these fields. When I see a company for hardware products I always think they're gonna make you program some microcontrollers or similar, with no OS involved. But it's true that many of them need to develop at least some software to interface with a OS. Thanks for sharing.

[–] breadcrumb 3 points 1 year ago

Yeah I know that JS and electron took over desktop development as well, so maybe it's worth investing some time in learning JS as well. Thanks for sharing.

 

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.

[–] breadcrumb 2 points 1 year ago* (last edited 1 year ago)

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!

[–] breadcrumb 1 points 1 year ago (2 children)

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.

 

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
[–] breadcrumb 2 points 1 year ago (1 children)

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 :/

 

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?

[–] breadcrumb 5 points 1 year ago* (last edited 1 year ago)

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.

[–] breadcrumb 1 points 1 year ago

Yeah well I don't use flatpaks that much so I had no clue about it.

[–] breadcrumb 1 points 1 year ago* (last edited 1 year ago) (3 children)

I found out the issue was in the launcher I installed. I tried to look at the Game Directory but the launcher wouldn't open it. I then installed a launcher from another surce, which was the one recommended by the minecraft website (I know I should have used that from the beginning), and the game was correctly installed in the right directory. I was then able to see all my previous worlds correctly. For Arch linux users: the Flatpak version of the launcher didn't work correctly, at least for me, the AUR package is the correct one.

[–] breadcrumb 1 points 1 year ago

I could but my home folder is pretty big, launching a search process throughout the home or the whole system would take ages so I would like to avoid it if possible...but I can try if there is no other solution.

 

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?

[–] breadcrumb 1 points 1 year ago

Yeah I agree, it seems it came out last year so I was a bit puzzled I never heard of it, especially if the performance is as good as they say in the website.

 

I recently found out about this free AI assitant, which seems too good to be true, does any of you have any experience with it? Is it good?

[–] breadcrumb 4 points 1 year ago

I agree with AnuPpuccin + Style Settings beign an amazing combo, been using Catppuccin for a while before discovering that wonderful theme.

view more: next ›