home.social

#pyprojecttoml — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #pyprojecttoml, aggregated by home.social.

  1. Every 2 years releases a new LTS version requiring a new version, (with new version), that requires rebuilding my robot Dave and revisiting my installer for the robot hardware Python API, robot files, and sensors.

    For years I wondered why I could not just apt install a deb file, or just build a ?

    So I built each. Now understand why I must use an install script.

    devs were genius!

    The market is a mess.

  2. My day job is all about #Python (which I love). Here are some personal rules, specific to working with Python projects:

    * Do **not** install or modify global tools, especially Python itself or any packages. This means a given system might not even **have** a global Python
    * Always use virtual environments (`uv` agrees with me, and doesn't need this but). I always set the global environment variable `PIP_REQUIRE_VIRTUALENV`.
    * The two rules above mean my virtual environment contains (not via a link, it's really there) Python itself (and of course, of the right version)
    * Virtual environments always live **inside** a project directory. Never global.
    * Activate virtual environments only **inside** the project directory (`direnv` #direnv makes this easy)
    * Don't install (let alone use) #Anaconda, #Miniconda, or #Mamba, because those violate all the rules above (but see the next rule)
    * Anaconda-based packages implies a `pixi` #Pixi project (it's the same people, but a better answer, and you still get what you want -- the correct packages)
    * No Anaconda-based packages implies a `uv` #UV project
    * Always use `pyproject.toml` #pyprojecttoml over any other config file (e.g., `requirements.txt` #requirementstxt), except where things just don't work, such as needing `pyrefly.toml`
    * `uv`, `pixi`, and `direnv` must exist outside of any project, so install them at the user level, or else globally if and only if that is appropriate and compelling enough to override rule one

    That was a wall of text, but in practice doing it this way is trivial. It's probably **less** work than you have been doing. This post is just about managing your Python versions, environments, and projects. Not about, e.g., using `pre-commit` #precommit, or doing type checking, etc. But if you follow these rules, your work will be easier, faster, more adaptable, and encounter fewer obstacles.

    #HowTo

  3. My day job is all about #Python (which I love). Here are some personal rules, specific to working with Python projects:

    * Do **not** install or modify global tools, especially Python itself or any packages. This means a given system might not even **have** a global Python
    * Always use virtual environments (`uv` agrees with me, and doesn't need this but). I always set the global environment variable `PIP_REQUIRE_VIRTUALENV`.
    * The two rules above mean my virtual environment contains (not via a link, it's really there) Python itself (and of course, of the right version)
    * Virtual environments always live **inside** a project directory. Never global.
    * Activate virtual environments only **inside** the project directory (`direnv` #direnv makes this easy)
    * Don't install (let alone use) #Anaconda, #Miniconda, or #Mamba, because those violate all the rules above (but see the next rule)
    * Anaconda-based packages implies a `pixi` #Pixi project (it's the same people, but a better answer, and you still get what you want -- the correct packages)
    * No Anaconda-based packages implies a `uv` #UV project
    * Always use `pyproject.toml` #pyprojecttoml over any other config file (e.g., `requirements.txt` #requirementstxt), except where things just don't work, such as needing `pyrefly.toml`
    * `uv`, `pixi`, and `direnv` must exist outside of any project, so install them at the user level, or else globally if and only if that is appropriate and compelling enough to override rule one

    That was a wall of text, but in practice doing it this way is trivial. It's probably **less** work than you have been doing. This post is just about managing your Python versions, environments, and projects. Not about, e.g., using `pre-commit` #precommit, or doing type checking, etc. But if you follow these rules, your work will be easier, faster, more adaptable, and encounter fewer obstacles.

    #HowTo

  4. My day job is all about (which I love). Here are some personal rules, specific to working with Python projects:

    * Do **not** install or modify global tools, especially Python itself or any packages. This means a given system might not even **have** a global Python
    * Always use virtual environments (`uv` agrees with me, and doesn't need this but). I always set the global environment variable `PIP_REQUIRE_VIRTUALENV`.
    * The two rules above mean my virtual environment contains (not via a link, it's really there) Python itself (and of course, of the right version)
    * Virtual environments always live **inside** a project directory. Never global.
    * Activate virtual environments only **inside** the project directory (`direnv` makes this easy)
    * Don't install (let alone use) , , or , because those violate all the rules above (but see the next rule)
    * Anaconda-based packages implies a `pixi` project (it's the same people, but a better answer, and you still get what you want -- the correct packages)
    * No Anaconda-based packages implies a `uv` project
    * Always use `pyproject.toml` over any other config file (e.g., `requirements.txt` ), except where things just don't work, such as needing `pyrefly.toml`
    * `uv`, `pixi`, and `direnv` must exist outside of any project, so install them at the user level, or else globally if and only if that is appropriate and compelling enough to override rule one

    That was a wall of text, but in practice doing it this way is trivial. It's probably **less** work than you have been doing. This post is just about managing your Python versions, environments, and projects. Not about, e.g., using `pre-commit` , or doing type checking, etc. But if you follow these rules, your work will be easier, faster, more adaptable, and encounter fewer obstacles.

  5. My day job is all about #Python (which I love). Here are some personal rules, specific to working with Python projects:

    * Do **not** install or modify global tools, especially Python itself or any packages. This means a given system might not even **have** a global Python
    * Always use virtual environments (`uv` agrees with me, and doesn't need this but). I always set the global environment variable `PIP_REQUIRE_VIRTUALENV`.
    * The two rules above mean my virtual environment contains (not via a link, it's really there) Python itself (and of course, of the right version)
    * Virtual environments always live **inside** a project directory. Never global.
    * Activate virtual environments only **inside** the project directory (`direnv` #direnv makes this easy)
    * Don't install (let alone use) #Anaconda, #Miniconda, or #Mamba, because those violate all the rules above (but see the next rule)
    * Anaconda-based packages implies a `pixi` #Pixi project (it's the same people, but a better answer, and you still get what you want -- the correct packages)
    * No Anaconda-based packages implies a `uv` #UV project
    * Always use `pyproject.toml` #pyprojecttoml over any other config file (e.g., `requirements.txt` #requirementstxt), except where things just don't work, such as needing `pyrefly.toml`
    * `uv`, `pixi`, and `direnv` must exist outside of any project, so install them at the user level, or else globally if and only if that is appropriate and compelling enough to override rule one

    That was a wall of text, but in practice doing it this way is trivial. It's probably **less** work than you have been doing. This post is just about managing your Python versions, environments, and projects. Not about, e.g., using `pre-commit` #precommit, or doing type checking, etc. But if you follow these rules, your work will be easier, faster, more adaptable, and encounter fewer obstacles.

    #HowTo

  6. My day job is all about #Python (which I love). Here are some personal rules, specific to working with Python projects:

    * Do **not** install or modify global tools, especially Python itself or any packages. This means a given system might not even **have** a global Python
    * Always use virtual environments (`uv` agrees with me, and doesn't need this but). I always set the global environment variable `PIP_REQUIRE_VIRTUALENV`.
    * The two rules above mean my virtual environment contains (not via a link, it's really there) Python itself (and of course, of the right version)
    * Virtual environments always live **inside** a project directory. Never global.
    * Activate virtual environments only **inside** the project directory (`direnv` #direnv makes this easy)
    * Don't install (let alone use) #Anaconda, #Miniconda, or #Mamba, because those violate all the rules above (but see the next rule)
    * Anaconda-based packages implies a `pixi` #Pixi project (it's the same people, but a better answer, and you still get what you want -- the correct packages)
    * No Anaconda-based packages implies a `uv` #UV project
    * Always use `pyproject.toml` #pyprojecttoml over any other config file (e.g., `requirements.txt #requirementstxt), except where things just don't work, such as needing `pyrefly.toml`
    * `uv`, `pixi`, and `direnv` must exist outside of any project, so install them at the user level, or else globally if and only if that is appropriate and compelling enough to override rule one

    That was a wall of text, but in practice doing it this way is trivial. It's probably **less** work than you have been doing. This post is just about managing your Python versions, environments, and projects. Not about, e.g., using `pre-commit` #precommit, or doing type checking, etc. But if you follow these rules, your work will be easier, faster, more adaptable, and encounter fewer obstacles.

    #HotTo

  7. Tonight's example, that finally got me to toot about it... packaging.

    The #poetry documentation for #pyproject.toml describes the #include and #exclude config lists. exclude is #automagically pre-populated with the entries from your VCS ignore file, but, and I quote:

    "Explicitly declaring entries in include will negate VCS' ignore settings."

    Wanna bet on it? I have an entry in my .gitignore file for `docs`. I explicitly list it in `include`.

    3/x

    #TOML #PyProjectTOML

  8. I want #pixi to build me a vent. I’ll use it in #pycharm to start but later #pyinstaller. Pixi wants to build things. It’s mad about A which can’t be built. It’s mad about my app, down inside B. Doesn’t like that my #pyprojecttoml is not at the top of B. Doesn’t like that my app can’t be built. My virtual environment has all the external packages it needs, but isn’t working in PyCharm because it doesn’t have any of the things I need from A.

    My app _will_ be getting a repo of its own.