If I want to develop a Python package which works only in Linux and macOS. How do I specify this restriction in Python Poetry?
How can I specify dependencies on operating system in Python Poetry?
6.2k views Asked by Benjamin Du AtThere are 2 answers
Jonathan Feenstra
On
Trove classifiers in the pyproject.toml file can be used to specify which operating systems are supported. For Linux and MacOS this would be:
[tool.poetry]
classifiers = [
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux"
]
This will however not prevent poetry from attempting to install the package on other platforms when the poetry install command is used. Support for platform-specific wheel tags has been suggested in GitHub issue #2051, which is on the to do list for poetry's 1.2 release at the time of writing.
To specify which platforms to install the package on as a dependency of another poetry project, environment markers can be used:
[tool.poetry.dependencies]
yourpackage = {version = "*", markers = "sys_platform == 'linux' or sys_platform == 'darwin'"}
Poetry will then ignore yourpackage when poetry install is used on other platforms, but not give any errors. If it is a hard dependency, it would therefore be better to indicate elsewhere which platforms are supported.
Related Questions in PYTHON
- How to store a date/time in sqlite (or something similar to a date)
- Instagrapi recently showing HTTPError and UnknownError
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": "
- Python Geopandas unable to convert latitude longitude to points
- Influence of Unused FFN on Model Accuracy in PyTorch
- Seeking Python Libraries for Removing Extraneous Characters and Spaces in Text
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Conda has two different python binarys (python and python3) with the same version for a single environment. Why?
- Problem with add new attribute in table with BOTO3 on python
- Can't install packages in python conda environment
- Setting diagonal of a matrix to zero
- List of numbers converted to list of strings to iterate over it. But receiving TypeError messages
- Basic Python Question: Shortening If Statements
- Python and regex, can't understand why some words are left out of the match
Related Questions in OPERATING-SYSTEM
- the end of the I/O operation is notified to the system by an interrupt.how much system time do the mentioned operations occupy?
- Problem on CPU scheduling algorithms in OS
- OS-wide text autocomplete service with popup
- mkssecreenshotmgr taking a screenshot
- How to prevent app from crashing on android emulator
- Is there a function to end a child process?
- Swapping a healthy and unallocated partition in Windows 10
- ubuntu OS : Why my battery is completely drained of in just 2 hours in suspend mode
- 1 filenames = [] 2 ----> 3 for file in os.zipfile('images.zip'):
- Worth it to access data by blocks on modern OS/hardware?
- How does outlook disable screenshot
- How can I enable my app to access a specific partition directory for reading and writing without showing popup to user?
- Exception of type 'System.Exception' was thrown. Error in Cosmos Project
- Maximum CPU Voltage reading
- Java: get username from uid
Related Questions in DEPENDENCIES
- I have hundreds of dependencies on my package.json file which I didn't install (npm and using Warp)
- Nest.js can't resolve dependencies of the external library's Reflector dependency
- c++ python ctypes dependency issues
- Why rebuild module does not recompile dependency module, but build module does in IntelliJ Idea?
- I need help to upgrade deprecated dependencies in an ASP.NET Core 8 Web API project
- libstdc++ dependency mismatch for applications
- Use Google Font Without Network Connection
- IServiceCollectionConfigurator' does not contain a definition for 'UsingRabbitMq'
- Understanding Modules, Dependencies, Libraries & Packages
- `go mod graph` doesn't seem to provide the full graph
- java.lang.NoSuchMethodError: org.glassfish.jersey.message.internal.HeaderUtils.createInbound()Ljakarta/ws/rs/core/AbstractMultivaluedMap;
- "Unable to generate SAFESEH image." but disabling SAFESEH breaks dependency links
- When or what makes gcc add dependencies?
- How can I change a dependencies for an installed Gem
- Java Maven Cannot Find Symbol on compile, but runs ok on debug
Related Questions in MARKERS
- Mark selected pixels in an image with circle
- Filter annotations with transforms on Plotly (R)
- matplotlib plot numpy array of images as markers
- Create a line plot connecting three points each having a different marker
- Leaflet Control Search: Search only markers which are currently visible on the map
- styling leaflet markers according to property in geojson file
- search markers with leaflet search
- Is there a way to view all custom marker icons in the Google maps javascript API?
- MapQuest, Leaflet - disable marker on directions layer
- Extra blank space around markers in plots with matplotlib
- Remove marker border/line in scatterplot plotly R
- Find the middle point between two markers in Leaflet
- Flutter Map<String, dynamic>: Issues to get data from Firestore
- How to show layer with markers and custom pictures with ngx-maplibre-gl
- clear() does not work for erasing markers while using Google Maps API
Related Questions in PYTHON-POETRY
- How to change default Python version for poetry?
- Poetry create new virtual environments after installing conda
- Docker, Multiple Poetry Stages, `six.moves` error
- Poetry packaging several dependencies
- Install xesmf with poetry
- Is there a way to "feature flag" python dependencies?
- Deploying to AWS through GitHub Actions and Python CDK
- Can't import libraries in jupyter notebook when in a poetry shell
- Why trying to build this python package returns "Backend 'poetry.core.masonry.api' is not available"
- CircleCI has entered an endless loop after I ran bumpversion
- Conventional commit type for library version bump
- Python's setuptools is failing to install at random in my Github Actions workflow
- Poetry: Poetry install -- with ui (ERROR: Group(s) not found: ui (via --with)
- PyTorch (supposedly) Incompatible with Torchvision in Docker when using Poetry
- How to control Python environment activation in a DevContainer in VS Code?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
In the documentation here, they mention environment markers are supported, you could use the
sys_platformmarker.