I take my shitposts very seriously.

  • 41 Posts
  • 2.65K Comments
Joined 2 years ago
cake
Cake day: June 24th, 2023

help-circle






  • If you have to import a directory structure, you should make each directory a module by creating an __init__.py file in them, and use relative import statements. I usually have one main.py as the entry point, which imports a lib module that contains all of the program logic.

    ├── lib
    │   ├── __init__.py
    │   ├── module_content.py
    │   └── submodule
    │       ├── __init__.py
    │       └── submodule_content.py
    └── main.py
    

    You can import the lib directory as a module:

    main.py:

    from lib import some_fn
    

    Within any module, though, you should use relative import statements to import from files and submodules, and regular import statements to import packages from the system or the venv:

    lib/__init__.py:

    from .module_content import some_fn # import from a file
    from .submodule import some_other_fn # import from a submodule directory
    from os.path import join # import from an installed package
    

    Items that you define in __init__.py or import into it will be available to import from the module: from .submodule import some_fn. Otherwise, you can import an item from a file by specifying the full path: from .submodule.submodule_content import some_fn.

    You can also import an item from a parent package using the .. prefix: from ..some_other_submodule import some_fn.



  • The market share is never a precise number because not everybody is asked to do the hardware survey, and not everybody who is asked does. But the Linux userbase is small enough that “~3%” is in the ballpark.

    Version control of dependencies is not as difficult as it seems. Unix systems can easily implement bundled dependencies like Windows does, even without sandboxed or monolithic packaging formats. The important thing is to tell the dynamic linker (ld.so in Linux’s case) where to look for the library files, similar to how PATH is used to locate executables. This is similar to how containerization works to a lesser extent, and the Steam client actually does this by loading its own .so files from ~/.local/share/Steam/.... I’m sure there are additional challenges, my knowledge is superficial and approximate at best.

    But the point still stands: in most cases, Linux-native ports are simply not worth the effort, either because of limited resources in small teams, or because of profits in large studios. BG3 and Factorio are definite outliers.



  • From the sole developer responsible for Factorio’s Linux-native port: https://www.factorio.com/blog/post/fff-408

    “Why don’t most games support macOS and Linux?” is a sentiment I often see echoed across the internet. Supporting a new platform is a lot more than just changing some flags and hitting compile. Windows, macOS, Linux, and the Nintendo Switch all use different compilers, different implementations of the C++ standard library, and have different implementation quirks, bugs, and features. You need to set up CI for the new platform, expand your build system to support the new compiler(s) and architecture(s), and have at least one person on the team that cares enough about the platform to actively maintain it. If you are a video game, you will likely need to add support for another graphics backend (Vulkan or OpenGL) as well, since DirectX is Windows-exclusive.

    Many developers will take one look at the Windows market share and decide that it is not worth the trouble to support other platforms. Also, with the meteoric rise of the Steam Deck and Proton, it is easier than ever for game developers to ignore Linux support because Valve does some black magic that lets their game run anyway.

    The list of Linux-first games is so short it’s not even a factor. It’s very difficult to justify the additional effort of implementing a platform that serves exclusively the playerbase with a ~3% market share, especially when a different method exists to serve that same playerbase that works just as well and also serves the 90%+ with no additional effort.

    The article I linked also contains an explanation as to why GNOME’s decision to drop server-side decorations is fucking stupid.




  • That tells me you don’t understand what a “stable” release branch is. The Debian maintainers do a lot of work to ensure that the packages not only work, but work well together. They don’t introduce breaking changes during the lifecycle of a major branch. They add feature updates between point releases, and continuously release security updates.

    In the real world, that stability is a great value, especially in the server space. You’d be insane to use Arch as a production server, and I’m saying that as an Arch user.

    Something, something, sword of Damocles.


  • Very important! When mounting an NTFS filesystem that is also used by Windows, always specify the windows_names option, both in /etc/fstab and when using mount.ntfs.

    Windows is not fully compliant with the NTFS specs, which is a bloody genius move on Microsoft’s part. NTFS allows file names and paths to contain characters that are illegal in Windows, like the : character. If you create a file with such a name, it will make the volume unmountable. Ask me how I know. The windows_names option prevents that.



  • This is something the people of [email protected] are better suited to answer.

    In my personal opinion, for most home servers, the double redundancy of RAID 6 is more valuable than having a fully rebuilt array as soon as possible. If one member of a RAID 6 array fails, you’re still at an effective redundancy of a RAID 5. If one member of a RAID 5 array fails, you have zero redundancy until the hot spare is rebuilt.

    If energy consumption is also a factor, it’s worth keeping in mind that a hot spare can be powered down by the controller until it is needed.

    I’d personally go with RAID 6: 4 data + 2 distributed parity. That was the plan for my server too, but the motherboard only has four SATA ports and one had to be dedicated to the OS SSD.