I've been coding small personal projects using conda for years. Recently I've been working on a higher volume of projects without the need for scientific packages, so I decided to switch over to standard Python. I am now using poetry as my package manager.
My development environment is working fine, and I'm liking poetry overall. But it's time to start rolling out my apps to several different machines. I'm letting some of my workmates use my apps. I don't know how to go about flowing my projects to them, as they are not developers.
Part of my app has a system_tray.py which loads on startup (windows), and is basically the launcher for all the additional *.py files that perform different functions. This is my issue that I need to solve during the small rollout.
system_tray.py
...
args = ['C:\\poetry\\Cache\\virtualenvs\\classroom-central-3HYMdsQi-py3.11\\Scripts\\python.exe',
'ixl_grade_input.py']
subprocess.call(args)
...
This obviously triggers the running of a separate *.py file. What I'm not sure of is what workflow would deal with this situation. How would I make this work in a development environment, and be able to roll this out into a production environment?
In my case, I can just manually modify everything and install Python on the individual machines along with pip install of the required modules.. but this can't be the way a real rollout would go, and I'm looking to learn a more efficient method.
I'm aware of, but have yet to use, a requirements.txt file. I first thought that perhaps you just setup virtualenvs to model after the production environment configurations. However, after trying to research this, it seems as though people roll their virtualenvs out into the production environments as well. I also understand that I can configure poetry config to install the venv into the project directory. Then just use a relative path in the "args"?
This is one workflow
pyproject.toml
poetry install
to create a Poetry environment (virtual environment under the hood)poetry run
command - they will automatically use the environment created with poetry install
Some examples how to add launch scripts to Poetry pyproject.toml
[tool.poetry.scripts]
trade-executor = 'tradeexecutor.cli.main:app'
get-latest-release = 'tradeexecutor.cli.latest_release:main'
prepare-docker-env = 'tradeexecutor.cli.prepare_docker_env:main'