diff --git a/2.10/404.html b/2.10/404.html deleted file mode 100644 index cd9141b095..0000000000 --- a/2.10/404.html +++ /dev/null @@ -1,885 +0,0 @@ - - - - - - - - - - - - - - - - - - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- -

404 - Not found

- -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/assets/_markdown_exec_ansi.css b/2.10/assets/_markdown_exec_ansi.css deleted file mode 100644 index 4c1b8a56e5..0000000000 --- a/2.10/assets/_markdown_exec_ansi.css +++ /dev/null @@ -1,266 +0,0 @@ -/* - Inspired by https://spec.draculatheme.com/ specification, they should work - decently with both dark and light themes. - */ -:root { - --ansi-red: #ff5555; - --ansi-green: #50fa7b; - --ansi-blue: #265285; - --ansi-yellow: #ffb86c; - --ansi-magenta: #bd93f9; - --ansi-cyan: #8be9fd; - --ansi-black: #282a36; - --ansi-white: #f8f8f2; -} - -.-Color-Green, -.-Color-Faint-Green, -.-Color-Bold-Green { - color: var(--ansi-green); -} - -.-Color-Red, -.-Color-Faint-Red, -.-Color-Bold-Red { - color: var(--ansi-red); -} - -.-Color-Yellow, -.-Color-Faint-Yellow, -.-Color-Bold-Yellow { - color: var(--ansi-yellow); -} - -.-Color-Blue, -.-Color-Faint-Blue, -.-Color-Bold-Blue { - color: var(--ansi-blue); -} - -.-Color-Magenta, -.-Color-Faint-Magenta, -.-Color-Bold-Magenta { - color: var(--ansi-magenta); -} - -.-Color-Cyan, -.-Color-Faint-Cyan, -.-Color-Bold-Cyan { - color: var(--ansi-cyan); -} - -.-Color-White, -.-Color-Faint-White, -.-Color-Bold-White { - color: var(--ansi-white); -} - -.-Color-Black, -.-Color-Faint-Black, -.-Color-Bold-Black { - color: var(--ansi-black); -} - -.-Color-Faint { - opacity: 0.5; -} - -.-Color-Bold { - font-weight: bold; -} - -.-Color-BGBlack, -.-Color-Black-BGBlack, -.-Color-Blue-BGBlack, -.-Color-Bold-BGBlack, -.-Color-Bold-Black-BGBlack, -.-Color-Bold-Green-BGBlack, -.-Color-Bold-Cyan-BGBlack, -.-Color-Bold-Blue-BGBlack, -.-Color-Bold-Magenta-BGBlack, -.-Color-Bold-Red-BGBlack, -.-Color-Bold-White-BGBlack, -.-Color-Bold-Yellow-BGBlack, -.-Color-Cyan-BGBlack, -.-Color-Green-BGBlack, -.-Color-Magenta-BGBlack, -.-Color-Red-BGBlack, -.-Color-White-BGBlack, -.-Color-Yellow-BGBlack { - background-color: var(--ansi-black); -} - -.-Color-BGRed, -.-Color-Black-BGRed, -.-Color-Blue-BGRed, -.-Color-Bold-BGRed, -.-Color-Bold-Black-BGRed, -.-Color-Bold-Green-BGRed, -.-Color-Bold-Cyan-BGRed, -.-Color-Bold-Blue-BGRed, -.-Color-Bold-Magenta-BGRed, -.-Color-Bold-Red-BGRed, -.-Color-Bold-White-BGRed, -.-Color-Bold-Yellow-BGRed, -.-Color-Cyan-BGRed, -.-Color-Green-BGRed, -.-Color-Magenta-BGRed, -.-Color-Red-BGRed, -.-Color-White-BGRed, -.-Color-Yellow-BGRed { - background-color: var(--ansi-red); -} - -.-Color-BGGreen, -.-Color-Black-BGGreen, -.-Color-Blue-BGGreen, -.-Color-Bold-BGGreen, -.-Color-Bold-Black-BGGreen, -.-Color-Bold-Green-BGGreen, -.-Color-Bold-Cyan-BGGreen, -.-Color-Bold-Blue-BGGreen, -.-Color-Bold-Magenta-BGGreen, -.-Color-Bold-Red-BGGreen, -.-Color-Bold-White-BGGreen, -.-Color-Bold-Yellow-BGGreen, -.-Color-Cyan-BGGreen, -.-Color-Green-BGGreen, -.-Color-Magenta-BGGreen, -.-Color-Red-BGGreen, -.-Color-White-BGGreen, -.-Color-Yellow-BGGreen { - background-color: var(--ansi-green); -} - -.-Color-BGYellow, -.-Color-Black-BGYellow, -.-Color-Blue-BGYellow, -.-Color-Bold-BGYellow, -.-Color-Bold-Black-BGYellow, -.-Color-Bold-Green-BGYellow, -.-Color-Bold-Cyan-BGYellow, -.-Color-Bold-Blue-BGYellow, -.-Color-Bold-Magenta-BGYellow, -.-Color-Bold-Red-BGYellow, -.-Color-Bold-White-BGYellow, -.-Color-Bold-Yellow-BGYellow, -.-Color-Cyan-BGYellow, -.-Color-Green-BGYellow, -.-Color-Magenta-BGYellow, -.-Color-Red-BGYellow, -.-Color-White-BGYellow, -.-Color-Yellow-BGYellow { - background-color: var(--ansi-yellow); -} - -.-Color-BGBlue, -.-Color-Black-BGBlue, -.-Color-Blue-BGBlue, -.-Color-Bold-BGBlue, -.-Color-Bold-Black-BGBlue, -.-Color-Bold-Green-BGBlue, -.-Color-Bold-Cyan-BGBlue, -.-Color-Bold-Blue-BGBlue, -.-Color-Bold-Magenta-BGBlue, -.-Color-Bold-Red-BGBlue, -.-Color-Bold-White-BGBlue, -.-Color-Bold-Yellow-BGBlue, -.-Color-Cyan-BGBlue, -.-Color-Green-BGBlue, -.-Color-Magenta-BGBlue, -.-Color-Red-BGBlue, -.-Color-White-BGBlue, -.-Color-Yellow-BGBlue { - background-color: var(--ansi-blue); -} - -.-Color-BGMagenta, -.-Color-Black-BGMagenta, -.-Color-Blue-BGMagenta, -.-Color-Bold-BGMagenta, -.-Color-Bold-Black-BGMagenta, -.-Color-Bold-Green-BGMagenta, -.-Color-Bold-Cyan-BGMagenta, -.-Color-Bold-Blue-BGMagenta, -.-Color-Bold-Magenta-BGMagenta, -.-Color-Bold-Red-BGMagenta, -.-Color-Bold-White-BGMagenta, -.-Color-Bold-Yellow-BGMagenta, -.-Color-Cyan-BGMagenta, -.-Color-Green-BGMagenta, -.-Color-Magenta-BGMagenta, -.-Color-Red-BGMagenta, -.-Color-White-BGMagenta, -.-Color-Yellow-BGMagenta { - background-color: var(--ansi-magenta); -} - -.-Color-BGCyan, -.-Color-Black-BGCyan, -.-Color-Blue-BGCyan, -.-Color-Bold-BGCyan, -.-Color-Bold-Black-BGCyan, -.-Color-Bold-Green-BGCyan, -.-Color-Bold-Cyan-BGCyan, -.-Color-Bold-Blue-BGCyan, -.-Color-Bold-Magenta-BGCyan, -.-Color-Bold-Red-BGCyan, -.-Color-Bold-White-BGCyan, -.-Color-Bold-Yellow-BGCyan, -.-Color-Cyan-BGCyan, -.-Color-Green-BGCyan, -.-Color-Magenta-BGCyan, -.-Color-Red-BGCyan, -.-Color-White-BGCyan, -.-Color-Yellow-BGCyan { - background-color: var(--ansi-cyan); -} - -.-Color-BGWhite, -.-Color-Black-BGWhite, -.-Color-Blue-BGWhite, -.-Color-Bold-BGWhite, -.-Color-Bold-Black-BGWhite, -.-Color-Bold-Green-BGWhite, -.-Color-Bold-Cyan-BGWhite, -.-Color-Bold-Blue-BGWhite, -.-Color-Bold-Magenta-BGWhite, -.-Color-Bold-Red-BGWhite, -.-Color-Bold-White-BGWhite, -.-Color-Bold-Yellow-BGWhite, -.-Color-Cyan-BGWhite, -.-Color-Green-BGWhite, -.-Color-Magenta-BGWhite, -.-Color-Red-BGWhite, -.-Color-White-BGWhite, -.-Color-Yellow-BGWhite { - background-color: var(--ansi-white); -} - -.-Color-Black, -.-Color-Bold-Black, -.-Color-Black-BGBlack, -.-Color-Bold-Black-BGBlack, -.-Color-Black-BGGreen, -.-Color-Red-BGRed, -.-Color-Bold-Red-BGRed, -.-Color-Bold-Blue-BGBlue, -.-Color-Blue-BGBlue { - text-shadow: 0 0 1px var(--ansi-white); -} - -.-Color-Bold-Cyan-BGCyan, -.-Color-Bold-Magenta-BGMagenta, -.-Color-Bold-White, -.-Color-Bold-Yellow-BGYellow, -.-Color-Bold-Green-BGGreen, -.-Color-Cyan-BGCyan, -.-Color-Cyan-BGGreen, -.-Color-Green-BGCyan, -.-Color-Green-BGGreen, -.-Color-Magenta-BGMagenta, -.-Color-White, -.-Color-White-BGWhite, -.-Color-Yellow-BGYellow { - text-shadow: 0 0 1px var(--ansi-black); -} \ No newline at end of file diff --git a/2.10/assets/_mkdocstrings.css b/2.10/assets/_mkdocstrings.css deleted file mode 100644 index a65078d025..0000000000 --- a/2.10/assets/_mkdocstrings.css +++ /dev/null @@ -1,36 +0,0 @@ - -/* Don't capitalize names. */ -h5.doc-heading { - text-transform: none !important; -} - -/* Avoid breaking parameters name, etc. in table cells. */ -.doc-contents td code { - word-break: normal !important; -} - -/* For pieces of Markdown rendered in table cells. */ -.doc-contents td p { - margin-top: 0 !important; - margin-bottom: 0 !important; -} - -/* Max width for docstring sections tables. */ -.doc .md-typeset__table, -.doc .md-typeset__table table { - display: table !important; - width: 100%; -} -.doc .md-typeset__table tr { - display: table-row; -} - -/* Avoid line breaks in rendered fields. */ -.field-body p { - display: inline; -} - -/* Defaults in Spacy table style. */ -.doc-param-default { - float: right; -} diff --git a/2.10/assets/extra.css b/2.10/assets/extra.css deleted file mode 100644 index bdb9e0eb8f..0000000000 --- a/2.10/assets/extra.css +++ /dev/null @@ -1,37 +0,0 @@ -a.pdm-expansions { - cursor: pointer; - font-weight: bold; - color: currentColor; -} - -.bot-container { - position: fixed; - width: 400px; - right: 20px; - bottom: 20px; - display: flex; - flex-direction: column; - align-items:end; -} - -.bot-container > iframe { - width:100%; - border:none; - border-radius:0.5rem; - transition: height 0.3s ease-in-out; - height: 0; -} -.bot-button { - padding: 0.8rem; - border-radius: 50%; - width: 80px; - height: 80px; - background-color: #7e56c2; - transition: all 0.2s ease-in-out; - fill: white; -} - -.bot-button:hover { - transform: translateY(-3px); - padding: 0.7rem; -} diff --git a/2.10/assets/extra.js b/2.10/assets/extra.js deleted file mode 100644 index 984bc6bace..0000000000 --- a/2.10/assets/extra.js +++ /dev/null @@ -1,36 +0,0 @@ -document.addEventListener('DOMContentLoaded', function () { - const expansionRepo = 'https://github.com/pdm-project/pdm-expansions'; - const expansionsApi = 'https://expansion.pdm-project.org/api/sample'; - const el = document.querySelector('a.pdm-expansions'); - - function loadExpansions() { - fetch(expansionsApi, { mode: 'cors', redirect: 'follow' }) - .then((response) => { - console.log(response); - return response.json(); - }) - .then((data) => { - window.expansionList = data.data; - setExpansion(); - }); - } - - function setExpansion() { - const { expansionList } = window; - if (!expansionList || !expansionList.length) { - window.location.href = expansionRepo; - return; - } - const expansion = expansionList[expansionList.length - 1]; - expansionList.splice(expansionList.length - 1, 1); - el.innerText = expansion; - if (el.style.display == 'none') { - el.style.display = ''; - } - } - loadExpansions(); - el.addEventListener('click', function (e) { - e.preventDefault(); - setExpansion(); - }); -}); diff --git a/2.10/assets/images/favicon.png b/2.10/assets/images/favicon.png deleted file mode 100644 index 1cf13b9f9d..0000000000 Binary files a/2.10/assets/images/favicon.png and /dev/null differ diff --git a/2.10/assets/javascripts/bundle.220ee61c.min.js b/2.10/assets/javascripts/bundle.220ee61c.min.js deleted file mode 100644 index 116072a11e..0000000000 --- a/2.10/assets/javascripts/bundle.220ee61c.min.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict";(()=>{var Ci=Object.create;var gr=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var ki=Object.getOwnPropertyNames,Ht=Object.getOwnPropertySymbols,Hi=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var rn=(e,t,r)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))yr.call(t,r)&&rn(e,r,t[r]);if(Ht)for(var r of Ht(t))nn.call(t,r)&&rn(e,r,t[r]);return e};var on=(e,t)=>{var r={};for(var n in e)yr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ht)for(var n of Ht(e))t.indexOf(n)<0&&nn.call(e,n)&&(r[n]=e[n]);return r};var Pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Pi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ki(t))!yr.call(e,o)&&o!==r&&gr(e,o,{get:()=>t[o],enumerable:!(n=Ri(t,o))||n.enumerable});return e};var yt=(e,t,r)=>(r=e!=null?Ci(Hi(e)):{},Pi(t||!e||!e.__esModule?gr(r,"default",{value:e,enumerable:!0}):r,e));var sn=Pt((xr,an)=>{(function(e,t){typeof xr=="object"&&typeof an!="undefined"?t():typeof define=="function"&&define.amd?define(t):t()})(xr,function(){"use strict";function e(r){var n=!0,o=!1,i=null,s={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function a(O){return!!(O&&O!==document&&O.nodeName!=="HTML"&&O.nodeName!=="BODY"&&"classList"in O&&"contains"in O.classList)}function f(O){var Qe=O.type,De=O.tagName;return!!(De==="INPUT"&&s[Qe]&&!O.readOnly||De==="TEXTAREA"&&!O.readOnly||O.isContentEditable)}function c(O){O.classList.contains("focus-visible")||(O.classList.add("focus-visible"),O.setAttribute("data-focus-visible-added",""))}function u(O){O.hasAttribute("data-focus-visible-added")&&(O.classList.remove("focus-visible"),O.removeAttribute("data-focus-visible-added"))}function p(O){O.metaKey||O.altKey||O.ctrlKey||(a(r.activeElement)&&c(r.activeElement),n=!0)}function m(O){n=!1}function d(O){a(O.target)&&(n||f(O.target))&&c(O.target)}function h(O){a(O.target)&&(O.target.classList.contains("focus-visible")||O.target.hasAttribute("data-focus-visible-added"))&&(o=!0,window.clearTimeout(i),i=window.setTimeout(function(){o=!1},100),u(O.target))}function v(O){document.visibilityState==="hidden"&&(o&&(n=!0),Y())}function Y(){document.addEventListener("mousemove",N),document.addEventListener("mousedown",N),document.addEventListener("mouseup",N),document.addEventListener("pointermove",N),document.addEventListener("pointerdown",N),document.addEventListener("pointerup",N),document.addEventListener("touchmove",N),document.addEventListener("touchstart",N),document.addEventListener("touchend",N)}function B(){document.removeEventListener("mousemove",N),document.removeEventListener("mousedown",N),document.removeEventListener("mouseup",N),document.removeEventListener("pointermove",N),document.removeEventListener("pointerdown",N),document.removeEventListener("pointerup",N),document.removeEventListener("touchmove",N),document.removeEventListener("touchstart",N),document.removeEventListener("touchend",N)}function N(O){O.target.nodeName&&O.target.nodeName.toLowerCase()==="html"||(n=!1,B())}document.addEventListener("keydown",p,!0),document.addEventListener("mousedown",m,!0),document.addEventListener("pointerdown",m,!0),document.addEventListener("touchstart",m,!0),document.addEventListener("visibilitychange",v,!0),Y(),r.addEventListener("focus",d,!0),r.addEventListener("blur",h,!0),r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host?r.host.setAttribute("data-js-focus-visible",""):r.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window!="undefined"&&typeof document!="undefined"){window.applyFocusVisiblePolyfill=e;var t;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(r){t=document.createEvent("CustomEvent"),t.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}typeof document!="undefined"&&e(document)})});var cn=Pt(Er=>{(function(e){var t=function(){try{return!!Symbol.iterator}catch(c){return!1}},r=t(),n=function(c){var u={next:function(){var p=c.shift();return{done:p===void 0,value:p}}};return r&&(u[Symbol.iterator]=function(){return u}),u},o=function(c){return encodeURIComponent(c).replace(/%20/g,"+")},i=function(c){return decodeURIComponent(String(c).replace(/\+/g," "))},s=function(){var c=function(p){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var m=typeof p;if(m!=="undefined")if(m==="string")p!==""&&this._fromString(p);else if(p instanceof c){var d=this;p.forEach(function(B,N){d.append(N,B)})}else if(p!==null&&m==="object")if(Object.prototype.toString.call(p)==="[object Array]")for(var h=0;hd[0]?1:0}),c._entries&&(c._entries={});for(var p=0;p1?i(d[1]):"")}})})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er);(function(e){var t=function(){try{var o=new e.URL("b","http://a");return o.pathname="c d",o.href==="http://a/c%20d"&&o.searchParams}catch(i){return!1}},r=function(){var o=e.URL,i=function(f,c){typeof f!="string"&&(f=String(f)),c&&typeof c!="string"&&(c=String(c));var u=document,p;if(c&&(e.location===void 0||c!==e.location.href)){c=c.toLowerCase(),u=document.implementation.createHTMLDocument(""),p=u.createElement("base"),p.href=c,u.head.appendChild(p);try{if(p.href.indexOf(c)!==0)throw new Error(p.href)}catch(O){throw new Error("URL unable to set base "+c+" due to "+O)}}var m=u.createElement("a");m.href=f,p&&(u.body.appendChild(m),m.href=m.href);var d=u.createElement("input");if(d.type="url",d.value=f,m.protocol===":"||!/:/.test(m.href)||!d.checkValidity()&&!c)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:m});var h=new e.URLSearchParams(this.search),v=!0,Y=!0,B=this;["append","delete","set"].forEach(function(O){var Qe=h[O];h[O]=function(){Qe.apply(h,arguments),v&&(Y=!1,B.search=h.toString(),Y=!0)}}),Object.defineProperty(this,"searchParams",{value:h,enumerable:!0});var N=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==N&&(N=this.search,Y&&(v=!1,this.searchParams._fromString(this.search),v=!0))}})},s=i.prototype,a=function(f){Object.defineProperty(s,f,{get:function(){return this._anchorElement[f]},set:function(c){this._anchorElement[f]=c},enumerable:!0})};["hash","host","hostname","port","protocol"].forEach(function(f){a(f)}),Object.defineProperty(s,"search",{get:function(){return this._anchorElement.search},set:function(f){this._anchorElement.search=f,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(s,{toString:{get:function(){var f=this;return function(){return f.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(f){this._anchorElement.href=f,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(f){this._anchorElement.pathname=f},enumerable:!0},origin:{get:function(){var f={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],c=this._anchorElement.port!=f&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(c?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(f){},enumerable:!0},username:{get:function(){return""},set:function(f){},enumerable:!0}}),i.createObjectURL=function(f){return o.createObjectURL.apply(o,arguments)},i.revokeObjectURL=function(f){return o.revokeObjectURL.apply(o,arguments)},e.URL=i};if(t()||r(),e.location!==void 0&&!("origin"in e.location)){var n=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:n,enumerable:!0})}catch(o){setInterval(function(){e.location.origin=n()},100)}}})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er)});var qr=Pt((Mt,Nr)=>{/*! - * clipboard.js v2.0.11 - * https://clipboardjs.com/ - * - * Licensed MIT © Zeno Rocha - */(function(t,r){typeof Mt=="object"&&typeof Nr=="object"?Nr.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Mt=="object"?Mt.ClipboardJS=r():t.ClipboardJS=r()})(Mt,function(){return function(){var e={686:function(n,o,i){"use strict";i.d(o,{default:function(){return Ai}});var s=i(279),a=i.n(s),f=i(370),c=i.n(f),u=i(817),p=i.n(u);function m(j){try{return document.execCommand(j)}catch(T){return!1}}var d=function(T){var E=p()(T);return m("cut"),E},h=d;function v(j){var T=document.documentElement.getAttribute("dir")==="rtl",E=document.createElement("textarea");E.style.fontSize="12pt",E.style.border="0",E.style.padding="0",E.style.margin="0",E.style.position="absolute",E.style[T?"right":"left"]="-9999px";var H=window.pageYOffset||document.documentElement.scrollTop;return E.style.top="".concat(H,"px"),E.setAttribute("readonly",""),E.value=j,E}var Y=function(T,E){var H=v(T);E.container.appendChild(H);var I=p()(H);return m("copy"),H.remove(),I},B=function(T){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},H="";return typeof T=="string"?H=Y(T,E):T instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(T==null?void 0:T.type)?H=Y(T.value,E):(H=p()(T),m("copy")),H},N=B;function O(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(E){return typeof E}:O=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},O(j)}var Qe=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=T.action,H=E===void 0?"copy":E,I=T.container,q=T.target,Me=T.text;if(H!=="copy"&&H!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(q!==void 0)if(q&&O(q)==="object"&&q.nodeType===1){if(H==="copy"&&q.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(H==="cut"&&(q.hasAttribute("readonly")||q.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Me)return N(Me,{container:I});if(q)return H==="cut"?h(q):N(q,{container:I})},De=Qe;function $e(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$e=function(E){return typeof E}:$e=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},$e(j)}function Ei(j,T){if(!(j instanceof T))throw new TypeError("Cannot call a class as a function")}function tn(j,T){for(var E=0;E0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof I.action=="function"?I.action:this.defaultAction,this.target=typeof I.target=="function"?I.target:this.defaultTarget,this.text=typeof I.text=="function"?I.text:this.defaultText,this.container=$e(I.container)==="object"?I.container:document.body}},{key:"listenClick",value:function(I){var q=this;this.listener=c()(I,"click",function(Me){return q.onClick(Me)})}},{key:"onClick",value:function(I){var q=I.delegateTarget||I.currentTarget,Me=this.action(q)||"copy",kt=De({action:Me,container:this.container,target:this.target(q),text:this.text(q)});this.emit(kt?"success":"error",{action:Me,text:kt,trigger:q,clearSelection:function(){q&&q.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(I){return vr("action",I)}},{key:"defaultTarget",value:function(I){var q=vr("target",I);if(q)return document.querySelector(q)}},{key:"defaultText",value:function(I){return vr("text",I)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(I){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return N(I,q)}},{key:"cut",value:function(I){return h(I)}},{key:"isSupported",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],q=typeof I=="string"?[I]:I,Me=!!document.queryCommandSupported;return q.forEach(function(kt){Me=Me&&!!document.queryCommandSupported(kt)}),Me}}]),E}(a()),Ai=Li},828:function(n){var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var i=Element.prototype;i.matches=i.matchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector||i.webkitMatchesSelector}function s(a,f){for(;a&&a.nodeType!==o;){if(typeof a.matches=="function"&&a.matches(f))return a;a=a.parentNode}}n.exports=s},438:function(n,o,i){var s=i(828);function a(u,p,m,d,h){var v=c.apply(this,arguments);return u.addEventListener(m,v,h),{destroy:function(){u.removeEventListener(m,v,h)}}}function f(u,p,m,d,h){return typeof u.addEventListener=="function"?a.apply(null,arguments):typeof m=="function"?a.bind(null,document).apply(null,arguments):(typeof u=="string"&&(u=document.querySelectorAll(u)),Array.prototype.map.call(u,function(v){return a(v,p,m,d,h)}))}function c(u,p,m,d){return function(h){h.delegateTarget=s(h.target,p),h.delegateTarget&&d.call(u,h)}}n.exports=f},879:function(n,o){o.node=function(i){return i!==void 0&&i instanceof HTMLElement&&i.nodeType===1},o.nodeList=function(i){var s=Object.prototype.toString.call(i);return i!==void 0&&(s==="[object NodeList]"||s==="[object HTMLCollection]")&&"length"in i&&(i.length===0||o.node(i[0]))},o.string=function(i){return typeof i=="string"||i instanceof String},o.fn=function(i){var s=Object.prototype.toString.call(i);return s==="[object Function]"}},370:function(n,o,i){var s=i(879),a=i(438);function f(m,d,h){if(!m&&!d&&!h)throw new Error("Missing required arguments");if(!s.string(d))throw new TypeError("Second argument must be a String");if(!s.fn(h))throw new TypeError("Third argument must be a Function");if(s.node(m))return c(m,d,h);if(s.nodeList(m))return u(m,d,h);if(s.string(m))return p(m,d,h);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(m,d,h){return m.addEventListener(d,h),{destroy:function(){m.removeEventListener(d,h)}}}function u(m,d,h){return Array.prototype.forEach.call(m,function(v){v.addEventListener(d,h)}),{destroy:function(){Array.prototype.forEach.call(m,function(v){v.removeEventListener(d,h)})}}}function p(m,d,h){return a(document.body,m,d,h)}n.exports=f},817:function(n){function o(i){var s;if(i.nodeName==="SELECT")i.focus(),s=i.value;else if(i.nodeName==="INPUT"||i.nodeName==="TEXTAREA"){var a=i.hasAttribute("readonly");a||i.setAttribute("readonly",""),i.select(),i.setSelectionRange(0,i.value.length),a||i.removeAttribute("readonly"),s=i.value}else{i.hasAttribute("contenteditable")&&i.focus();var f=window.getSelection(),c=document.createRange();c.selectNodeContents(i),f.removeAllRanges(),f.addRange(c),s=f.toString()}return s}n.exports=o},279:function(n){function o(){}o.prototype={on:function(i,s,a){var f=this.e||(this.e={});return(f[i]||(f[i]=[])).push({fn:s,ctx:a}),this},once:function(i,s,a){var f=this;function c(){f.off(i,c),s.apply(a,arguments)}return c._=s,this.on(i,c,a)},emit:function(i){var s=[].slice.call(arguments,1),a=((this.e||(this.e={}))[i]||[]).slice(),f=0,c=a.length;for(f;f{"use strict";/*! - * escape-html - * Copyright(c) 2012-2013 TJ Holowaychuk - * Copyright(c) 2015 Andreas Lubbe - * Copyright(c) 2015 Tiancheng "Timothy" Gu - * MIT Licensed - */var rs=/["'&<>]/;Yo.exports=ns;function ns(e){var t=""+e,r=rs.exec(t);if(!r)return t;var n,o="",i=0,s=0;for(i=r.index;i0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n1||a(m,d)})})}function a(m,d){try{f(n[m](d))}catch(h){p(i[0][3],h)}}function f(m){m.value instanceof et?Promise.resolve(m.value.v).then(c,u):p(i[0][2],m)}function c(m){a("next",m)}function u(m){a("throw",m)}function p(m,d){m(d),i.shift(),i.length&&a(i[0][0],i[0][1])}}function pn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Ee=="function"?Ee(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,f){s=e[i](s),o(a,f,s.done,s.value)})}}function o(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function C(e){return typeof e=="function"}function at(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var It=at(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription: -`+r.map(function(n,o){return o+1+") "+n.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=r}});function Ve(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ie=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Ee(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(v){t={error:v}}finally{try{f&&!f.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(C(u))try{u()}catch(v){i=v instanceof It?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var m=Ee(p),d=m.next();!d.done;d=m.next()){var h=d.value;try{ln(h)}catch(v){i=i!=null?i:[],v instanceof It?i=D(D([],W(i)),W(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{d&&!d.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}}if(i)throw new It(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ln(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ve(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ve(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Sr=Ie.EMPTY;function jt(e){return e instanceof Ie||e&&"closed"in e&&C(e.remove)&&C(e.add)&&C(e.unsubscribe)}function ln(e){C(e)?e():e.unsubscribe()}var Le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var st={setTimeout:function(e,t){for(var r=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Sr:(this.currentObservers=null,a.push(r),new Ie(function(){n.currentObservers=null,Ve(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new F;return r.source=this,r},t.create=function(r,n){return new xn(r,n)},t}(F);var xn=function(e){ie(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Sr},t}(x);var Et={now:function(){return(Et.delegate||Date).now()},delegate:void 0};var wt=function(e){ie(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Et);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,f=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),f=0;f0?e.prototype.requestAsyncId.call(this,r,n,o):(r.actions.push(this),r._scheduled||(r._scheduled=ut.requestAnimationFrame(function(){return r.flush(void 0)})))},t.prototype.recycleAsyncId=function(r,n,o){var i;if(o===void 0&&(o=0),o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,n,o);var s=r.actions;n!=null&&((i=s[s.length-1])===null||i===void 0?void 0:i.id)!==n&&(ut.cancelAnimationFrame(n),r._scheduled=void 0)},t}(Wt);var Sn=function(e){ie(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var n=this._scheduled;this._scheduled=void 0;var o=this.actions,i;r=r||o.shift();do if(i=r.execute(r.state,r.delay))break;while((r=o[0])&&r.id===n&&o.shift());if(this._active=!1,i){for(;(r=o[0])&&r.id===n&&o.shift();)r.unsubscribe();throw i}},t}(Dt);var Oe=new Sn(wn);var M=new F(function(e){return e.complete()});function Vt(e){return e&&C(e.schedule)}function Cr(e){return e[e.length-1]}function Ye(e){return C(Cr(e))?e.pop():void 0}function Te(e){return Vt(Cr(e))?e.pop():void 0}function zt(e,t){return typeof Cr(e)=="number"?e.pop():t}var pt=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function Nt(e){return C(e==null?void 0:e.then)}function qt(e){return C(e[ft])}function Kt(e){return Symbol.asyncIterator&&C(e==null?void 0:e[Symbol.asyncIterator])}function Qt(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function zi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Yt=zi();function Gt(e){return C(e==null?void 0:e[Yt])}function Bt(e){return un(this,arguments,function(){var r,n,o,i;return $t(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,et(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,et(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,et(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Jt(e){return C(e==null?void 0:e.getReader)}function U(e){if(e instanceof F)return e;if(e!=null){if(qt(e))return Ni(e);if(pt(e))return qi(e);if(Nt(e))return Ki(e);if(Kt(e))return On(e);if(Gt(e))return Qi(e);if(Jt(e))return Yi(e)}throw Qt(e)}function Ni(e){return new F(function(t){var r=e[ft]();if(C(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function qi(e){return new F(function(t){for(var r=0;r=2;return function(n){return n.pipe(e?A(function(o,i){return e(o,i,n)}):de,ge(1),r?He(t):Dn(function(){return new Zt}))}}function Vn(){for(var e=[],t=0;t=2,!0))}function pe(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new x}:t,n=e.resetOnError,o=n===void 0?!0:n,i=e.resetOnComplete,s=i===void 0?!0:i,a=e.resetOnRefCountZero,f=a===void 0?!0:a;return function(c){var u,p,m,d=0,h=!1,v=!1,Y=function(){p==null||p.unsubscribe(),p=void 0},B=function(){Y(),u=m=void 0,h=v=!1},N=function(){var O=u;B(),O==null||O.unsubscribe()};return y(function(O,Qe){d++,!v&&!h&&Y();var De=m=m!=null?m:r();Qe.add(function(){d--,d===0&&!v&&!h&&(p=$r(N,f))}),De.subscribe(Qe),!u&&d>0&&(u=new rt({next:function($e){return De.next($e)},error:function($e){v=!0,Y(),p=$r(B,o,$e),De.error($e)},complete:function(){h=!0,Y(),p=$r(B,s),De.complete()}}),U(O).subscribe(u))})(c)}}function $r(e,t){for(var r=[],n=2;ne.next(document)),e}function K(e,t=document){return Array.from(t.querySelectorAll(e))}function z(e,t=document){let r=ce(e,t);if(typeof r=="undefined")throw new ReferenceError(`Missing element: expected "${e}" to be present`);return r}function ce(e,t=document){return t.querySelector(e)||void 0}function _e(){return document.activeElement instanceof HTMLElement&&document.activeElement||void 0}function tr(e){return L(b(document.body,"focusin"),b(document.body,"focusout")).pipe(ke(1),l(()=>{let t=_e();return typeof t!="undefined"?e.contains(t):!1}),V(e===_e()),J())}function Xe(e){return{x:e.offsetLeft,y:e.offsetTop}}function Kn(e){return L(b(window,"load"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>Xe(e)),V(Xe(e)))}function rr(e){return{x:e.scrollLeft,y:e.scrollTop}}function dt(e){return L(b(e,"scroll"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>rr(e)),V(rr(e)))}var Yn=function(){if(typeof Map!="undefined")return Map;function e(t,r){var n=-1;return t.some(function(o,i){return o[0]===r?(n=i,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,i=this.__entries__;o0},e.prototype.connect_=function(){!Wr||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),va?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Wr||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=ba.some(function(i){return!!~n.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Gn=function(e,t){for(var r=0,n=Object.keys(t);r0},e}(),Jn=typeof WeakMap!="undefined"?new WeakMap:new Yn,Xn=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=ga.getInstance(),n=new La(t,r,this);Jn.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Xn.prototype[e]=function(){var t;return(t=Jn.get(this))[e].apply(t,arguments)}});var Aa=function(){return typeof nr.ResizeObserver!="undefined"?nr.ResizeObserver:Xn}(),Zn=Aa;var eo=new x,Ca=$(()=>k(new Zn(e=>{for(let t of e)eo.next(t)}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function he(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ye(e){return Ca.pipe(S(t=>t.observe(e)),g(t=>eo.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(()=>he(e)))),V(he(e)))}function bt(e){return{width:e.scrollWidth,height:e.scrollHeight}}function ar(e){let t=e.parentElement;for(;t&&(e.scrollWidth<=t.scrollWidth&&e.scrollHeight<=t.scrollHeight);)t=(e=t).parentElement;return t?e:void 0}var to=new x,Ra=$(()=>k(new IntersectionObserver(e=>{for(let t of e)to.next(t)},{threshold:0}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function sr(e){return Ra.pipe(S(t=>t.observe(e)),g(t=>to.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(({isIntersecting:r})=>r))))}function ro(e,t=16){return dt(e).pipe(l(({y:r})=>{let n=he(e),o=bt(e);return r>=o.height-n.height-t}),J())}var cr={drawer:z("[data-md-toggle=drawer]"),search:z("[data-md-toggle=search]")};function no(e){return cr[e].checked}function Ke(e,t){cr[e].checked!==t&&cr[e].click()}function Ue(e){let t=cr[e];return b(t,"change").pipe(l(()=>t.checked),V(t.checked))}function ka(e,t){switch(e.constructor){case HTMLInputElement:return e.type==="radio"?/^Arrow/.test(t):!0;case HTMLSelectElement:case HTMLTextAreaElement:return!0;default:return e.isContentEditable}}function Ha(){return L(b(window,"compositionstart").pipe(l(()=>!0)),b(window,"compositionend").pipe(l(()=>!1))).pipe(V(!1))}function oo(){let e=b(window,"keydown").pipe(A(t=>!(t.metaKey||t.ctrlKey)),l(t=>({mode:no("search")?"search":"global",type:t.key,claim(){t.preventDefault(),t.stopPropagation()}})),A(({mode:t,type:r})=>{if(t==="global"){let n=_e();if(typeof n!="undefined")return!ka(n,r)}return!0}),pe());return Ha().pipe(g(t=>t?M:e))}function le(){return new URL(location.href)}function ot(e){location.href=e.href}function io(){return new x}function ao(e,t){if(typeof t=="string"||typeof t=="number")e.innerHTML+=t.toString();else if(t instanceof Node)e.appendChild(t);else if(Array.isArray(t))for(let r of t)ao(e,r)}function _(e,t,...r){let n=document.createElement(e);if(t)for(let o of Object.keys(t))typeof t[o]!="undefined"&&(typeof t[o]!="boolean"?n.setAttribute(o,t[o]):n.setAttribute(o,""));for(let o of r)ao(n,o);return n}function fr(e){if(e>999){let t=+((e-950)%1e3>99);return`${((e+1e-6)/1e3).toFixed(t)}k`}else return e.toString()}function so(){return location.hash.substring(1)}function Dr(e){let t=_("a",{href:e});t.addEventListener("click",r=>r.stopPropagation()),t.click()}function Pa(e){return L(b(window,"hashchange"),e).pipe(l(so),V(so()),A(t=>t.length>0),X(1))}function co(e){return Pa(e).pipe(l(t=>ce(`[id="${t}"]`)),A(t=>typeof t!="undefined"))}function Vr(e){let t=matchMedia(e);return er(r=>t.addListener(()=>r(t.matches))).pipe(V(t.matches))}function fo(){let e=matchMedia("print");return L(b(window,"beforeprint").pipe(l(()=>!0)),b(window,"afterprint").pipe(l(()=>!1))).pipe(V(e.matches))}function zr(e,t){return e.pipe(g(r=>r?t():M))}function ur(e,t={credentials:"same-origin"}){return ue(fetch(`${e}`,t)).pipe(fe(()=>M),g(r=>r.status!==200?Ot(()=>new Error(r.statusText)):k(r)))}function We(e,t){return ur(e,t).pipe(g(r=>r.json()),X(1))}function uo(e,t){let r=new DOMParser;return ur(e,t).pipe(g(n=>n.text()),l(n=>r.parseFromString(n,"text/xml")),X(1))}function pr(e){let t=_("script",{src:e});return $(()=>(document.head.appendChild(t),L(b(t,"load"),b(t,"error").pipe(g(()=>Ot(()=>new ReferenceError(`Invalid script: ${e}`))))).pipe(l(()=>{}),R(()=>document.head.removeChild(t)),ge(1))))}function po(){return{x:Math.max(0,scrollX),y:Math.max(0,scrollY)}}function lo(){return L(b(window,"scroll",{passive:!0}),b(window,"resize",{passive:!0})).pipe(l(po),V(po()))}function mo(){return{width:innerWidth,height:innerHeight}}function ho(){return b(window,"resize",{passive:!0}).pipe(l(mo),V(mo()))}function bo(){return G([lo(),ho()]).pipe(l(([e,t])=>({offset:e,size:t})),X(1))}function lr(e,{viewport$:t,header$:r}){let n=t.pipe(ee("size")),o=G([n,r]).pipe(l(()=>Xe(e)));return G([r,t,o]).pipe(l(([{height:i},{offset:s,size:a},{x:f,y:c}])=>({offset:{x:s.x-f,y:s.y-c+i},size:a})))}(()=>{function e(n,o){parent.postMessage(n,o||"*")}function t(...n){return n.reduce((o,i)=>o.then(()=>new Promise(s=>{let a=document.createElement("script");a.src=i,a.onload=s,document.body.appendChild(a)})),Promise.resolve())}var r=class extends EventTarget{constructor(n){super(),this.url=n,this.m=i=>{i.source===this.w&&(this.dispatchEvent(new MessageEvent("message",{data:i.data})),this.onmessage&&this.onmessage(i))},this.e=(i,s,a,f,c)=>{if(s===`${this.url}`){let u=new ErrorEvent("error",{message:i,filename:s,lineno:a,colno:f,error:c});this.dispatchEvent(u),this.onerror&&this.onerror(u)}};let o=document.createElement("iframe");o.hidden=!0,document.body.appendChild(this.iframe=o),this.w.document.open(),this.w.document.write(` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

Benchmark#

-

This page has been removed, please visit https://lincolnloop.github.io/python-package-manager-shootout/ for a detailed benchmark report.

- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/dev/changelog/index.html b/2.10/dev/changelog/index.html deleted file mode 100644 index 875205b985..0000000000 --- a/2.10/dev/changelog/index.html +++ /dev/null @@ -1,12952 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Changelog - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

Changelog#

-
-

Attention

-

Major and minor releases also include changes listed within prior beta releases.

-
-

Release v2.10.4 (2023-11-24)#

-

Bug Fixes#

-
    -
  • Do not detect as requirements.txt if the file is a python script. #2416
  • -
  • Provide information of the original line when parsing requirement fails. #2417
  • -
  • Resolve -r requirements paths relative to the requirement file they are specified in #2422
  • -
  • Updating package now overwrites the old files instead of removing before installing. #2423
  • -
-

Release v2.10.3 (2023-11-16)#

-

Bug Fixes#

-
    -
  • Create virtualenv for conda base Python. #2409
  • -
-

Release v2.10.2 (2023-11-16)#

-

Features & Improvements#

-
    -
  • Log the response text when pdm publish fails with HTTP error. #2400
  • -
-

Bug Fixes#

-
    -
  • Improve the error message when a specific package can't be found in the lockfile. #2358
  • -
  • prevent wrong project name (including space and illegal characters) #2360
  • -
  • Fix a bug that PDM cannot detect namespace packages correctly when creating symlinks. The package's __init__.py contains an unusual line. #2378
  • -
  • Fix template files created by pdm init being read-only when copied from a read-only PDM installation. #2379
  • -
  • Don't reset the build backend when asking for import. #2388
  • -
  • Never wrap the output of the export command. #2390
  • -
  • Forbid global project in conda base environment, since it may remove conda-managed packages. #2409
  • -
-

Release v2.10.1 (2023-11-07)#

-

Bug Fixes#

-
    -
  • Fix a bug preventing ctrl-c from interrupting program execution on 2nd invocation when using "pdm run" (Windows only). #2292
  • -
  • Fix list index out of range when build error message is empty. #2337
  • -
  • Fix find_link sources being exported as --extra--index-url #2342
  • -
  • Fix an installation failure when install.cache = true. #2355
  • -
  • Fix a resolution issue that extra dependencies are not resolved when the bare dependency has more specific version constraint. #2369
  • -
-

Documentation#

-
    -
  • Set up a chatbot powered by LLM on the doc page. #2365
  • -
-

Release v2.10.0 (2023-10-26)#

-

Features & Improvements#

-
    -
  • Allow binding packages to specific sources with include_packages and exclude_packages config under tool.pdm.source table. #1645
  • -
  • Show warnings when a package is rejected by the resolve because of uncovered requires-python range. And provide a way to ignore them per-package. #2304
  • -
  • Add -q/--quiet option to suppress some warnings printed to the console. This option is mutually exclusive with -v/--verbose. #2304
  • -
  • Introduce a new --strategy/-S option for lock command, to specify one or more strategy flags for resolving dependencies. --static-urls and --no-cross-platform are deprecated at the same time. #2310
  • -
  • Add lock option to resolve direct dependencies to the minimal versions available. #2310
  • -
  • Report the progress of download and unpacking when installing packages. #2328
  • -
-

Bug Fixes#

-
    -
  • Change the venv backend clean function pdm.cli.commands.venv.backend.Backend._ensure_clean to empty the .venv folder instead of deleting it. #2282
  • -
  • Fix a bug that dependency groups from Poetry 1.2+ do not migrate properly to PDM. #2285
  • -
  • Fix a bug that build requirements are installed into wrong location when using --venv option. #2314
  • -
  • Fix a bug that global repository setting results in TypeError . #2330
  • -
  • Fix a credentials error when working with two indices on the same host #2333
  • -
-

Miscellany#

-
    -
  • Officially supports python3.12 now. #2301
  • -
-

Release v2.9.3 (2023-09-25)#

-

Bug Fixes#

-
    -
  • Revert the changes to the behavior of installing self, introduced in #2162. - Self package won't be installed when --no-default is requested. #2230
  • -
  • Reject the candidate if it contains invalid metadata, to avoid a crash in the process of resolution. #2261
  • -
-

Documentation#

-
    -
  • Clarify what --no-isolated does. #2071
  • -
-

Release v2.9.2 (2023-09-12)#

-

Features & Improvements#

-
    -
  • Fix an issue that --no-lock option doesn't work as expected. Also support --no-lock option for add, remove and update commands. #2245
  • -
-

Bug Fixes#

-
    -
  • Use findpython to find pythons with the spec given by the user. #2225
  • -
  • Use UTF-8 to read pyvenv.cfg. #2227
  • -
  • On Windows, try looking for the virtualenv python.exe binary under bin/ - as well as Scripts/ and the virtualenv/conda root. #2236
  • -
  • Write relocatable dependency URLs with ${PROJECT_ROOT} variable in the lockfile. #2240
  • -
-

Release v2.9.1 (2023-09-03)#

-

Features & Improvements#

-
    -
  • Support convert setup.cfg without existing setup.py. #2222
  • -
-

Bug Fixes#

-
    -
  • pdm run should only find local file if the command starts with ./. #2221
  • -
-

Release v2.9.0 (2023-08-31)#

-

Features & Improvements#

-
    -
  • Add an --overwrite option to pdm init to overwrite existing files(default False). #2163
  • -
  • Support passing filter patterns as positional arguments to pdm list command. - Add --tree as an alias and preferred name of --graph option. #2165
  • -
  • Switch to truststore by default. #2195
  • -
  • Consider packages as installed if the venv includes them from the system-site-packages. #2216
  • -
  • Allow pdm run to run a script with the relative or absolute path. #2217
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that removing dev dependency uninstalls the project as well. #2150
  • -
  • Fix a bug that @ file:// dependencies can not be updated. #2169
  • -
  • Fix a bug that dependencies requested out of the range of requires-python cause PDM to crash. #2175
  • -
  • Fix the compatibility issue with copier 8.0+. #2177
  • -
  • Makes comarable_version("1.2.3+local1") == Version("1.2.3"). #2182
  • -
  • Default behavior for pdm venv activate when shell detection fails. #2187
  • -
  • Handle parsing errors when converting from poetry-style metadata. #2203
  • -
  • Don't copy .pyc files from the template directory. #2213
  • -
-

Removals and Deprecations#

-
    -
  • Remove the legacy build backend pdm-pep517. #2167
  • -
-

Release v2.8.2 (2023-07-31)#

-

Features & Improvements#

-
    -
  • Allow setting username and password in URL for publish command #2140
  • -
-

Bug Fixes#

-
    -
  • Use UTF-8 encoding when writing sitecustomize.py. #2139
  • -
-

Release v2.8.1 (2023-07-26)#

-

Features & Improvements#

-
    -
  • Add keyring, copier, cookiecutter, template, truststore dependency groups. #2109
  • -
  • Ignore wheels for python versions not in range. #2113
  • -
  • Read default value from env var PDM_PROJECT for -p/--project option. #2126
  • -
-

Bug Fixes#

-
    -
  • Fix the comparison of the candidate keys in the lockfile. #2120
  • -
  • Don't update pyproject.toml if both --unconstrained and --dry-run are passed to pdm update. #2125
  • -
  • Overwrite the build-system table when importing from other package manager. #2126
  • -
  • Skip sources with empty URL when merging sources. #2130
  • -
  • Fix the invalid requirement converted from poetry metadata. #2133
  • -
-

Dependencies#

-
    -
  • Update unearth to 0.10.0 #2113
  • -
-

Release v2.8.0 (2023-07-15)#

-

Features & Improvements#

-
    -
  • Support target python with other architectures. #2078
  • -
  • Display the help information when running pdm directly. #2081
  • -
  • Allow to change the python providers from the config. Support finding pythons from Rye installation location with the new findpython. #2099
  • -
  • Option to save static URLs in the lockfile. By default only filenames are saved. #2101
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that egg-info directories are not removed completely, leading to incomplete distribution. #2027
  • -
  • Skip distributions with wrong package meta information and duplicate path. #2075
  • -
  • Avoid mistakenly passing command-line arguments while testing. #2083
  • -
  • Fix a bug that lockfile groups are overwritten when running locking in a preceding step of pdm install. #2086
  • -
  • Tolerate and actually ignore the local versions in version specifiers. #2102
  • -
  • Fix a bug that shared cache cannot support overlapping namespace packages. #2105
  • -
-

Documentation#

-
    -
  • Add notes about using custom venv path. #2096
  • -
-

Release v2.8.0a2 (2023-06-30)#

-

Bug Fixes#

-
    -
  • Fix a bug that dependencies can't be updated when the table is separated by another table. #2056
  • -
  • Fix a bug that *_lock hooks are always emitted with dry_run=True in pdm update. #2060
  • -
  • Fix a bug that pdm install --plugins can't install self. #2062
  • -
  • Fix a cache collision between named requirements and url requirements. #2064
  • -
-

Release v2.8.0a1 (2023-06-27)#

-

Features & Improvements#

-
    -
  • Add support for cookiecutter and copier as project generator. #2059
  • -
-

Release v2.8.0a0 (2023-06-27)#

-

Features & Improvements#

-
    -
  • pdm init now accepts a template argument to initialize project from a built-in or Git template. #2053
  • -
  • Replace the DeprecationWarning with FutureWarning for better exposure. #2012
  • -
  • Serve install-pdm.py and its checksum file on the docs site. #2026
  • -
  • Add new option --edit/-e to pdm config to edit the config file in default editor. #2028
  • -
  • Add --project option to pdm venv to support another path as the project root. #2042
  • -
  • Add support for using truststore as the SSL backend. This only works on Python 3.10 or newer. #2049
  • -
-

Bug Fixes#

-
    -
  • Fix the breaking change by adding the functions back to the old location with deprecation warnings. #2013
  • -
  • Fix the duplicate entries in the output of pdm self list. #2018
  • -
  • Disable hashes caching for local files. #2019
  • -
  • Populate the url field when converting requirements from a Pipfile-style file requirement. #2032
  • -
  • Fix a bug that empty source tables in configuration files causes errors when running pdm commands. #2034
  • -
  • Fix a resolution conflict caused by requested yanked version also in other transitive dependencies. #2038
  • -
  • Fix a bug that binary executables are corrupted when replacing shebangs. #2045
  • -
  • Do not normalize the package name when uploading to PyPI. #2057
  • -
-

Release v2.7.4 (2023-06-13)#

-

No significant changes.

-

Release v2.7.3 (2023-06-13)#

-

Bug Fixes#

-
    -
  • Fix the warning of extras not found due to extra names not normalized. #2006
  • -
  • Pop up a warning when the deprecated parser argument is passed to BaseCommand.__init__() method. #2007
  • -
  • Fix a bug that merging settings with AoTs causing a failure. #2011
  • -
-

Release v2.7.2 (2023-06-12)#

-

Features & Improvements#

-
    -
  • Add option to expand environment variables when exporting requirements. #1997
  • -
-

Bug Fixes#

-
    -
  • Case-insensitive sorting in pdm list. #1973
  • -
  • Make a compatible cache reader to read the old cache files. #1981
  • -
  • Fix a bug that pdm init -n doesn't respect the --python option. #1984
  • -
  • Do not use the deprecated nested argument groups. #1988
  • -
  • Fix an error parsing setup.py if it prints something to stdout. #1995
  • -
  • Exclude yanked versions when running install-pdm.py. #1996
  • -
-

Release v2.7.1 (2023-06-06)#

-

Features & Improvements#

-
    -
  • Switch HTTP data cache to use a split body setup, where the actual body contents are not written to disk unless changed. Previously, any changed headers would write the whole body to disk again. #1971
  • -
  • Show the specific install commands for different installations when checking update. This was removed before. #1972
  • -
-

Bug Fixes#

-
    -
  • PDM ignores env vars PDM_PYPI_USERNAME and PDM_PYPI_PASSWORD when there are no defaults in config. #1961
  • -
  • Guess the project name from VCS url if it is missing when importing from requirements.txt. #1970
  • -
  • Correctly read the config from environment variables. #1977
  • -
-

Release v2.7.0 (2023-05-29)#

-

Features & Improvements#

-
    -
  • When keyring is available, either by importing or by CLI, the credentials of repositories and PyPI indexes will be saved into it. #1908
  • -
  • Add support for reading metadata from simple index directly. #1919
  • -
  • Add a configuration to specify constant command arguments for every pdm invocation. #1923
  • -
  • Add ability to skip SSL verification for publish repositories via repository.custom.verify_ssl config option as well as new command line argument of publish command. #1928
  • -
  • Use lazy import to reduce the startup time of the CLI. #1929
  • -
  • Add the local plugin scripts to PATH env var. #1944
  • -
-

Bug Fixes#

-
    -
  • Don't use install cache when installing build requirements to avoid race condition. #1869
  • -
  • Fix a number of ResourceWarnings when running the test suite with warnings enabled. #1915
  • -
  • Fix a bug that dev-dependencies group gets updated with the optional dependencies, causing the hash mismatch. #1916
  • -
  • Fix format conversion error from Poetry when tool.poetry.build doesn't exist. #1935
  • -
  • Add timeout when fetching .gitignore from GitHub. #1937
  • -
  • Keep the variables in the URL credentials when exporting. #1939
  • -
  • Convert to boolean when setting verify_ssl for custom indexes. #1945
  • -
  • pdm import clobbers build-system.requires value in pyproject.toml. #1948
  • -
-

Documentation#

-
    -
  • Update publish.md to use run instead of runs to match GitHub Actions steps documentation #1936
  • -
  • Update advanced.md to use pdm sync instead of pdm install --no-lock. #1947
  • -
-

Release v2.6.1 (2023-05-10)#

-

Bug Fixes#

-
    -
  • Fix the error when publishing using trusted publisher. #1868
  • -
  • Fix a bug that PATH env var isn't set correctly when running under non-isolation mode. #1904
  • -
-

Release v2.6.0 (2023-05-09)#

-

Features & Improvements#

-
    -
  • Install project-level plugins from project config, with tool.pdm.plugins setting. #1461
  • -
  • Added a --json flag to both run and info command allowing to dump scripts and infos as JSON. #1854
  • -
  • Consider tasks with a name starting by an underscore (_) as internal tasks and hide them from the listing. #1855
  • -
  • When running pdm init -n(non-interactive mode), a venv will be created by default. Previously, the selected Python will be used under PEP 582 mode. #1862
  • -
  • Support Trusted Publisher. #1868
  • -
  • Add an ephemeral wheel cache in process for wheels built from non-static revision sources. #1885
  • -
  • Allow self-referencing groups in dev-dependencies. #1890
  • -
  • Add an option --no-cross-platform to pdm lock to create a non-cross-platform lockfile. #1898
  • -
-

Bug Fixes#

-
    -
  • Fix brackets in --venv option descriptions in zsh completion script. #1847
  • -
  • The resolver doesn't take into account of the requirements for both bare package and package[extra]. #1851
  • -
  • Default pypi source does not use configured pypi.password, but "" instead. #1856
  • -
  • Detect Python interpreters under the root of virtual environments. #1866
  • -
  • Fix a race condition when the builder is creating a new build directory. #1869
  • -
  • Raise FileNotFoundError if the requirement path is not found. #1875
  • -
  • Fix a bug that the self package isn't uninstallable. #1901
  • -
-

Release v2.5.6 (2023-05-07)#

-

Bug Fixes#

-
    -
  • Fix a double reading issue due to cachecontrol not compatible with urllib3 2.0. #1894
  • -
-

Release v2.5.5 (2023-05-05)#

-

No significant changes.

-

Release v2.5.4 (2023-05-05)#

-

Bug Fixes#

-
    -
  • Pin the urllib3 to <2.0 to avoid incompatibility with cachecontrol. #1886
  • -
-

Release v2.5.3 (2023-04-19)#

-

Bug Fixes#

-
    -
  • Fix the wrong argument validation for update command, where packages given with group option should be allowed. #1836
  • -
-

Documentation#

-
    -
  • Update markdown-exec to 1.5.0 for rendering TOC in CLI reference page. #1836
  • -
  • Remove advertizing of PEP-582 from the feature highlights. Improve the anchor links for CLI reference. #1840
  • -
-

Release v2.5.2 (2023-04-10)#

-

Bug Fixes#

-
    -
  • Regression(#1710): Don't crash when trying to update the shebang in a binary script #1827
  • -
  • Rename the env var PDM_USE_VENV as PDM_IN_VENV for --venv flag as it mistakenly override another existing env var. #1829
  • -
-

Release v2.5.1 (2023-04-09)#

-

Bug Fixes#

-
    -
  • Fix a bug that pdm --pep582 raises an argument error. #1823
  • -
-

Release v2.5.0 (2023-04-09)#

-

Features & Improvements#

-
    -
  • When resolution.respect-source-order is enabled, sources are lazily evaluated. This means that if a match is found on the first source, the remaining sources will not be requested. #1509
  • -
  • New option --venv <venv> to run a command in the virtual environment with the given name. #1705
  • -
  • Allow to prefer binary distributions when locking and installing packages, via PDM_PREFER_BINARY environment variable. #1817
  • -
-

Bug Fixes#

-
    -
  • Do not validate selected groups against the locked grouped when running pdm lock. #1796
  • -
  • Avoid duplicate .pdm-python in .gitignore. #1800
  • -
  • Fix a backwards compatibility issue by adding back the environment.is_global property. #1814
  • -
  • Fix a resolution conflict when a relative path requirement resolves to the same path as another file requirement with absolute path. #1822
  • -
  • Fix an error when running pdm init -p <dir> if the target directory is not created yet. #1822
  • -
-

Release v2.5.0b0 (2023-03-29)#

-

Breaking Changes#

-
    -
  • Switch the default build backend to pdm-backend. #1684
  • -
  • Only lock selected groups into the lockfile. Modify other commands to honor the groups included in the lockfile. #1704
  • -
  • Move the project python path to its own file, and rename the project config file as pdm.toml which can be committed to the VCS. #1742
  • -
  • Refactor the environment package. Environment is renamed to PythonLocalEnvironment and GlobalEnvironment is renamed to PythonEnvironment. Move pdm.models.environment module to pdm.environments package. #1791
  • -
-

Features & Improvements#

-
    -
  • Add option to fail on the first install error. #1614
  • -
  • Upgrade unearth to 0.8 to allow calling keyring from CLI. #1653
  • -
  • Merge the index parameters from different configuration files. #1667
  • -
  • Add new options to venv command to show the path or the python interpreter for a managed venv. #1680
  • -
  • Write the groups of resolved dependencies to the metadata table in lockfile. #1692
  • -
  • Introduce --lib option to init command to create a library project without prompting. #1708
  • -
  • New command: pdm fix to migrate to the new PDM features. Add a hint when invoking PDM commands. #1743
  • -
  • Include .pdm-python in project root .gitignore when running pdm init. #1749
  • -
  • Allow to ignore the activated venv with PDM_IGNORE_ACTIVE_VENV env var. #1782
  • -
  • Add a signal pre_invoke to emit before any command is invoked. #1792
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that install warning prints to terminal under non-verbose mode. #1635
  • -
  • Fix the random failure of pdm export due to non-deterministic order of group iteration. #1786
  • -
  • Show the actual version when running pdm show --version #1788
  • -
-

Documentation#

-
    -
  • Restructure the documentation. #1687
  • -
-

Dependencies#

-
    -
  • Update installer to 0.7.0 and emit a warning if the RECORD validation fails. #1784
  • -
-

Release v2.4.9 (2023-03-16)#

-

Bug Fixes#

-
    -
  • Fix a bug of synchronization of not considering the revision of VCS requirement in comparison. #1762
  • -
  • Improve the error message when parsing an invalid requirement string. #1765
  • -
  • Fix a bug that pdm export output doesn't include the extras of the dependencies. #1767
  • -
-

Release v2.4.8 (2023-03-09)#

-

Bug Fixes#

-
    -
  • Fix the resolution order to prefer the packages causing the conflict. - This can make the resolution reach a solution faster. #1752
  • -
  • Fix a bug that embedded credentials in URL are not respected for the default source. #1757
  • -
-

Release v2.4.7 (2023-03-02)#

-

Bug Fixes#

-
    -
  • Abort if lockfile isn't generated when executing pdm export. #1730
  • -
  • Ignore venv.prompt configuration when using conda as the backend. #1734
  • -
  • Fix a bug of finding local packages in the parent folder when it exists in the current folder. #1736
  • -
  • Ensure UTF-8 encoding when generating README.md. #1739
  • -
  • Fix a bug of show command not showing metadata of the current project. #1740
  • -
  • Replace . with - when normalizing package name. #1745
  • -
-

Documentation#

-
    -
  • Support using pdm venv activate without specifying env_name to activate in project venv created by conda #1735
  • -
-

Release v2.4.6 (2023-02-20)#

-

Bug Fixes#

-
    -
  • Fix a resolution failure when the project has cascading relative path dependencies. #1702
  • -
  • Don't crash when trying to update the shebang in a binary script. #1709
  • -
  • Handle the legacy specifiers that is unable to parse with packaging>22.0. #1719
  • -
  • Fix the setup.py parser to ignore the expressions unable to parse as a string. This is safe for initializing a requirement. #1720
  • -
  • Fix a bug converting from flit metadata when the source file can't be found. #1726
  • -
-

Documentation#

-
    -
  • Add config example for Emacs using eglot + pyright #1721
  • -
-

Miscellany#

-
    -
  • Use ruff as the linter. #1715
  • -
  • Document installation via asdf. #1725
  • -
-

Release v2.4.5 (2023-02-10)#

-

Bug Fixes#

-
    -
  • Fix a bug that built wheels are prioritized over source distributions with higher version number. #1698
  • -
-

Release v2.4.4 (2023-02-10)#

-

Features & Improvements#

-
    -
  • Add more intuitive error message when the requires-python doesn't work for all dependencies. #1690
  • -
-

Bug Fixes#

-
    -
  • Prefer built distributions when finding packages for metadata extraction. #1535
  • -
-

Release v2.4.3 (2023-02-06)#

-

Features & Improvements#

-
    -
  • Allow creating venv in project forcely if it already exists. #1666
  • -
  • Always ignore remembered selection in pdm init. #1672
  • -
-

Bug Fixes#

-
    -
  • Fix the fallback build backend to pdm-pep517 instead of setuptools. #1658
  • -
  • Eliminate the deprecation warnings from importlib.resources. #1660
  • -
  • Don't crash when failed to get the latest version of PDM for checking update. #1663
  • -
  • Fix the priorities of importable formats to make sure the correct format is used. #1669
  • -
  • Import editable requirements into dev dependencies. #1674
  • -
-

Release v2.4.2 (2023-01-31)#

-

Bug Fixes#

-
    -
  • Skip some tests on packaging < 22. #1649
  • -
  • Fix a bug that sources from the project config are not loaded. #1651
  • -
  • Set VIRTUAL_ENV in pdm run. #1652
  • -
-

Release v2.4.1 (2023-01-28)#

-

Features & Improvements#

-
    -
  • Add proper display for the extra pypi sources in pdm config. #1622
  • -
  • Support running python scripts without prefixing with python. #1626
  • -
-

Bug Fixes#

-
    -
  • Ignore the python requirement for overriden packages. #1575
  • -
  • Fix the wildcards in requirement specifiers to make it pass the new parser of packaging>=22. #1619
  • -
  • Add the missing subdirectory attribute to the lockfile entry. #1630
  • -
  • Fix a bug that VCS locks don't update when the rev part changes. #1640
  • -
  • Redirect the spinner output to stderr. #1646
  • -
  • Ensure the destination directory exists before building the packages. #1647
  • -
-

Release v2.4.0 (2023-01-12)#

-

Features & Improvements#

-
    -
  • Support multiple PyPI indexes in the configuration. They will be tried after the sources in pyproject.toml. #1310
  • -
  • Accept yanked versions when the requirement version is pinned. #1575
  • -
  • Expose PDM fixtures as a pytest plugin pdm.pytest for plugin developers. #1594
  • -
  • Show message in the status when fetching package hashes. - Fetch hashes from the JSON API response as well. #1609
  • -
  • Mark pdm.lock with an @generated comment. #1611
  • -
-

Bug Fixes#

-
    -
  • Exclude site-packages for symlinks of the python interpreter as well. #1598
  • -
  • Fix a bug that error output can't be decoded correctly on Windows. #1602
  • -
-

Release v2.3.4 (2022-12-27)#

-

Features & Improvements#

-
    -
  • Detect PDM inside a zipapp and disable some functions. #1578
  • -
-

Bug Fixes#

-
    -
  • Don't write sitecustomize to the home directory if it exists in the filesystem(not packed in a zipapp). #1572
  • -
  • Fix a bug that a directory is incorrectly marked as to be deleted when it contains symlinks. #1580
  • -
-

Release v2.3.3 (2022-12-15)#

-

Bug Fixes#

-
    -
  • Allow relative paths in build-system.requires, since build and hatch both support it. Be aware it is not allowed in the standard. #1560
  • -
  • Strip the local part when building a specifier for comparison with the package version. This is not permitted by PEP 508 as implemented by packaging 22.0. #1562
  • -
  • Update the version for check_update after self update #1563
  • -
  • Replace the __file__ usages with importlib.resources, to make PDM usable in a zipapp. #1567
  • -
  • Fix the matching problem of packages in the lockfile. #1569
  • -
-

Dependencies#

-
    -
  • Exclude package==22.0 from the dependencies to avoid some breakages to the end users. #1568
  • -
-

Release v2.3.2 (2022-12-08)#

-

Bug Fixes#

-
    -
  • Fix an installation failure when the RECORD file contains commas in the file path. #1010
  • -
  • Fallback to pdm.pep517 as the metadata transformer for unknown custom build backends. #1546
  • -
  • Fix a bug that Ctrl + C kills the python interactive session instead of clearing the current line. #1547
  • -
  • Fix a bug with egg segment for local dependency #1552
  • -
-

Dependencies#

-
    -
  • Update installer to 0.6.0. #1550
  • -
  • Update minimum version of unearth to 0.6.3 and test against packaging==22.0. #1555
  • -
-

Release v2.3.1 (2022-12-05)#

-

Bug Fixes#

-
    -
  • Fix a resolution loop issue when the current project depends on itself and it uses the dynamic version from SCM. #1541
  • -
  • Don't give duplicate results when specifying a relative path for pdm use. #1542
  • -
-

Release v2.3.0 (2022-12-02)#

-

Features & Improvements#

-
    -
  • Beautify the error message of build errors. Default to showing the last 10 lines of the build output. #1491
  • -
  • Rename the tool.pdm.overrides table to tool.pdm.resolution.overrides. The old name is deprecated at the same time. #1503
  • -
  • Add backend selection and --backend option to pdm init command, users can choose a favorite backend from setuptools, flit, hatchling and pdm-pep517(default), since they all support PEP 621 standards. #1504
  • -
  • Allows specifying the insertion position of user provided arguments in scripts with the {args[:default]} placeholder. #1507
  • -
-

Bug Fixes#

-
    -
  • The local package is now treated specially during installation and locking. This means it will no longer be included in the lockfile, and should never be installed twice even when using nested extras. This will ensure the lockdown stays relevant when the version changes. #1481
  • -
  • Fix the version diff algorithm of installed packages to consider local versions as compatible. #1497
  • -
  • Fix the confusing message when detecting a Python interpreter under python.use_venv=False #1508
  • -
  • Fix the test failure with the latest findpython installed. #1516
  • -
  • Fix the module missing error of pywin32 in a virtualenv with install.cache set to true and caching method is pth. #863
  • -
-

Dependencies#

-
    -
  • Drop the dependency pdm-pep517. #1504
  • -
  • Replace pep517 with pyproject-hooks because of the rename. #1528
  • -
-

Removals and Deprecations#

-
    -
  • Remove the support for exporting the project file to a setup.py format, users are encouraged to migrate to the PEP 621 metadata. #1504
  • -
-

Release v2.2.1 (2022-11-03)#

-

Features & Improvements#

-
    -
  • Make sitecustomize.py respect the PDM_PROJECT_MAX_DEPTH environment variable #1471
  • -
-

Bug Fixes#

-
    -
  • Fix the comparison of python_version in the environment marker. When the version contains only one digit, the result was incorrect. #1484
  • -
-

Release v2.2.0 (2022-10-31)#

-

Features & Improvements#

-
    -
  • Add venv.prompt configuration to allow customizing prompt when a virtualenv is activated #1332
  • -
  • Allow the use of custom CA certificates per publish repository using ca_certs or from the command line via pdm publish --ca-certs <path> .... #1392
  • -
  • Rename the plugin command to self, and it can not only manage plugins but also all dependencies. Add a subcommand self update to update PDM itself. #1406
  • -
  • Allow pdm init to receive a Python path or version via --python option. #1412
  • -
  • Add a default value for requires-python when importing from other formats. #1426
  • -
  • Use pdm instead of pip to resolve and install build requirements. So that PDM configurations can control the process. #1429
  • -
  • Customizable color theme via pdm config command. #1450
  • -
  • A new pdm lock --check flag to validate whether the lock is up to date. #1459
  • -
  • Add both option and config item to ship pip when creating a new venv. #1463
  • -
  • Issue warning and skip the requirement if it has the same name as the current project. #1466
  • -
  • Enhance the pdm list command with new formats: --csv,--markdown and add options --fields,--sort to control the output contents. Users can also include licenses in the --fields option to display the package licenses. #1469
  • -
  • A new pre-commit hook to run pdm lock --check in pre-commit. #1471
  • -
-

Bug Fixes#

-
    -
  • Fix the issue that relative paths don't work well with --project argument. #1220
  • -
  • It is now possible to refer to a package from outside the project with relative paths in dependencies. #1381
  • -
  • Ensure pypi.[ca,client]_cert[s] config items are passed to distribution builder install steps to allow for custom PyPI index sources with self signed certificates. #1396
  • -
  • Fix a crash issue when depending on editable packages with extras. #1401
  • -
  • Do not save the python path when using non-interactive mode in pdm init. #1410
  • -
  • Fix the matching of python* command in pdm run. #1414
  • -
  • Show the Python path, instead of the real executable, in the Python selection menu. #1418
  • -
  • Fix the HTTP client of package publishment to prompt for password and read PDM configurations correctly. #1430
  • -
  • Ignore the unknown fields when constructing a requirement object. #1445
  • -
  • Fix a bug of unrelated candidates being fetched if the requirement is matching wildcard versions(e.g. ==1.*). #1465
  • -
  • Use importlib-metadata from PyPI for Python < 3.10. #1467
  • -
-

Documentation#

-
    -
  • Clarify the difference between a library and an application. Update the guide of multi-stage docker build. #1371
  • -
-

Removals and Deprecations#

-
    -
  • Remove all top-level imports, users should import from the submodules instead. #1404
  • -
  • Remove the usages of old config names deprecated since 2.0. #1422
  • -
  • Remove the deprecated color functions, use rich's console markup instead. #1452
  • -
-

Release v2.1.5 (2022-10-05)#

-

Bug Fixes#

-
    -
  • Ensure pypi.[ca,client]_cert[s] config items are passed to distribution builder install steps to allow for custom PyPI index sources with self signed certificates. #1396
  • -
  • Fix a crash issue when depending on editable packages with extras. #1401
  • -
  • Do not save the python path when using non-interactive mode in pdm init. #1410
  • -
  • Restrict importlib-metadata (<5.0.0) for Python <3.8 #1411
  • -
-

Release v2.1.4 (2022-09-17)#

-

Bug Fixes#

-
    -
  • Fix a lock failure when depending on self with URL requirements. #1347
  • -
  • Ensure list to concatenate args for composite scripts. #1359
  • -
  • Fix an error in pdm lock --refresh if some packages has URLs. #1361
  • -
  • Fix unnecessary package downloads and VCS clones for certain commands. #1370
  • -
  • Fix a conversion error when converting a list of conditional dependencies from a Poetry format. #1383
  • -
-

Documentation#

-
    -
  • Adds a section to the docs on how to correctly work with PDM and version control systems. #1364
  • -
-

Release v2.1.3 (2022-08-30)#

-

Features & Improvements#

-
    -
  • When adding a package to (or removing from) a group, enhance the formatting of the group name in the printed message. #1329
  • -
-

Bug Fixes#

-
    -
  • Fix a bug of missing hashes for packages with file:// links the first time they are added. #1325
  • -
  • Ignore invalid values of data-requires-python when parsing package links. #1334
  • -
  • Leave an incomplete project metadata if PDM fails to parse the project files, but emit a warning. #1337
  • -
  • Fix the bug that editables package isn't installed for self package. #1344
  • -
  • Fix a decoding error for non-ASCII characters in package description when publishing it. #1345
  • -
-

Documentation#

-
    -
  • Clarify documentation explaining setup-script, run-setuptools, and is-purelib. #1327
  • -
-

Release v2.1.2 (2022-08-15)#

-

Bug Fixes#

-
    -
  • Fix a bug that dependencies from different versions of the same package override each other. #1307
  • -
  • Forward SIGTERM to child processes in pdm run. #1312
  • -
  • Fix errors when running on FIPS 140-2 enabled systems using Python 3.9 and newer. #1313
  • -
  • Fix the build failure when the subprocess outputs with non-UTF8 characters. #1319
  • -
  • Delay the trigger of post_lock for add and update operations, to ensure the pyproject.toml is updated before the hook is run. #1320
  • -
-

Release v2.1.1 (2022-08-05)#

-

Features & Improvements#

-
    -
  • Add a env_file.override option that allows the user to specify that - the env_file should override any existing environment variables. This - is not the default as the environment the code runs it should take - precedence. #1299
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that unnamed requirements can't override the old ones in either add or update command. #1287
  • -
  • Support mutual TLS to private repositories via pypi.client_cert and pypi.client_key config options. #1290
  • -
  • Set a minimum version for the packaging dependency to ensure that packaging.utils.parse_wheel_filename is available. #1293
  • -
  • Fix a bug that checking for PDM update creates a venv. #1301
  • -
  • Prefer compatible packages when fetching metadata. #1302
  • -
-

Release v2.1.0 (2022-07-29)#

-

Features & Improvements#

-
    -
  • Allow the use of custom CA certificates using the pypi.ca_certs config entry. #1240
  • -
  • Add pdm export to available pre-commit hooks. #1279
  • -
-

Bug Fixes#

-
    -
  • Skip incompatible requirements when installing build dependencies. #1264
  • -
  • Fix a crash when pdm tries to publish a package with non-ASCII characters in the metadata. #1270
  • -
  • Try to read the lock file even if the lock version is incompatible. #1273
  • -
  • For packages that are only available as source distribution, the summary field in pdm.lock contains the description from the package's pyproject.toml. #1274
  • -
  • Do not crash when calling pdm show for a package that is only available as source distribution. #1276
  • -
  • Fix a bug that completion scripts are interpreted as rich markups. #1283
  • -
-

Dependencies#

-
    -
  • Remove the dependency of pip. #1268
  • -
-

Removals and Deprecations#

-
    -
  • Deprecate the top-level imports from pdm module, it will be removed in the future. #1282
  • -
-

Release v2.0.3 (2022-07-22)#

-

Bug Fixes#

-
    -
  • Support Conda environments when detecting the project environment. #1253
  • -
  • Fix the interpreter resolution to first try python executable in the PATH. #1255
  • -
  • Stabilize sorting of URLs in metadata.files in pdm.lock. #1256
  • -
  • Don't expand credentials in the file URLs in the [metada.files] table of the lock file. #1259
  • -
-

Release v2.0.2 (2022-07-20)#

-

Features & Improvements#

-
    -
  • env_file variables no longer override existing environment variables. #1235
  • -
  • Support referencing other optional groups in optional-dependencies with <this_package_name>[group1, group2] #1241
  • -
-

Bug Fixes#

-
    -
  • Respect requires-python when creating the default venv. #1237
  • -
-

Release v2.0.1 (2022-07-17)#

-

Bug Fixes#

-
    -
  • Write lockfile before calling 'post_lock' hook #1224
  • -
  • Suppress errors when cache dir isn't accessible. #1226
  • -
  • Don't save python path for venv commands. #1230
  • -
-

Release v2.0.0 (2022-07-15)#

-

Bug Fixes#

-
    -
  • Fix a bug that the running env overrides the PEP 582 PYTHONPATH. #1211
  • -
  • Add pwsh as an alias of powershell for shell completion. #1216
  • -
  • Fixed a bug with zsh completion regarding --pep582 flag. #1218
  • -
  • Fix a bug of requirement checking under non-isolated mode. #1219
  • -
  • Fix a bug when removing packages, TOML document might become invalid. #1221
  • -
-

Release v2.0.0b2 (2022-07-08)#

-

Breaking Changes#

-
    -
  • Store file URLs instead of filenames in the lock file, bump lock version to 4.0. #1203
  • -
-

Features & Improvements#

-
    -
  • Read site-wide configuration, which serves as the lowest-priority layer. - This layer will be read-only in the CLI. #1200
  • -
  • Get package links from the urls stored in the lock file. #1204
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that the host pip(installed with pdm) may not be compatible with the project python. #1196
  • -
  • Update unearth to fix a bug that install links with weak hashes are skipped. This often happens on self-hosted PyPI servers. #1202
  • -
-

Release v2.0.0b1 (2022-07-02)#

-

Features & Improvements#

-
    -
  • Integrate pdm venv commands into the main program. Make PEP 582 an opt-in feature. #1162
  • -
  • Add config global_project.fallback_verbose defaulting to True. When set to False disables message Project is not found, fallback to the global project #1188
  • -
  • Add --only-keep option to pdm sync to keep only selected packages. Originally requested at #398. #1191
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that requirement extras and underlying are resolved to the different version #1173
  • -
  • Update unearth to 0.4.1 to skip the wheels with invalid version parts. #1178
  • -
  • Fix reading PDM_RESOLVE_MAX_ROUNDS environment variable (was spelled …ROUDNS before). #1180
  • -
  • Deduplicate the list of found Python versions. #1182
  • -
  • Use the normal stream handler for logging, to fix some display issues under non-tty environments. #1184
  • -
-

Removals and Deprecations#

-
    -
  • Remove the useless --no-clean option from pdm sync command. #1191
  • -
-

Release v2.0.0a1 (2022-06-29)#

-

Breaking Changes#

-
    -
  • Editable dependencies in the [project] table is not allowed, according to PEP 621. They are however still allowed in the [tool.pdm.dev-dependencies] table. PDM will emit a warning when it finds editable dependencies in the [project] table, or will abort when you try to add them into the [project] table via CLI. #1083
  • -
  • Now the paths to the global configurations and global project are calculated according to platform standards. #1161
  • -
-

Features & Improvements#

-
    -
  • Add support for importing from a setup.py project. #1062
  • -
  • Switch the UI backend to rich. #1091
  • -
  • Improved the terminal UI and logging. Disable live progress under verbose mode. The logger levels can be controlled by the -v option. #1096
  • -
  • Use unearth to replace pip's PackageFinder and related data models. PDM no longer relies on pip internals, which are unstable across updates. #1096
  • -
  • Lazily load the candidates returned by find_matches() to speed up the resolution. #1098
  • -
  • Add a new command publish to PDM since it is required for so many people and it will make the workflow easier. #1107
  • -
  • Add a composite script kind allowing to run multiple defined scripts in a single command as well as reusing scripts but overriding env or env_file. #1117
  • -
  • Add a new execution option --skip to opt-out some scripts and hooks from any execution (both scripts and PDM commands). #1127
  • -
  • Add the pre/post_publish, pre/post_run and pre/post_script hooks as well as an extensive lifecycle and hooks documentation. #1147
  • -
  • Shorter scripts listing, especially for multilines and composite scripts. #1151
  • -
  • Build configurations have been moved to [tool.pdm.build], according to pdm-pep517 1.0.0. At the same time, warnings will be shown against old usages. #1153
  • -
  • Improve the lock speed by parallelizing the hash fetching. #1154
  • -
  • Retrieve the candidate metadata by parsing the pyproject.toml rather than building it. #1156
  • -
  • Update the format converters to support the new [tool.pdm.build] table. #1157
  • -
  • Scripts are now available as root command if they don't conflict with any builtin or plugin-contributed command. #1159
  • -
  • Add a post_use hook triggered after successfully switching Python version. #1163
  • -
  • Add project configuration respect-source-order under [tool.pdm.resolution] to respect the source order in the pyproject.toml file. Packages will be returned by source earlier in the order or later ones if not found. #593
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that candidates with local part in the version can't be found and installed correctly. #1093
  • -
-

Dependencies#

-
    -
  • Prefer tomllib on Python 3.11 #1072
  • -
  • Drop the vendored libraries click, halo, colorama and log_symbols. PDM has no vendors now. #1091
  • -
  • Update dependency version pdm-pep517 to 1.0.0. #1153
  • -
-

Removals and Deprecations#

-
    -
  • PDM legacy metadata format(from pdm 0.x) is no longer supported. #1157
  • -
-

Miscellany#

-
    -
  • Provide a tox.ini file for easier local testing against all Python versions. #1160
  • -
-

Release v1.15.4 (2022-06-28)#

-

Bug Fixes#

-
    -
  • Revert #1106: Do not use venv scheme for prefix kind install scheme. #1158
  • -
  • Fix a bug when updating a package with extra requirements, the package version doesn't get updated correctly. #1166
  • -
-

Miscellany#

-
    -
  • Add additional installation option via asdf-pdm. - Add skip-add-to-path option to installer in order to prevent changing PATH. - Replace bin variable name with bin_dir. #1145
  • -
-

Release v1.15.3 (2022-06-14)#

-

Bug Fixes#

-
    -
  • Fix a defect in the resolution preferences that causes an infinite resolution loop. #1119
  • -
  • Update the poetry importer to support the new [tool.poetry.build] config table. #1131
  • -
-

Improved Documentation#

-
    -
  • Add support for multiple versions of documentations. #1126
  • -
-

Release v1.15.2 (2022-06-06)#

-

Bug Fixes#

-
    -
  • Fix bug where SIGINT is sent to the main pdm process and not to the process actually being run. #1095
  • -
  • Fix a bug due to the build backend fallback, which causes different versions of the same requirement to exist in the build environment, making the building unstable depending on which version being used. #1099
  • -
  • Don't include the version in the cache key of the locked candidates if they are from a URL requirement. #1099
  • -
  • Fix a bug where dependencies with requires-python pre-release versions caused pdm update to fail with InvalidPyVersion. #1111
  • -
-

Release v1.15.1 (2022-06-02)#

-

Bug Fixes#

-
    -
  • Fix a bug that dependencies are missing from the dep graph when they are depended by a requirement with extras. #1097
  • -
  • Give a default version if the version is dynamic in setup.cfg or setup.py. #1101
  • -
  • Fix a bug that the hashes for file URLs are not included in the lock file. #1103
  • -
  • Fix a bug that package versions are updated even when they are excluded by pdm update command. #1104
  • -
  • Prefer venv install scheme when available. This scheme is more stable than posix_prefix scheme since the latter is often patched by distributions. #1106
  • -
-

Miscellany#

-
    -
  • Move the test artifacts to a submodule. It will make it easier to package this project. #1084
  • -
-

Release v1.15.0 (2022-05-16)#

-

Features & Improvements#

-
    -
  • Allow specifying lockfile other than pdm.lock by --lockfile option or PDM_LOCKFILE env var. #1038
  • -
-

Bug Fixes#

-
    -
  • Replace the editable entry in pyproject.toml when running pdm add --no-editable <package>. #1050
  • -
  • Ensure the pip module inside venv in installation script. #1053
  • -
  • Fix the py2 compatibility issue in the in-process get_sysconfig_path.py script. #1056
  • -
  • Fix a bug that file paths in URLs are not correctly unquoted. #1073
  • -
  • Fix a bug on Python 3.11 that overriding an existing command from plugins raises an error. #1075
  • -
  • Replace the ${PROJECT_ROOT} variable in the result of export command. #1079
  • -
-

Removals and Deprecations#

-
    -
  • Show a warning if Python 2 interpreter is being used and remove the support on 2.0. #1082
  • -
-

Release v1.14.1 (2022-04-21)#

-

Features & Improvements#

-
    -
  • Ask for description when doing pdm init and create default README for libraries. #1041
  • -
-

Bug Fixes#

-
    -
  • Fix a bug of missing subdirectory fragment when importing from a requirements.txt. #1036
  • -
  • Fix use_cache.json with corrupted python causes pdm use error. #1039
  • -
  • Ignore the optional key when converting from Poetry's dependency entries. #1042
  • -
-

Improved Documentation#

-
    -
  • Clarify documentation on enabling PEP582 globally. #1033
  • -
-

Release v1.14.0 (2022-04-08)#

-

Features & Improvements#

-
    -
  • Editable installations won't be overridden unless --no-editable is passed. - pdm add --no-editable will now override the editable mode of the given packages. #1011
  • -
  • Re-calculate the file hashes when running pdm lock --refresh. #1019
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that requirement with extras isn't resolved to the version as specified by the range. #1001
  • -
  • Replace the ${PROJECT_ROOT} in the output of pdm list. #1004
  • -
  • Further fix the python path issue of macOS system installed Python. #1023
  • -
  • Fix the install path issue on Python 3.10 installed from homebrew. #996
  • -
-

Improved Documentation#

-
    -
  • Document how to install PDM inside a project with Pyprojectx. #1004
  • -
-

Dependencies#

-
    -
  • Support installer 0.5.x. #1002
  • -
-

Release v1.13.6 (2022-03-28)#

-

Bug Fixes#

-
    -
  • Default the optional license field to "None". #991
  • -
  • Don't create project files in pdm search command. #993
  • -
  • Fix a bug that the env vars in source urls in exported result are not expanded. #997
  • -
-

Release v1.13.5 (2022-03-23)#

-

Features & Improvements#

-
    -
  • Users can change the install destination of global project to the user site(~/.local) with global_project.user_site config. #885
  • -
  • Make the path to the global project configurable. Rename the configuration auto_global to global_project.fallback and deprecate the old name. #986
  • -
-

Bug Fixes#

-
    -
  • Fix the compatibility when fetching license information in show command. #966
  • -
  • Don't follow symlinks for the paths in the requirement strings. #976
  • -
  • Use the default install scheme when installing build requirements. #983
  • -
  • Fix a bug that _.site_packages is overridden by default option value. #985
  • -
-

Release v1.13.4 (2022-03-09)#

-

Features & Improvements#

-
    -
  • Update the dependency pdm-pep517 to support PEP 639. #959
  • -
-

Bug Fixes#

-
    -
  • Filter out the unmatched python versions when listing the available versions. #941
  • -
  • Fix a bug displaying the available python versions. #943
  • -
  • Fix a bug under non-UTF8 console encoding. #960
  • -
  • Fix a bug that data files are not copied to the destination when using installation cache. #961
  • -
-

Release v1.13.3 (2022-02-24)#

-

Bug Fixes#

-
    -
  • Fix a bug that VCS repo name are parsed as the package name. #928
  • -
  • Support prerelease versions for global projects. #932
  • -
  • Fix a bug that VCS revision in the lock file isn't respected when installing. #933
  • -
-

Dependencies#

-
    -
  • Switch from pythonfinder to findpython as the Python version finder. #930
  • -
-

Release v1.13.2 (2022-02-20)#

-

Bug Fixes#

-
    -
  • Fix a regression issue that prereleases can't be installed if the version specifier of the requirement doesn't imply that. #920
  • -
-

Release v1.13.1 (2022-02-18)#

-

Bug Fixes#

-
    -
  • Fix a bug that bad pip cache dir value breaks PDM's check update function. #922
  • -
  • Fix a race condition in parallel installation by changing metadata to a lazy property. - This fixes a bug that incompatible wheels are installed unexpectedly. #924
  • -
-

Release v1.13.0.post0 (2022-02-18)#

-

Bug Fixes#

-
    -
  • Fix a bug that incompatible platform-specific wheels are installed. #921
  • -
-

Release v1.13.0 (2022-02-18)#

-

Features & Improvements#

-
    -
  • Support pre_* and post_* scripts for task composition. Pre- and Post- scripts for init, build, install and lock will be run if present. #789
  • -
  • Support --config/-c option to specify another global configuration file. #883
  • -
  • Packages with extras require no longer inherit the dependencies from the same package without extras. It is because the package without extras are returned as one of the dependencies. This change won't break the existing lock files nor dependency cache. #892
  • -
  • Support version ranges in [tool.pdm.overrides] table. #909
  • -
  • Rename config use_venv to python.use_venv; - rename config feature.install_cache to install.cache; - rename config feature.install_cache_method to install.cache_method; - rename config parallel_install to install.parallel. #914
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that file URLs or VCS URLs don't work in [tool.pdm.overrides] table. #861
  • -
  • Fix a bug of identifier mismatch for URL requirements without an explicit name. #901
  • -
  • No requires-python should be produced if ANY(*) is given. #917
  • -
  • Fix a bug that pdm.lock gets created when --dry-run is passed to pdm add. #918
  • -
-

Improved Documentation#

-
    -
  • The default editable backend becomes path. #904
  • -
-

Removals and Deprecations#

-
    -
  • Stop auto-migrating projects from PDM 0.x format. #912
  • -
-

Refactor#

-
    -
  • Rename ExtrasError to ExtrasWarning for better understanding. Improve the warning message. #892
  • -
  • Extract the environment related code from Candidate into a new class PreparedCandidate. - Candidate no longer holds an Environment instance. #920
  • -
-

Release v1.12.8 (2022-02-06)#

-

Features & Improvements#

-
    -
  • Print the error and continue if a plugin fails to load. #878
  • -
-

Bug Fixes#

-
    -
  • PDM now ignores configuration of uninstalled plugins. #872
  • -
  • Fix the compatibility issue with pip>=22.0. #875
  • -
-

Release v1.12.7 (2022-01-31)#

-

Features & Improvements#

-
    -
  • If no command is given to pdm run, it will run the Python REPL. #856
  • -
-

Bug Fixes#

-
    -
  • Fix the hash calculation when generating direct_url.json for a local pre-built wheel. #861
  • -
  • PDM no longer migrates project meta silently. #867
  • -
-

Dependencies#

-
    -
  • Pin pip<22.0. #874
  • -
-

Miscellany#

-
    -
  • Reduce the number of tests that require network, and mark the rest with network marker. #858
  • -
-

Release v1.12.6 (2022-01-12)#

-

Bug Fixes#

-
    -
  • Fix a bug that cache dir isn't created. #843
  • -
-

Release v1.12.5 (2022-01-11)#

-

Bug Fixes#

-
    -
  • Fix a resolution error that dots in the package name are normalized to - unexpectedly. #853
  • -
-

Release v1.12.4 (2022-01-11)#

-

Features & Improvements#

-
    -
  • Remember the last selection in use command to save the human effort. - And introduce an -i option to ignored that remembered value. #846
  • -
-

Bug Fixes#

-
    -
  • Fix a bug of uninstall crash when the package has directories in RECORD. #847
  • -
  • Fix the ModuleNotFoundError during uninstall when the modules required are removed. #850
  • -
-

Release v1.12.3 (2022-01-07)#

-

Features & Improvements#

-
    -
  • Support setting Python path in global configuration. #842
  • -
-

Bug Fixes#

-
    -
  • Lowercase the package names in the lock file make it more stable. #836
  • -
  • Show the packages to be updated in dry run mode of pdm update even if --no-sync is passed. #837
  • -
  • Improve the robustness of update check code. #841
  • -
  • Fix a bug that export result has environment markers that don't apply for all requirements. #843
  • -
-

Release v1.12.2 (2021-12-30)#

-

Features & Improvements#

-
    -
  • Allow changing the installation linking method by feature.install_cache_method config. #822
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that namespace packages can't be symlinked to the cache due to existing links. #820
  • -
  • Make PDM generated pth files processed as early as possible. #821
  • -
  • Fix a UnicodeDecodeError for subprocess logger under Windows/GBK. #823
  • -
-

Release v1.12.1 (2021-12-24)#

-

Bug Fixes#

-
    -
  • Don't symlink pycaches to the target place. #817
  • -
-

Release v1.12.0 (2021-12-22)#

-

Features & Improvements#

-
    -
  • Add lock --refresh to update the hash stored with the lock file without updating the pinned versions. #642
  • -
  • Support resolution overriding in the [tool.pdm.overrides] table. #790
  • -
  • Add support for signals for basic operations, now including post_init, pre_lock, post_lock, pre_install and post_install. #798
  • -
  • Add install --check to check if the lock file is up to date. #810
  • -
  • Use symlinks to cache installed packages when it is supported by the file system. #814
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that candidates from urls are rejected by the allow_prereleases setting. - Now non-named requirements are resolved earlier than pinned requirements. #799
  • -
-

Improved Documentation#

-
    -
  • Add a new doc page: API reference. #802
  • -
-

Dependencies#

-
    -
  • Switch back from atoml to tomlkit as the style-preserving TOML parser. The latter has supported TOML v1.0.0. #809
  • -
-

Miscellany#

-
    -
  • Cache the latest version of PDM for one week to reduce the request frequency. #800
  • -
-

Release v1.11.3 (2021-12-15)#

-

Features & Improvements#

-
    -
  • Change the default version save strategy to minimum, without upper bounds. #787
  • -
-

Bug Fixes#

-
    -
  • Fix the patching of sysconfig in PEP 582 initialization script. #796
  • -
-

Miscellany#

-
    -
  • Fix an installation failure of the bootstrap script on macOS Catalina. #793
  • -
  • Add a basic benchmarking script. #794
  • -
-

Release v1.11.2 (2021-12-10)#

-

Bug Fixes#

-
    -
  • Fix the resolution order to reduce the loop number to find a conflict. #781
  • -
  • Patch the functions in sysconfig to return the PEP 582 scheme in pdm run. #784
  • -
-

Dependencies#

-
    -
  • Remove the upper bound of version constraints for most dependencies, except for some zero-versioned ones. #787
  • -
-

Release v1.11.1 (2021-12-08)#

-

Features & Improvements#

-
    -
  • Support --pre/--prelease option for pdm add and pdm update. It will allow prereleases to be pinned. #774
  • -
  • Improve the error message when python is found but not meeting the python requirement. #777
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that git+https candidates cannot be resolved. #771
  • -
  • Fix an infinite resolution loop by resolving the top-level packages first. Also deduplicate the lines from the same requirement in the error output. #776
  • -
-

Miscellany#

-
    -
  • Fix the install script to use a zipapp of virtualenv when it isn't installed. #780
  • -
-

Release v1.11.0 (2021-11-30)#

-

Features & Improvements#

-
    -
  • Move version from [project] table to [tool.pdm] table, delete classifiers from dynamic, and warn usage about the deprecated usages. #748
  • -
  • Add support for Conda environments in addition to Python virtual environments. #749
  • -
  • Add support for saving only the lower bound x >= VERSION when adding dependencies. #752
  • -
  • Improve the error message when resolution fails. #754
  • -
-

Bug Fixes#

-
    -
  • Switch to self-implemented pdm list --freeze to fix a bug due to Pip's API change. #533
  • -
  • Fix an infinite loop issue when resolving candidates with incompatible requires-python. #744
  • -
  • Fix the python finder to support pyenv-win. #745
  • -
  • Fix the ANSI color output for Windows cmd and Powershell terminals. #753
  • -
-

Removals and Deprecations#

-
    -
  • Remove -s/--section option from all previously supported commands. Use -G/--group instead. #756
  • -
-

Release v1.10.3 (2021-11-18)#

-

Bug Fixes#

-
    -
  • Use importlib to replace imp in the sitecustomize module for Python 3. #574
  • -
  • Fix the lib paths under non-isolated build. #740
  • -
  • Exclude the dependencies with extras in the result of pdm export. #741
  • -
-

Release v1.10.2 (2021-11-14)#

-

Features & Improvements#

-
    -
  • Add a new option -s/--site-packages to pdm run as well as a script config item. When it is set to True, site-packages from the selected interpreter will be loaded into the running environment. #733
  • -
-

Bug Fixes#

-
    -
  • Now NO_SITE_PACKAGES isn't set in pdm run if the executable is out of local packages. #733
  • -
-

Release v1.10.1 (2021-11-09)#

-

Features & Improvements#

-
    -
  • Isolate the project environment with system site packages in pdm run, but keep them seen when PEP 582 is enabled. #708
  • -
-

Bug Fixes#

-
    -
  • Run pip with --isolated when building wheels. In this way some env vars like PIP_REQUIRE_VIRTUALENV can be ignored. #669
  • -
  • Fix the install script to ensure pip is not DEBUNDLED. #685
  • -
  • Fix a bug that when summary is None, the lockfile can't be generated. #719
  • -
  • ${PROJECT_ROOT} should be written in the URL when relative path is given. #721
  • -
  • Fix a bug that when project table already exists, pdm import can't merge the settings correctly. #723
  • -
-

Release v1.10.0 (2021-10-25)#

-

Features & Improvements#

-
    -
  • Add --no-sync option to update command. #684
  • -
  • Support find_links source type. It can be specified via type key of [[tool.pdm.source]] table. #694
  • -
  • Add --dry-run option to add, install and remove commands. #698
  • -
-

Bug Fixes#

-
    -
  • Remove trailing whitespace with terminal output of tables (via project.core.ui.display_columns), fixing unnecessary wrapping due to / with empty lines full of spaces in case of long URLs in the last column. #680
  • -
  • Include files should be installed under venv's base path. #682
  • -
  • Ensure the value of check_update is boolean. #689
  • -
-

Improved Documentation#

-
    -
  • Update the contributing guide, remove the usage of setup_dev.py in favor of pip install. #676
  • -
-

Release v1.9.0 (2021-10-12)#

-

Bug Fixes#

-
    -
  • Fix a bug that requires-python is not recognized in candidates evaluation. #657
  • -
  • Fix the path order when pdm run so that executables in local packages dir are found first. #678
  • -
-

Dependencies#

-
    -
  • Update installer to 0.3.0, fixing a bug that broke installation of some packages with unusual wheel files. #653
  • -
  • Change packaging and typing-extensions to direct dependencies. #674
  • -
-

Refactor#

-
    -
  • requires-python now participates in the resolution as a dummy requirement. #658
  • -
-

Release v1.8.5 (2021-09-16)#

-

Bug Fixes#

-
    -
  • Fix the error of regex to find the shebang line. #656
  • -
-

Release v1.8.4 (2021-09-15)#

-

Features & Improvements#

-
    -
  • Support --no-isolation option for install, lock, update, remove, sync commands. #640
  • -
  • Make project_max_depth configurable and default to 5. #643
  • -
-

Bug Fixes#

-
    -
  • Don't try pdm-pep517 backend on Python 2.7 when installing self as editable. #640
  • -
  • Fix a bug that existing shebang can't be replaced correctly. #651
  • -
  • Fix the version range saving for prerelease versions. #654
  • -
-

Release v1.8.3 (2021-09-07)#

-

Features & Improvements#

-
    -
  • Allow to build in non-isolated environment, to enable optional speedups depending on the environment. #635
  • -
-

Bug Fixes#

-
    -
  • Don't copy *-nspkg.pth files in install_cache mode. It will still work without them. #623
  • -
-

Release v1.8.2 (2021-09-01)#

-

Bug Fixes#

-
    -
  • Fix the removal issue of standalone pyc files #633
  • -
-

Release v1.8.1 (2021-08-26)#

-

Features & Improvements#

-
    -
  • Add -r/--reinstall option to sync command to force re-install the existing dependencies. #601
  • -
  • Show update hint after every pdm command. #603
  • -
  • pdm cache clear can clear cached installations if not needed any more. #604
  • -
-

Bug Fixes#

-
    -
  • Fix the editable install script so that setuptools won't see the dependencies under local packages. #601
  • -
  • Preserve the executable bit when installing wheels. #606
  • -
  • Write PEP 610 metadata direct_url.json when installing wheels. #607
  • -
  • Fix a bug that * fails to be converted as SpecifierSet. #609
  • -
-

Refactor#

-
    -
  • Build editable packages are into wheels via PEP 660 build backend. Now all installations are unified into wheels. #612
  • -
-

Release v1.8.0 (2021-08-16)#

-

Features & Improvements#

-
    -
  • Added a new mode --json to the list command which outputs the dependency graph as a JSON document. #583
  • -
  • Add a new config feature.install_cache. When it is turned on, wheels will be installed into a centralized package repo and create .pth files under project packages directory to link to the cached package. #589
  • -
-

Bug Fixes#

-
    -
  • Fix env vars in source URLs not being expanded in all cases. #570
  • -
  • Fix the weird output of pdm show. #580
  • -
  • Prefer ~/.pyenv/shims/python3 as the pyenv interpreter. #590
  • -
  • Fix a bug that installing will download candidates that do not match the locked hashes. #596
  • -
-

Improved Documentation#

-
    -
  • Added instructions to the Contributing section for creating news fragments #573
  • -
-

Removals and Deprecations#

-
    -
  • Deprecate -s/--section option in favor of -G/--group. #591
  • -
-

Refactor#

-
    -
  • Switch to a self-implemented version of uninstaller. #586
  • -
  • pdm/installers/installers.py is renamed to pdm/installers/manager.py to be more accurate. The Installer class under that file is renamed to InstallerManager and is exposed in the pdm.core.Core object for overriding. The new pdm/installers/installers.py contains some installation implementations. #589
  • -
  • Switch from pkg_resources.Distribution to the implementation of importlib.metadata. #592
  • -
-

Release v1.7.2 (2021-07-30)#

-

Bug Fixes#

-
    -
  • Remove the existing files before installing. #565
  • -
  • Deduplicate the plugins list. #566
  • -
-

Release v1.7.1 (2021-07-29)#

-

Bug Fixes#

-
    -
  • Accept non-canonical distribution name in the wheel's dist-info directory name. #529
  • -
  • Prefer requirements with narrower version constraints or allowing prereleases to find matches. #551
  • -
  • Use the underlying real executable path for writing shebangs. #553
  • -
  • Fix a bug that extra markers cannot be extracted when combined with other markers with "and". #559
  • -
  • Fix a bug that redacted credentials in source urls get overwritten with the plain text after locking. #561
  • -
-

Refactor#

-
    -
  • Use installer as the wheel installer, replacing distlib. #519
  • -
-

Release v1.7.0 (2021-07-20)#

-

Features & Improvements#

-
    -
  • Support showing individual fields by --<field-name> options in pdm show. When no package is given, show this project. #527
  • -
  • Add --freeze option to pdm list command which shows the dependencies list as pip's requirements.txt format. #531
  • -
-

Bug Fixes#

-
    -
  • Fix the path manipulation on Windows, now the PEP 582 path is prepended to the PYTHONPATH. #522
  • -
  • Fix the handling of auth prompting: will try keyring in non-verbose mode. #523
  • -
  • Recognize old entry point name "pdm.plugin" for backward-compatibility. #530
  • -
  • Match the VCS scheme in case-insensitive manner. #537
  • -
  • Use the default permission bits when writing project files. #542
  • -
  • Fix the VCS url to be consistent between lock and install. #547
  • -
-

Improved Documentation#

-
    -
  • Add installation instructions for Scoop. #522
  • -
-

Dependencies#

-
    -
  • Update pdm-pep517 to 0.8.0. #524
  • -
  • Switch from toml to tomli. #541
  • -
-

Refactor#

-
    -
  • Separate the build env into two different levels for better caching. #541
  • -
  • Refactor the build part into smaller functions. #543
  • -
-

Release v1.6.4 (2021-06-23)#

-

Features & Improvements#

-
    -
  • Extract package name from egg-info in filename when eligible. Remove the patching code of resolvelib's inner class. #441
  • -
  • Support installing packages from subdiretories of VCS repository. #507
  • -
  • Add an install script to bootstrap PDM quickly without help of other tools. Modify docs to recommend this installation method. #508
  • -
  • Add a new subcommand plugin to manage pdm plugins, including add, remove and list commands. #510
  • -
-

Bug Fixes#

-
    -
  • Don't monkeypatch the internal class of resolvelib any more. This makes PDM more stable across updates of sub-dependencies. #515
  • -
-

Miscellany#

-
    -
  • Clear the type errors from mypy. #261
  • -
-

Release v1.6.3 (2021-06-17)#

-

Features & Improvements#

-
    -
  • Add an option -u/--unconstrained to support unconstraining version specifiers when adding packages. #501
  • -
-

Bug Fixes#

-
    -
  • Fix the format of dependency arrays when a new value is appended. #487
  • -
  • Allow missing email attribute for authors and maintainers. #492
  • -
  • Fix a bug that editable install shouldn't require pyproject.toml to be valid. #497
  • -
  • Fix a bug on macOS that purelib and platlib paths of isolated build envs cannot be substituted correctly if the Python is a framework build. #502
  • -
  • Fix the version sort of candidates. #506
  • -
-

Release v1.6.2 (2021-05-31)#

-

No significant changes.

-

Release v1.6.1 (2021-05-31)#

-

No significant changes.

-

Release v1.6.0 (2021-05-31)#

-

Features & Improvements#

-
    -
  • Use a new approach to determine the packages to be installed. This requires a quick resolution step before installation. #456
  • -
  • pdm export no longer produces requirements file applicable for all platforms due to the new approach. #456
  • -
  • Add structural typing for requirements module. Refactor the requirements module for that purpose. #433
  • -
  • Introduce --no-editable option to install non-editable versions of all packages. #443
  • -
  • Introduce --no-self option to prevent the project itself from being installed. #444
  • -
  • Add a default .gitignore file in the __pypackages__ directory. #446
  • -
  • Check if the lock file version is compatible with PDM program before installation. #463
  • -
  • Expose the project root path via PDM_PROJECT_ROOT env var. Change to the project root when executing scripts. #470
  • -
  • Fix a bug that installation resolution doesn't respect the requirement markers from pyproject config. #480
  • -
-

Bug Fixes#

-
    -
  • Changing to multiline breaks the parsing of TOML document. #462
  • -
  • Fix a bug that transient dependencies of conditional requirements can't be resolved. #472
  • -
  • Fix a bug that invalid wheels are rejected while they are acceptable for resolution. #473
  • -
  • Fix a bug that build environment is not fully isolated with the hosted environment. #477
  • -
  • Ensure the lock file is compatible before looking for the locked candidates. #484
  • -
-

Improved Documentation#

-
    -
  • Fix 404 links in documentation. #472
  • -
-

Dependencies#

-
    -
  • Migrate from tomlkit to atoml as the style-preserving TOML parser and writer. #465
  • -
-

Removals and Deprecations#

-
    -
  • Remove the warning of --dev flag for older versions of PDM. #444
  • -
-

Miscellany#

-
    -
  • Add Python 3.10 beta CI job. #457
  • -
-

Release v1.5.3 (2021-05-10)#

-

Features & Improvements#

-
    -
  • Support passing options to the build backends via --config-setting. #452
  • -
-

Bug Fixes#

-
    -
  • Seek for other sitecustomize.py to import. #422
  • -
  • Fix an unescaped single quote in fish completion script. #423
  • -
  • The hashes of a remote file candidate should be calculated from the link itself. #450
  • -
-

Dependencies#

-
    -
  • Remove keyring as a dependency and guide users to install it when it is not available. #442
  • -
  • Specify the minimum version of distlib. #447
  • -
-

Miscellany#

-
    -
  • Add log output about found candidates and their origin. #421
  • -
  • Add mypy pre-commit hook #427
  • -
  • Improve type safety of pdm.cli.actions #428
  • -
  • Fix wrong mypy configuration. #451
  • -
-

Release v1.5.2 (2021-04-27)#

-

Features & Improvements#

-
    -
  • Allow pdm use with no argument given, which will list all available pythons for pick. #409
  • -
-

Bug Fixes#

-
    -
  • Inform user to enable PEP 582 for development script to work. #404
  • -
  • Check the existence of pyenv shim Python interpreter before using it. #406
  • -
  • Fix a bug that executing setup.py failed for NameError. #407
  • -
  • Check before setting the PYTHONPATH environment variable for PEP582 #410
  • -
  • Fix development setup error. #415
  • -
-

Dependencies#

-
    -
  • Update pip to 21.1 and fix compatibility issues. #412
  • -
-

Release v1.5.1 (2021-04-22)#

-

Bug Fixes#

-
    -
  • Make func translate_sections pure to avoid exporting requirements in random order. #401
  • -
  • Expand the variables in install requirements' attributes for build. #402
  • -
-

Release v1.5.0 (2021-04-20)#

-

Features & Improvements#

-
    -
  • Include dev dependencies by default for install and sync commands. Add a new option --prod/--production to exclude them. Improve the dependency selection logic to be more convenient to use — the more common the usage is, the shorter the command is. #391
  • -
-

Bug Fixes#

-
    -
  • Enquote executable path to ensure generating valid scripts. #387
  • -
  • Consider hashes when fetching artifact link for build. #389
  • -
  • Considier the sources settings when building. #399
  • -
-

Improved Documentation#

-
    -
  • New pdm setting source-includes to mark files to be included only in sdist builds. #390
  • -
-

Dependencies#

-
    -
  • Update pdm-pep517 to 0.7.0; update resolvelib to0.7.0. #390
  • -
-

Removals and Deprecations#

-
    -
  • Deprecate the usage of -d/--dev option in install and sync commands. #391
  • -
-

Release v1.5.0b1 (2021-04-12)#

-

Features & Improvements#

-
    -
  • Improve the env builder to run in isolated mode. #384
  • -
-

Bug Fixes#

-
    -
  • Remove the incompatible code from the files that will be run in-process. #375
  • -
  • Get the correct Python ABI tag of selected interpreter #378
  • -
  • Error out when doing pdm run on a directory not initialized yet.
  • -
  • Give warning message when the project automatically fallbacks to the global project.
  • -
-

Dependencies#

-
    -
  • Upgrade resolvelib to 0.6.0. #381
  • -
-

Miscellany#

-
    -
  • refactor pdm.models.readers to improve typing support #321
  • -
  • Add a basic integration test for cross-python check. #377
  • -
  • Refactor the project.python_executable to project.python that contains all info of the interpreter. #382
  • -
  • Continue refactoring Python info to extract to its own module. #383
  • -
  • Refactor the creation of project.
  • -
-

Release v1.5.0b0 (2021-04-03)#

-

Features & Improvements#

-
    -
  • Add hand-written zsh completion script. #188
  • -
  • Add a special value :all given to -s/--section to refer to all sections under the same species. - Adjust add, sync, install, remove and update to support the new dev-dependencies groups. Old behavior will be kept the same. #351
  • -
  • dev-dependencies is now a table of dependencies groups, where key is the group name and value is an array of dependencies. These dependencies won't appear in the distribution's metadata. dev-depedencies of the old format will turn into dev group under dev-dependencies. #351
  • -
  • Move dev-dependencies, includes, excludes and package-dir out from [project] table to [tool.pdm] table. The migration will be done automatically if old format is detected. #351
  • -
  • Throws an error with meaningful message when no candidate is found for one requirement. #357
  • -
  • Support --dry-run option for update command to display packages that need update, install or removal. Add --top option to limit to top level packages only. #358
  • -
  • Full-featured completion scripts for Zsh and Powershell - section selection, package name autocompletion and so on. Windows is a first-class citizen! #367
  • -
  • Support non-interactive init command via -n/--non-interactive option. No question will be asked in this mode. #368
  • -
  • Show project packages path(PEP 582) in the output of pdm info, also add an option --packages to show that value only. #372
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that pure python libraries are not loaded to construct the WorkingSet. #346
  • -
  • Don't write <script>-X.Y variant to the bin folder. #365
  • -
  • Python is now run in isolated mode via subprocess to avoid accidentally importing user packages. #369
  • -
  • Don't overwrite existing dependencies when importing from requirements.txt. #370
  • -
-

Improved Documentation#

-
    -
  • Add instructions of how to integrate PDM with Emacs, contributed by @linw1995. #372
  • -
-

Removals and Deprecations#

-
    -
  • Remove the support of project path following -g/--global that was deprecated in 1.4.0. One should use -g -p <project_path> for that purpose. #361
  • -
-

Miscellany#

-
    -
  • Add test coverage to PDM. #109
  • -
  • Add type annotations into untyped functions to start using mypy. #354
  • -
  • Refactor the format converter code to be more explicit. #360
  • -
-

Release v1.4.5 (2021-03-30)#

-

Features & Improvements#

-
    -
  • Skip the first prompt of pdm init #352
  • -
-

Bug Fixes#

-
    -
  • Fix a test failure when using homebrew installed python. #348
  • -
  • Get revision from the VCS URL if source code isn't downloaded to local. #349
  • -
-

Dependencies#

-
    -
  • Update dependency pdm-pep517 to 0.6.1. #353
  • -
-

Release v1.4.4 (2021-03-27)#

-

Features & Improvements#

-
    -
  • Emit warning if version or description can't be retrieved when importing from flit metadata. #342
  • -
  • Add type argument to pdm cache clear and improve its UI. #343
  • -
  • Always re-install the editable packages when syncing the working set. This can help tracking the latest change of entry-points. #344
  • -
-

Bug Fixes#

-
    -
  • Make installer quit early if a wheel isn't able to build. #338
  • -
-

Miscellany#

-
    -
  • ignore type checking in models.project_info.ProjectInfo, which indexes distlib.metadata._data #335
  • -
-

Release v1.4.3 (2021-03-24)#

-

Features & Improvements#

-
    -
  • Change the group name of entry points from pdm.plugins to pdm. - Export some useful objects and models for shorter import path. #318
  • -
  • Field cmd in tools.pdm.scripts configuration items now allows specifying an argument array instead of a string.
  • -
  • Refactor: Remove the reference of stream singleton, improve the UI related code. #320
  • -
  • Support dependencies managed by poetry and flit being installed as editable packages. #324
  • -
  • Refactor: Extract the logic of finding interpreters to method for the sake of subclass overriding. #326
  • -
  • Complete the cache command, add list, remove and info subcommands. #329
  • -
  • Refactor: Unify the code about selecting interpreter to reduce the duplication. #331
  • -
  • Retrieve the version and description of a flit project by parsing the AST of the main file. #333
  • -
-

Bug Fixes#

-
    -
  • Fix a parsing error when non-ascii characters exist in pyproject.toml. #308
  • -
  • Fix a bug that non-editable VCS candidates can't satisfy their requirements once locked in the lock file. #314
  • -
  • Fix a bug of import-on-init that fails when requirements.txt is detected. #328
  • -
-

Miscellany#

-
    -
  • refactor pdm.iostream to improve 'typing' support #301
  • -
  • fix some typos #323
  • -
-

Release v1.4.2 (2021-03-18)#

-

Features & Improvements#

-
    -
  • Refactor the code, extract the version related logic from specifiers.py to a separated module. #303
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that get_dependencies() returns error when the setup.py has no intall_requires key. #299
  • -
  • Pin the VCS revision for non-editable VCS candidates in the lock file. #305
  • -
  • Fix a bug that editable build hits the cached wheel unexpectedly. #307
  • -
-

Miscellany#

-
    -
  • replace 'typing comments' with type annotations throughout #298
  • -
-

Release v1.4.1 (2021-03-12)#

-

Features & Improvements#

-
    -
  • Support importing dependencies from requirements.txt to dev-dependencies or sections. #291
  • -
-

Bug Fixes#

-
    -
  • Fallback to static parsing when building was failed to find the dependencies of a candidate. #293
  • -
  • Fix a bug that pdm init fails when pyproject.toml exists but has no [project] section. #295
  • -
-

Improved Documentation#

-
    -
  • Document about how to use PDM with Nox. #281
  • -
-

Release v1.4.0 (2021-03-05)#

-

Features & Improvements#

-
    -
  • When -I/--ignore-python passed or PDM_IGNORE_SAVED_PYTHON=1, ignore the interpreter set in .pdm.toml and don't save to it afterwards. #283
  • -
  • A new option -p/--project is introduced to specify another path for the project base. It can also be combined with -g/--global option. - The latter is changed to a flag only option that does not accept values. #286
  • -
  • Support -f setuppy for pdm export to export the metadata as setup.py #289
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that editable local package requirements cannot be parsed rightly. #285
  • -
  • Change the priority of metadata files to parse so that PEP 621 metadata will be parsed first. #288
  • -
-

Improved Documentation#

-
    -
  • Add examples of how to integrate with CI pipelines (and tox). #281
  • -
-

Release v1.3.4 (2021-03-01)#

-

Improved Documentation#

- -

Bug Fixes#

-
    -
  • Ignore the python requires constraints when fetching the link from the PyPI index.
  • -
-

Release v1.3.3 (2021-02-26)#

-

Bug Fixes#

-
    -
  • Fix the requirement string of a VCS requirement to comply with PEP 508. #275
  • -
  • Fix a bug that editable packages with src directory can't be uninstalled correctly. #277
  • -
  • Fix a bug that editable package doesn't override the non-editable version in the working set. #278
  • -
-

Release v1.3.2 (2021-02-25)#

-

Features & Improvements#

-
    -
  • Abort and tell user the selected section following pdm sync or pdm install is not present in the error message. #274
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that candidates' sections cannot be retrieved rightly when circular dependencies exist. #270
  • -
  • Don't pass the help argument into the run script method. #272
  • -
-

Release v1.3.1 (2021-02-19)#

-

Bug Fixes#

-
    -
  • Use the absolute path when importing from a Poetry pyproject.toml. #262
  • -
  • Fix a bug that old toml table head is kept when converting to PEP 621 metadata format. #263
  • -
  • Postpone the evaluation of requires-python attribute when fetching the candidates of a package. #264
  • -
-

Release v1.3.0 (2021-02-09)#

-

Features & Improvements#

-
    -
  • Increase the default value of the max rounds of resolution to 1000, make it configurable. #238
  • -
  • Rewrite the project's egg-info directory when dependencies change. So that pdm list --graph won't show invalid entries. #240
  • -
  • When importing requirements from a requirements.txt file, build the package to find the name if not given in the URL. #245
  • -
  • When initializing the project, prompt user for whether the project is a library, and give empty name and version if not. #253
  • -
-

Bug Fixes#

-
    -
  • Fix the version validator of wheel metadata to align with the implementation of packaging. #130
  • -
  • Preserve the sections value of a pinned candidate to be reused. #234
  • -
  • Strip spaces in user input when prompting for the python version to use. #252
  • -
  • Fix the version parsing of Python requires to allow >, >=, <, <= to combine with star versions. #254
  • -
-

Release v1.2.0 (2021-01-26)#

-

Features & Improvements#

-
    -
  • Change the behavior of --save-compatible slightly. Now the version specifier saved is using the REAL compatible operator ~= as described in PEP 440. Before: requests<3.0.0,>=2.19.1, After: requests~=2.19. The new specifier accepts requests==2.19.0 as compatible version. #225
  • -
  • Environment variable ${PROJECT_ROOT} in the dependency specification can be expanded to refer to the project root in pyproject.toml. - The environment variables will be kept as they are in the lock file. #226
  • -
  • Change the dependencies of a package in the lock file to a list of PEP 508 strings #236
  • -
-

Bug Fixes#

-
    -
  • Ignore user's site and PYTHONPATH(with python -I mode) when executing pip commands. #231
  • -
-

Improved Documentation#

-
    -
  • Document about how to activate and use a plugin. #227
  • -
-

Dependencies#

-
    -
  • Test project on pip 21.0. #235
  • -
-

Release v1.1.0 (2021-01-18)#

-

Features & Improvements#

-
    -
  • Allow users to hide secrets from the pyproject.toml.
  • -
  • Dynamically expand env variables in the URLs in dependencies and indexes.
  • -
  • Ask whether to store the credentials provided by the user.
  • -
  • A user-friendly error will show when credentials are not provided nor correct. #198
  • -
  • Use a different package dir for 32-bit installation(Windows). #212
  • -
  • Auto disable PEP 582 when a venv-like python is given as the interpreter path. #219
  • -
  • Support specifying Python interpreter by pdm use <path-to-python-root>. #221
  • -
-

Bug Fixes#

-
    -
  • Fix a bug of PYTHONPATH manipulation under Windows platform. #215
  • -
-

Removals and Deprecations#

-
    -
  • Remove support of the old PEP 517 backend API path. #217
  • -
-

Release v1.0.0 (2021-01-05)#

-

Bug Fixes#

-
    -
  • Correctly build wheels for dependencies with build-requirements but without a specified build-backend #213
  • -
-

Release v1.0.0b2 (2020-12-29)#

-

Features & Improvements#

-
    -
  • Fallback to pypi.org when /search endpoint is not available on given index. #211
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that PDM fails to parse python version specifiers with more than 3 parts. #210
  • -
-

Release v1.0.0b0 (2020-12-24)#

-

Features & Improvements#

-
    -
  • Fully support of PEP 621 specification.
  • -
  • Old format is deprecated at the same time.
  • -
  • PDM will migrate the project file for you when old format is detected.
  • -
  • Other metadata formats(Poetry, Pipfile, flit) can also be imported as PEP 621 metadata. #175
  • -
  • Re-implement the pdm search to query the /search HTTP endpoint. #195
  • -
  • Reuse the cached built wheels to accelerate the installation. #200
  • -
  • Make update strategy and save strategy configurable in pdm config. #202
  • -
  • Improve the error message to give more insight on what to do when resolution fails. #207
  • -
  • Set classifiers dynamic in pyproject.toml template for autogeneration. #209
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that distributions are not removed clearly in parallel mode. #204
  • -
  • Fix a bug that python specifier is_subset() returns incorrect result. #206
  • -
-

Release v0.12.3 (2020-12-21)#

-

Dependencies#

-
    -
  • Pin pdm-pep517 to <0.3.0, this is the last version to support legacy project metadata format.
  • -
-

Release v0.12.2 (2020-12-17)#

-

Features & Improvements#

-
    -
  • Update the lock file schema, move the file hashes to [metadata.files] table. #196
  • -
  • Retry failed jobs when syncing packages. #197
  • -
-

Removals and Deprecations#

-
    -
  • Drop pip-shims package as a dependency. #132
  • -
-

Miscellany#

-
    -
  • Fix the cache path for CI. #199
  • -
-

Release v0.12.1 (2020-12-14)#

-

Features & Improvements#

-
    -
  • Provide an option to export requirements from pyproject.toml #190
  • -
  • For Windows users, pdm --pep582 can enable PEP 582 globally by manipulating the WinReg. #191
  • -
-

Bug Fixes#

-
    -
  • Inject __pypackages__ into PATH env var during pdm run. #193
  • -
-

Release v0.12.0 (2020-12-08)#

-

Features & Improvements#

-
    -
  • Improve the user experience of pdm run:
  • -
  • Add a special key in tool.pdm.scripts that holds configurations shared by all scripts.
  • -
  • Support loading env var from a dot-env file.
  • -
  • Add a flag -s/--site-packages to include system site-packages when running. #178
  • -
  • Now PEP 582 can be enabled in the Python interpreter directly! #181
  • -
-

Bug Fixes#

-
    -
  • Ensure setuptools is installed before invoking editable install script. #174
  • -
  • Require wheel not wheels for global projects #182
  • -
  • Write a sitecustomize.py instead of a .pth file to enable PEP 582. Thanks @Aloxaf. - Update get_package_finder() to be compatible with pip 20.3. #185
  • -
  • Fix the help messages of commands "cache" and "remove" #187
  • -
-

Release v0.11.0 (2020-11-20)#

-

Features & Improvements#

-
    -
  • Support custom script shortcuts in pyproject.toml.
  • -
  • Support custom script shortcuts defined in [tool.pdm.scripts] section.
  • -
  • Add pdm run --list/-l to show the list of script shortcuts. #168
  • -
  • Patch the halo library to support parallel spinners.
  • -
  • Change the looking of pdm install. #169
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that package's marker fails to propagate to its grandchildren if they have already been resolved. #170
  • -
  • Fix a bug that bare version specifiers in Poetry project can't be converted correctly. #172
  • -
  • Fix the build error that destination directory is not created automatically. #173
  • -
-

Release v0.10.2 (2020-11-05)#

-

Bug Fixes#

-
    -
  • Building editable distribution does not install build-system.requires anymore. #167
  • -
-

Release v0.10.1 (2020-11-04)#

-

Bug Fixes#

-
    -
  • Switch the PEP 517 build frontend from build to a home-grown version. #162
  • -
  • Synchronize the output of LogWrapper. #164
  • -
  • Fix a bug that is_subset and is_superset may return wrong result when wildcard excludes overlaps with the upper bound. #165
  • -
-

Release v0.10.0 (2020-10-20)#

-

Features & Improvements#

-
    -
  • Change to Git style config command. #157
  • -
  • Add a command to generate scripts for autocompletion, which is backed by pycomplete. #159
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that sitecustomize.py incorrectly gets injected into the editable console scripts. #158
  • -
-

Release v0.9.2 (2020-10-13)#

-

Features & Improvements#

-
    -
  • Cache the built wheels to accelerate resolution and installation process. #153
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that no wheel is matched when finding candidates to install. #155
  • -
  • Fix a bug that installation in parallel will cause encoding initialization error on Ubuntu. #156
  • -
-

Release v0.9.1 (2020-10-13)#

-

Features & Improvements#

-
    -
  • Display plain text instead of spinner bar under verbose mode. #150
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that the result of find_matched() is exhausted when accessed twice. #149
  • -
-

Release v0.9.0 (2020-10-08)#

-

Features & Improvements#

-
    -
  • Allow users to combine several dependency sections to form an extra require. #131
  • -
  • Split the PEP 517 backend to its own(battery included) package. #134
  • -
  • Add a new option to list command to show reverse dependency graph. #137
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that spaces in path causes requirement parsing error. #138
  • -
  • Fix a bug that requirement's python constraint is not respected when resolving. #141
  • -
-

Dependencies#

-
    -
  • Update pdm-pep517 to 0.2.0 that supports reading version from SCM. #146
  • -
-

Miscellany#

-
    -
  • Add Python 3.9 to the CI version matrix to verify. #144
  • -
-

Release v0.8.7 (2020-09-04)#

-

Bug Fixes#

-
    -
  • Fix a compatibility issue with wheel==0.35. #135
  • -
-

Release v0.8.6 (2020-07-09)#

-

Bug Fixes#

-
    -
  • Fix a bug that extra sources are not respected when fetching distributions. #127
  • -
-

Release v0.8.5 (2020-06-24)#

-

Bug Fixes#

-
    -
  • Fix a bug that pdm export fails when the project doesn't have name property. #126
  • -
-

Dependencies#

-
    -
  • Upgrade dependency pip to 20.1. #125
  • -
-

Release v0.8.4 (2020-05-21)#

-

Features & Improvements#

-
    -
  • Add a new command export to export to alternative formats. #117
  • -
-

Miscellany#

-
    -
  • Add Dockerfile and pushed to Docker Hub. #122
  • -
-

Release v0.8.3 (2020-05-15)#

-

Bug Fixes#

-
    -
  • Fix the version constraint parsing of wheel metadata. #120
  • -
-

Release v0.8.2 (2020-05-03)#

-

Bug Fixes#

-
    -
  • Update resolvers to resolvelib 0.4.0. #118
  • -
-

Release v0.8.1 (2020-04-22)#

-

Dependencies#

-
    -
  • Switch to upstream resolvelib 0.3.0. #116
  • -
-

Release v0.8.0 (2020-04-20)#

-

Features & Improvements#

-
    -
  • Add a new command to search for packages #111
  • -
  • Add show command to show package metadata. #114
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that environment markers cannot be evaluated correctly if extras are connected with "or". #107
  • -
  • Don't consult PyPI JSON API by default for package metadata. #112
  • -
  • Eliminate backslashes in markers for TOML documents. #115
  • -
-

Release v0.7.1 (2020-04-13)#

-

Bug Fixes#

-
    -
  • Editable packages requires setuptools to be installed in the isolated environment.
  • -
-

Release v0.7.0 (2020-04-12)#

-

Features & Improvements#

-
    -
  • Disable loading of site-packages under PEP 582 mode. #100
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that TOML parsing error is not correctly captured. #101
  • -
  • Fix a bug of building wheels with C extensions that the platform in file name is incorrect. #99
  • -
-

Release v0.6.5 (2020-04-07)#

-

Bug Fixes#

-
    -
  • Unix style executable script suffix is missing.
  • -
-

Release v0.6.4 (2020-04-07)#

-

Features & Improvements#

-
    -
  • Update shebang lines in the executable scripts when doing pdm use. #96
  • -
  • Auto-detect commonly used venv directories. #97
  • -
-

Release v0.6.3 (2020-03-30)#

-

Bug Fixes#

-
    -
  • Fix a bug of moving files across different file system. #95
  • -
-

Release v0.6.2 (2020-03-29)#

-

Bug Fixes#

-
    -
  • Validate user input for python_requires when initializing project. #89
  • -
  • Ensure wheel package is available before building packages. #90
  • -
  • Fix an issue of remove command that will unexpectedly uninstall packages in default section. #92
  • -
-

Dependencies#

-
    -
  • Update dependencies pythonfinder, python-cfonts, pip-shims and many others. - Drop dependency vistir. #89
  • -
-

Release v0.6.1 (2020-03-25)#

-

Features & Improvements#

-
    -
  • Redirect output messages to log file for installation and locking. #84
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that parallel installation fails due to setuptools reinstalling. #83
  • -
-

Release v0.6.0 (2020-03-20)#

-

Features & Improvements#

-
    -
  • Support specifying build script for C extensions. #23
  • -
  • Add test cases for pdm build. #81
  • -
  • Make it configurable whether to consult PyPI JSON API since it may be not trustable.
  • -
  • Support parallel installation.
  • -
  • Add new command pmd import to import project metadata from Pipfile, poetry, flit, requirements.txt. - #79
  • -
  • pdm init and pdm install will auto-detect possible files that can be imported.
  • -
-

Bug Fixes#

-
    -
  • Fix wheel builds when package_dir is mapped. #81
  • -
  • pdm init will use the current directory rather than finding the parents when -global project is not activated.
  • -
-

Release v0.5.0 (2020-03-14)#

-

Features & Improvements#

-
    -
  • Introduce a super easy-to-extend plug-in system to PDM. #75
  • -
-

Improved Documentation#

-
    -
  • Documentation on how to write a plugin. #75
  • -
-

Bug Fixes#

-
    -
  • Fix a typo in metadata parsing from plugins to entry_points
  • -
-

Release v0.4.2 (2020-03-13)#

-

Features & Improvements#

-
    -
  • Refactor the CLI part, switch from click to argparse, for better extensibility. #73
  • -
  • Allow users to configure to install packages into venv when it is activated. #74
  • -
-

Release v0.4.1 (2020-03-11)#

-

Features & Improvements#

-
    -
  • Add a minimal dependency set for global project. #72
  • -
-

Release v0.4.0 (2020-03-10)#

-

Features & Improvements#

-
    -
  • Global project support
  • -
  • Add a new option -g/--global to manage global project. The default location is at ~/.pdm/global-project.
  • -
  • Use the virtualenv interpreter when detected inside an activated venv.
  • -
  • Add a new option -p/--project to select project root other than the default one. #30
  • -
  • Add a new command pdm config del to delete an existing config item. #71
  • -
-

Bug Fixes#

-
    -
  • Fix a URL parsing issue that username will be dropped in the SSH URL. #68
  • -
-

Improved Documentation#

-
    -
  • Add docs for global project and selecting project path. #30
  • -
-

Release v0.3.2 (2020-03-08)#

-

Features & Improvements#

-
    -
  • Display all available Python interpreters if users don't give one in pdm init. #67
  • -
-

Bug Fixes#

-
    -
  • Regard 4.0 as infinite upper bound when checking subsetting. #66
  • -
-

Release v0.3.1 (2020-03-07)#

-

Bug Fixes#

-
    -
  • Fix a bug that ImpossiblePySpec's hash clashes with normal one.
  • -
-

Release v0.3.0 (2020-02-28)#

-

Features & Improvements#

-
    -
  • Add a new command pdm config to inspect configurations. #26
  • -
  • Add a new command pdm cache clear to clean caches. #63
  • -
-

Bug Fixes#

-
    -
  • Correctly show dependency graph when circular dependencies exist. #62
  • -
-

Improved Documentation#

-
    -
  • Write the initial documentation for PDM. #14
  • -
-

Release v0.2.6 (2020-02-25)#

-

Features & Improvements#

-
    -
  • Improve the user interface of selecting Python interpreter. #54
  • -
-

Bug Fixes#

-
    -
  • Fix the wheel installer to correctly unparse the flags of console scripts. #56
  • -
  • Fix a bug that OS-dependent hashes are not saved. #57
  • -
-

Release v0.2.5 (2020-02-22)#

-

Features & Improvements#

-
    -
  • Allow specifying Python interpreter via --python option in pdm init. #49
  • -
  • Set python_requires when initializing and defaults to >={current_version}. #50
  • -
-

Bug Fixes#

-
    -
  • Always consider wheels before tarballs; correctly merge markers from different parents. #47
  • -
  • Filter out incompatible wheels when installing. #48
  • -
-

Release v0.2.4 (2020-02-21)#

-

Bug Fixes#

-
    -
  • Use the project local interpreter to build wheels. #43
  • -
  • Correctly merge Python specifiers when possible. #4
  • -
-

Release v0.2.3 (2020-02-21)#

-

Bug Fixes#

-
    -
  • Fix a bug that editable build generates a malformed setup.py.
  • -
-

Release v0.2.2 (2020-02-20)#

-

Features & Improvements#

-
    -
  • Add a fancy greeting banner when user types pdm --help. #42
  • -
-

Bug Fixes#

-
    -
  • Fix the RECORD file in built wheel. #41
  • -
-

Dependencies#

-
    -
  • Add dependency python-cfonts to display banner. #42
  • -
-

Release v0.2.1 (2020-02-18)#

-

Bug Fixes#

-
    -
  • Fix a bug that short python_version markers can't be parsed correctly. #38
  • -
  • Make _editable_intall.py compatible with Py2.
  • -
-

Release v0.2.0 (2020-02-14)#

-

Features & Improvements#

-
    -
  • New option: pdm list --graph to show a dependency graph of the working set. #10
  • -
  • New option: pdm update --unconstrained to ignore the version constraint of given packages. #13
  • -
  • Improve the error message when project is not initialized before running commands. #19
  • -
  • Pinned candidates in lock file are reused when relocking during pdm install. #33
  • -
  • Use the pyenv interpreter value if pyenv is installed. #36
  • -
  • Introduce a new command pdm info to show project environment information. #9
  • -
-

Bug Fixes#

-
    -
  • Fix a bug that candidate hashes will be lost when reused. #11
  • -
-

Dependencies#

-
    -
  • Update pip to 20.0, update pip_shims to 0.5.0. #28
  • -
-

Miscellany#

-
    -
  • Add a script named setup_dev.py for the convenience to setup pdm for development. #29
  • -
-

Release v0.1.2 (2020-02-09)#

-

Features#

-
    -
  • New command pdm use to switch python versions. #8
  • -
  • New option pdm list --graph to show a dependency graph. #10
  • -
  • Read metadata from lockfile when pinned candidate is reused.
  • -
-

Release v0.1.1 (2020-02-07)#

-

Features#

-
    -
  • Get version from the specified file. #6
  • -
  • Add column header to pdm list output.
  • -
-

Release v0.1.0 (2020-02-07)#

-

Bugfixes#

-
    -
  • Pass exit code to parent process in pdm run.
  • -
  • Fix error handling for CLI. #19
  • -
-

Miscellany#

-
    -
  • Refactor the installer mocking for tests.
  • -
-

Release v0.0.5 (2020-01-22)#

-

Improvements#

-
    -
  • Ensure pypi index url is fetched in addition to the source settings. #3
  • -
-

Bugfixes#

-
    -
  • Fix an issue that leading "c"s are mistakenly stripped. #5
  • -
  • Fix an error with PEP 517 building.
  • -
-

Release v0.0.4 (2020-01-22)#

-

Improvements#

-
    -
  • Fix editable installation, now editable scripts can also be executed from outside!
  • -
  • Content hash is calculated based on dependencies and sources, not other metadata.
  • -
-

Bugfixes#

-
    -
  • Fix an issue that editable distributions can not be removed.
  • -
-

Release v0.0.3 (2020-01-22)#

-

Features#

-
    -
  • Add pdm init to bootstrap a project.
  • -
-

Release v0.0.2 (2020-01-22)#

-

Features#

-
    -
  • A complete functioning PEP 517 build backend.
  • -
  • pdm build command.
  • -
-

Miscellany#

-
    -
  • Add a Chinese README
  • -
-

Features#

-
    -
  • Add pdm init to bootstrap a project.
  • -
-

Release v0.0.1 (2020-01-20)#

-

Features#

-
    -
  • A dependency resolver that just works.
  • -
  • A PEP 582 installer.
  • -
  • PEP 440 version specifiers.
  • -
  • PEP 508 environment markers.
  • -
  • Running scripts with PEP 582 local packages.
  • -
  • Console scripts are injected with local paths.
  • -
  • A neat CLI.
  • -
  • add, lock, list, update, remove commands.
  • -
  • PEP 517 build backends.
  • -
  • Continuous Integration.
  • -
- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/dev/contributing/index.html b/2.10/dev/contributing/index.html deleted file mode 100644 index 3e1b8d157a..0000000000 --- a/2.10/dev/contributing/index.html +++ /dev/null @@ -1,1214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Contributing to PDM - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

Contributing to PDM#

-

First off, thanks for taking the time to contribute! Contributions include but are not restricted to:

-
    -
  • Reporting bugs
  • -
  • Contributing to code
  • -
  • Writing tests
  • -
  • Writing documentation
  • -
-

The following is a set of guidelines for contributing.

- -

This section is for beginners to OSS. If you are an experienced OSS developer, you can skip -this section.

-
    -
  1. First, fork this project to your own namespace using the fork button at the top right of the repository page.
  2. -
  3. Clone the upstream repository to local: -
    1
    -2
    -3
    git clone https://github.com/pdm-project/pdm.git
    -# Or if you prefer SSH clone:
    -git clone git@github.com:pdm-project/pdm.git
    -
  4. -
  5. Add the fork as a new remote: -
    1
    -2
    git remote add fork https://github.com/yourname/pdm.git
    -git fetch fork
    -
    - where fork is the remote name of the fork repository.
  6. -
-

ProTips:

-
    -
  1. Don't modify code on the main branch, the main branch should always keep track of origin/main.
  2. -
-

To update main branch to date:

-
1
-2
-3
git pull origin main
-# In rare cases that your local main branch diverges from the remote main:
-git fetch origin && git reset --hard main
-
-
    -
  1. Create a new branch based on the up-to-date main branch for new patches.
  2. -
  3. Create a Pull Request from that patch branch.
  4. -
-

Local development#

-

We recommend working in a virtual environment. -Feel free to create a virtual environment with either the venv module or the virtualenv tool. -For example:

-
1
-2
-3
python -m venv .venv
-. .venv/bin/activate  # linux
-.venv/Scripts/activate  # windows
-
-

Make sure your pip is newer than 21.3 to install PDM in develop/editable mode.

-
1
-2
python -m pip install -U "pip>=21.3"
-python -m pip install -e .
-
-

Make sure PDM uses the virtual environment you just created:

-
1
-2
pdm config -l python.use_venv true
-pdm config -l venv.in_project true
-
-

Install PDM development dependencies:

-
1
pdm install
-
-

Now, all dependencies are installed into the Python environment you chose, which will be used for development after this point.

-

Run tests#

-
1
pdm run test
-
-

The test suite is still simple and needs expansion! Please help write more test cases.

-
-

Note

-

You can also run your test suite against all supported Python version using tox with the tox-pdm plugin. -You can either run it by yourself with:

-
1
tox
-
-

or from pdm with:

-
1
pdm run tox
-
-
-

Code style#

-

PDM uses pre-commit for linting. Install pre-commit first, for example with pip or pipx:

-
1
python -m pip install pre-commit
-
-
1
pipx install pre-commit
-
-

Then initialize pre-commit:

-
1
pre-commit install
-
-

You can now lint the code with:

-
1
pdm run lint
-
-

PDM uses black for code style and isort for sorting import statements. If you are not following them, -the CI will fail and your Pull Request will not be merged.

-

News fragments#

-

When you make changes such as fixing a bug or adding a feature, you must add a news fragment describing -your change. News fragments are placed in the news/ directory, and should be named according to this pattern: <issue_num>.<issue_type>.md (e.g., 566.bugfix.md).

-

Issue Types#

-
    -
  • feature: Features and improvements
  • -
  • bugfix: Bug fixes
  • -
  • refactor: Code restructures
  • -
  • doc: Added or improved documentation
  • -
  • dep: Changes to dependencies
  • -
  • removal: Removals or deprecations in the API
  • -
  • misc: Miscellaneous changes that don't fit any of the other categories
  • -
-

The contents of the file should be a single sentence in the imperative -mood that describes your changes. (e.g., Deduplicate the plugins list. ) See entries in the Change Log for more examples.

-

Preview the documentation#

-

If you make some changes to the docs/ and you want to preview the build result, simply do:

-
1
pdm run doc
-
-

Release#

-

Once all changes are done and ready to release, you can preview the changelog contents by running:

-
1
pdm run release --dry-run
-
-

Make sure the next version and the changelog are as expected in the output.

-

Then cut a release on the main branch:

-
1
pdm run release
-
-

GitHub action will create the release and upload the distributions to PyPI.

-

Read more options about version bumping by pdm run release --help.

- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/dev/fixtures/index.html b/2.10/dev/fixtures/index.html deleted file mode 100644 index ea37f9fc88..0000000000 --- a/2.10/dev/fixtures/index.html +++ /dev/null @@ -1,2406 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Pytest fixtures - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - - - - - -
-
- - - - - - - -

Pytest fixtures#

- - -
- - - -
- -

Some reusable fixtures for pytest.

-

New in version 2.4.0

-

To enable them in your test, add pdm.pytest as a plugin. -You can do so in your root conftest.py:

-
conftest.py
1
-2
-3
-4
-5
-6
-7
-8
-9
# single plugin
-pytest_plugins = "pytest.plugin"
-
-# many plugins
-pytest_plugins = [
-    ...
-    "pdm.pytest",
-    ...
-]
-
- - - -
- - - - - - - -
- - - -

-IndexMap = Dict[str, Path] - - - module-attribute - - -#

- - -
- -

Path some root-relative http paths to some local paths

-
- -
- -
- - - -

-IndexOverrides = Dict[str, str] - - - module-attribute - - -#

- - -
- -

PyPI indexes overrides fixture format

-
- -
- -
- - - -

-IndexesDefinition = Dict[str, Union[Tuple[IndexMap, IndexOverrides, bool], IndexMap]] - - - module-attribute - - -#

- - -
- -

Mock PyPI indexes format

-
- -
- - -
- - - -

- Distribution - - -#

- - -
- - -

A mock Distribution

- - - - - -
- - - - - - - - - - - -
- -
- -
- -
- - - -

- LocalFileAdapter - - -#

- - -
-

- Bases: requests.adapters.BaseAdapter

- - -

A local file adapter for request.

-

Allows to mock some HTTP requests with some local files

- - - - - -
- - - - - - - - - - - -
- -
- -
- -
- - - -

- MockWorkingSet - - -#

- - -
-

- Bases: collections.abc.MutableMapping

- - -

A mock working set

- - - - - -
- - - - - - - - - - - -
- -
- -
- -
- - - -

- PDMCallable - - -#

- - -
-

- Bases: Protocol

- - -

The PDM fixture callable signature

- - - - - -
- - - - - - - - - -
- - - -

-__call__(args, strict=False, input=None, obj=None, env=None, **kwargs) - -#

- - -
- - -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
args - str | list[str] -

the command arguments as a single lexable string or a strings array

- required -
strict - bool -

raise an exception on failure instead of returning if enabled

- False -
input - str | None -

an optional string to be submitted too stdin

- None -
obj - Project | None -

an optional existing Project.

- None -
env - Mapping[str, str] | None -

override the environment variables with those

- None -
- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- RunResult -

The command result

- -
- -
- - - -
- -
- -
- -
- - - -

- RunResult - - - - dataclass - - -#

- - -
- - -

Store a command execution result.

- - - - - -
- - - - - - - -
- - - -

-exception: Exception | None = None - - - instance-attribute - class-attribute - - -#

- - -
- -

If set, the exception raised on execution

-
- -
- -
- - - -

-exit_code: int - - - instance-attribute - - -#

- - -
- -

The execution exit code

-
- -
- -
- - - -

-output: str - - - property - - -#

- - -
- -

The execution stdout output (stdout alias)

-
- -
- -
- - - -

-outputs: str - - - property - - -#

- - -
- -

The execution stdout and stderr outputs concatenated

-
- -
- -
- - - -

-stderr: str - - - instance-attribute - - -#

- - -
- -

The execution stderr output

-
- -
- -
- - - -

-stdout: str - - - instance-attribute - - -#

- - -
- -

The execution stdout output

-
- -
- - - -
- - - -

-print() - -#

- - -
- -

A debugging facility

- -
- -
- - - -
- -
- -
- -
- - - -

- TestRepository - - -#

- - -
-

- Bases: BaseRepository

- - -

A mock repository to ease testing dependencies

- - - - - -
- - - - - - - - - - - -
- -
- -
- - -
- - - -

-build_env(build_env_wheels, tmp_path_factory) - -#

- - -
- -

A fixture build environment

- -

Parameters:

- - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
build_env_wheels - Iterable[Path] -

a list of wheel to install in the environment

- required -
- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- Path -

The build environment temporary path

- -
- -
- -
- - - -

-build_env_wheels() - -#

- - -
- -

Expose some wheels to be installed in the build environment.

-

Override to provide your owns.

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- Iterable[Path] -

a list of wheels paths to install

- -
- -
- -
- - - -

-local_finder_artifacts() - -#

- - -
- -

The local finder search path as a fixture

-

Override to provides your own artifacts.

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- Path -

The path to the artifacts root

- -
- -
- -
- - - -

-pdm(core, monkeypatch) - -#

- - -
- -

A fixture allowing to execute PDM commands

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- PDMCallable -

A pdm fixture command.

- -
- -
- -
- - - -

-project(project_no_init) - -#

- - -
- -

A fixture creating an initialized test project for the current test.

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- Project -

The initialized project

- -
- -
- -
- - - -

-project_no_init(tmp_path, mocker, core, pdm_session, monkeypatch, build_env) - -#

- - -
- -

A fixture creating a non-initialized test project for the current test.

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- Project -

The non-initialized project

- -
- -
- -
- - - -

-pypi_indexes() - -#

- - -
- -

Provides some mocked PyPI entries

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- IndexesDefinition -

a definition of the mocked indexes

- -
- -
- -
- - - -

-remove_pep582_path_from_pythonpath(pythonpath) - -#

- - -
- -

Remove all pep582 paths of PDM from PYTHONPATH

- -
- -
- -
- - - -

-repository(project, mocker, repository_pypi_json, local_finder) - -#

- - -
- -

A fixture providing a mock PyPI repository

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- TestRepository -

A mock repository

- -
- -
- -
- - - -

-repository_pypi_json() - -#

- - -
- -

The test repository fake PyPI definition path as a fixture

-

Override to provides your own definition path.

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- Path -

The path to a fake PyPI repository JSON definition

- -
- -
- -
- - - -

-venv_backends(project, request) - -#

- - -
- -

A fixture iterating over venv backends

- -
- -
- -
- - - -

-working_set(mocker, repository) - -#

- - -
- -

a mock working set as a fixture

- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- MockWorkingSet -

a mock working set

- -
- -
- - - -
- -
- -
- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/dev/write/index.html b/2.10/dev/write/index.html deleted file mode 100644 index 1753653770..0000000000 --- a/2.10/dev/write/index.html +++ /dev/null @@ -1,1360 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - PDM Plugins - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - - - - - -
-
- - - - - - - -

PDM Plugins#

-

PDM is aiming at being a community driven package manager. -It is shipped with a full-featured plug-in system, with which you can:

-
    -
  • Develop a new command for PDM
  • -
  • Add additional options to existing PDM commands
  • -
  • Change PDM's behavior by reading additional config items
  • -
  • Control the process of dependency resolution or installation
  • -
-

What should a plugin do#

-

The core PDM project focuses on dependency management and package publishing. Other -functionalities you wish to integrate with PDM are preferred to lie in their own plugins -and released as standalone PyPI projects. In case the plugin is considered a good supplement -of the core project it may have a chance to be absorbed into PDM.

-

Write your own plugin#

-

In the following sections, I will show an example of adding a new command hello which reads the hello.name config.

-

Write the command#

-

The PDM's CLI module is designed in a way that user can easily "inherit and modify". To write a new command:

-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
from pdm.cli.commands.base import BaseCommand
-
-class HelloCommand(BaseCommand):
-    """Say hello to the specified person.
-    If none is given, will read from "hello.name" config.
-    """
-
-    def add_arguments(self, parser):
-        parser.add_argument("-n", "--name", help="the person's name to whom you greet")
-
-    def handle(self, project, options):
-        if not options.name:
-            name = project.config["hello.name"]
-        else:
-            name = options.name
-        print(f"Hello, {name}")
-
-

First, let's create a new HelloCommand class inheriting from pdm.cli.commands.base.BaseCommand. It has two major functions:

-
    -
  • add_arguments() to manipulate the argument parser passed as the only argument, - where you can add additional command line arguments to it
  • -
  • handle() to do something when the subcommand is matched, you can do nothing by writing a single pass statement. - It accepts two arguments: an pdm.project.Project object as the first one and the parsed argparse.Namespace object as the second.
  • -
-

The document string will serve as the command help text, which will be shown in pdm --help.

-

Besides, PDM's subcommand has two default options: -v/--verbose to change the verbosity level and -g/--global to enable global project. -If you don't want these default options, override the arguments class attribute to a list of pdm.cli.options.Option objects, or -assign it to an empty list to have no default options:

-
1
-2
-3
class HelloCommand(BaseCommand):
-
-    arguments = []
-
-
-

Note

-

The default options are loaded first, then add_arguments() is called.

-
-

Register the command to the core object#

-

Write a function somewhere in your plugin project. There is no limit on what the name of the function is, -but the function should take only one argument -- the PDM core object:

-
1
-2
def hello_plugin(core):
-    core.register_command(HelloCommand, "hello")
-
-

Call core.register_command() to register the command. The second argument as the name of the subcommand is optional. -PDM will look for the HelloCommand's name attribute if the name is not passed.

-

Add a new config item#

-

Let's recall the first code snippet, hello.name config key is consulted for the name if not passed via the command line.

-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
class HelloCommand(BaseCommand):
-    """Say hello to the specified person.
-    If none is given, will read from "hello.name" config.
-    """
-
-    def add_arguments(self, parser):
-        parser.add_argument("-n", "--name", help="the person's name to whom you greet")
-
-    def handle(self, project, options):
-        if not options.name:
-            name = project.config["hello.name"]
-        else:
-            name = options.name
-        print(f"Hello, {name}")
-
-

Till now, if you query the config value by pdm config get hello.name, an error will pop up saying it is not a valid config key. -You need to register the config item, too:

-
1
-2
-3
-4
-5
from pdm.project.config import ConfigItem
-
-def hello_plugin(core):
-    core.register_command(HelloCommand, "hello")
-    core.add_config("hello.name", ConfigItem("The person's name", "John"))
-
-

where ConfigItem class takes 4 parameters, in the following order:

-
    -
  • description: a description of the config item
  • -
  • default: default value of the config item
  • -
  • global_only: whether the config is allowed to set in home config only
  • -
  • env_var: the name of environment variable which will be read as the config value
  • -
-

Other plugin points#

-

Besides of commands and configurations, the core object exposes some other methods and attributes to override. -PDM also provides some signals you can listen to. -Please read the API reference for more details.

-

Tips about developing a PDM plugin#

-

When developing a plugin, one hopes to activate and plugin in development and get updated when the code changes.

-

You can achieve this by installing the plugin in editable mode. To do this, specify the dependencies in tool.pdm.plugins array:

-
1
-2
-3
-4
[tool.pdm]
-plugins = [
-    "-e file:///${PROJECT_ROOT}"
-]
-
-

Then install it with:

-
1
pdm install --plugins
-
-

After that, all the dependencies are available in a project plugin library, including the plugin itself, in editable mode. That means any change -to the codebase will take effect immediately without re-installation. The pdm executable also uses a Python interpreter under the hood, -so if you run pdm from inside the plugin project, the plugin in development will be activated automatically, and you can do some testing to see how it works.

-

Testing your plugin#

-

PDM exposes some pytest fixtures as a plugin in the pdm.pytest module. -To benefit from them, you must add pdm[pytest] as a test dependency.

-

To enable them in your test, add pdm.pytest as a plugin. You can do so by in your root conftest.py:

-
conftest.py
1
-2
-3
-4
-5
-6
-7
-8
-9
# single plugin
-pytest_plugins = "pytest.plugin"
-
-# many plugins
-pytest_plugins = [
-    ...
-    "pdm.pytest",
-    ...
-]
-
-

You can see some usage examples into PDM own tests, especially the conftest.py file for configuration.

-

See the pytest fixtures documentation for more details.

-

Publish your plugin#

-

Now you have defined your plugin already, let's distribute it to PyPI. PDM's plugins are discovered by entry point types. -Create an pdm entry point and point to your plugin callable (yeah, it doesn't need to be a function, any callable object can work):

-

PEP 621:

-
1
-2
-3
-4
# pyproject.toml
-
-[project.entry-points.pdm]
-hello = "my_plugin:hello_plugin"
-
-

setuptools:

-
1
-2
-3
-4
-5
-6
-7
# setup.py
-
-setup(
-    ...
-    entry_points={"pdm": ["hello = my_plugin:hello_plugin"]}
-    ...
-)
-
-

Activate the plugin#

-

As plugins are loaded via entry points, they can be activated with no more steps than just installing the plugin. -For convenience, PDM provides a plugin command group to manage plugins.

-

Assume your plugin is published as pdm-hello:

-
1
pdm self add pdm-hello
-
-

Now type pdm --help in the terminal, you will see the new added hello command and use it:

-
1
-2
$ pdm hello Jack
-Hello, Jack
-
-

See more plugin management subcommands by typing pdm self --help in the terminal.

-

Specify the plugins in project#

-

To specify the required plugins for a project, you can use the tool.pdm.plugins config in the pyproject.toml file. -These dependencies can be installed into a project plugin library by running pdm install --plugins. -The project plugin library will be loaded in subsequent PDM commands.

-

This is useful when you want to share the same plugin set with the contributors.

-
1
-2
-3
-4
-5
# pyproject.toml
-[tool.pdm]
-plugins = [
-    "pdm-packer"
-]
-
-

Run pdm install --plugins to install and activate the plugins.

-

Alternatively, you can have project-local plugins that are not published to PyPI, by using editable local dependencies:

-
1
-2
-3
-4
-5
# pyproject.toml
-[tool.pdm]
-plugins = [
-    "-e file:///${PROJECT_ROOT}/plugins/my_plugin"
-]
-
- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/index.html b/2.10/index.html deleted file mode 100644 index 252b14e2bc..0000000000 --- a/2.10/index.html +++ /dev/null @@ -1,1316 +0,0 @@ - - - - - - - - - - - - - - - - - - - - Introduction - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
- -
- - - -
-
- - - - - - - -
-PDM logo -
- -

Introduction#

-

PDM, as described, is a modern Python package and dependency manager supporting the latest PEP standards. But it is more than a package manager. It boosts your development workflow in various aspects. The most significant benefit is it installs and manages packages -in a similar way to npm that doesn't need to create a virtualenv at all!

- - -

Feature highlights#

-
    -
  • Simple and fast dependency resolver, mainly for large binary distributions.
  • -
  • A PEP 517 build backend.
  • -
  • PEP 621 project metadata.
  • -
  • Flexible and powerful plug-in system.
  • -
  • Versatile user scripts.
  • -
  • Opt-in centralized installation cache like pnpm.
  • -
-

Installation#

-

PDM requires Python 3.7+ to be installed. It works on multiple platforms including Windows, Linux and macOS.

-
-

Note

-

You can still have your project working on lower Python versions, read how to do it here.

-
- -

PDM requires python version 3.7 or higher.

-

Like Pip, PDM provides an installation script that will install PDM into an isolated environment.

-
-
-
-
1
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
-
-
-
-
1
(Invoke-WebRequest -Uri https://pdm-project.org/install-pdm.py -UseBasicParsing).Content | python -
-
-
-
-
-

For security reasons, you should verify the checksum of install-pdm.py. -It can be downloaded from install-pdm.py.sha256.

-

For example, on Linux/Mac:

-
1
-2
-3
-4
curl -sSLO https://pdm-project.org/install-pdm.py
-curl -sSL https://pdm-project.org/install-pdm.py.sha256 | shasum -a 256 -c -
-# Run the installer
-python3 install-pdm.py [options]
-
-

The installer will install PDM into the user site and the location depends on the system:

-
    -
  • $HOME/.local/bin for Unix
  • -
  • %APPDATA%\Python\Scripts on Windows
  • -
-

You can pass additional options to the script to control how PDM is installed:

-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
usage: install-pdm.py [-h] [-v VERSION] [--prerelease] [--remove] [-p PATH] [-d DEP]
-
-optional arguments:
-  -h, --help            show this help message and exit
-  -v VERSION, --version VERSION | envvar: PDM_VERSION
-                        Specify the version to be installed, or HEAD to install from the main branch
-  --prerelease | envvar: PDM_PRERELEASE    Allow prereleases to be installed
-  --remove | envvar: PDM_REMOVE            Remove the PDM installation
-  -p PATH, --path PATH | envvar: PDM_HOME  Specify the location to install PDM
-  -d DEP, --dep DEP | envvar: PDM_DEPS     Specify additional dependencies, can be given multiple times
-
-

You can either pass the options after the script or set the env var value.

-

Other installation methods#

-
-
-
-
1
brew install pdm
-
-
-
-
1
-2
scoop bucket add frostming https://github.com/frostming/scoop-frostming.git
-scoop install pdm
-
-
-
-
1
pipx install pdm
-
-

Install the head version of GitHub repository. -Make sure you have installed Git LFS on your system.

-
1
pipx install git+https://github.com/pdm-project/pdm.git@main#egg=pdm
-
-

To install PDM with all features:

-
1
pipx install pdm[all]
-
-

See also: https://pypa.github.io/pipx/

-
-
-
1
pip install --user pdm
-
-
-
-

Assuming you have asdf installed. -

1
-2
-3
asdf plugin add pdm
-asdf local pdm latest
-asdf install pdm
-

-
-
-

By copying the Pyprojectx wrapper scripts to a project, you can install PDM as -(npm-style) dev dependency inside that project. This allows different projects/branches to use different PDM versions.

-

To initialize a new or existing project, -cd into the project folder and:

-
-
-
-
1
-2
curl -LO https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip && unzip wrappers.zip && rm -f wrappers.zip
-./pw --init pdm
-
-
-
-
1
-2
Invoke-WebRequest https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip -OutFile wrappers.zip; Expand-Archive -Path wrappers.zip -DestinationPath .; Remove-Item -Path wrappers.zip
-.\pw --init pdm
-
-
-
-
-

When installing pdm with this method, you need to run all pdm commands through the pw wrapper:

-
-
-
-
1
./pw pdm install
-
-
-
-
-
-
-
-

Update the PDM version#

-
1
pdm self update
-
-

Packaging Status#

-

Packaging status

-

Shell Completion#

-

PDM supports generating completion scripts for Bash, Zsh, Fish or Powershell. Here are some common locations for each shell:

-
-
-
-
1
pdm completion bash > /etc/bash_completion.d/pdm.bash-completion
-
-
-
-
1
-2
# Make sure ~/.zfunc is added to fpath, before compinit.
-pdm completion zsh > ~/.zfunc/_pdm
-
-

Oh-My-Zsh:

-
1
-2
mkdir $ZSH_CUSTOM/plugins/pdm
-pdm completion zsh > $ZSH_CUSTOM/plugins/pdm/_pdm
-
-

Then make sure pdm plugin is enabled in ~/.zshrc

-
-
-
1
pdm completion fish > ~/.config/fish/completions/pdm.fish
-
-
-
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
# Create a directory to store completion scripts
-mkdir $PROFILE\..\Completions
-echo @'
-Get-ChildItem "$PROFILE\..\Completions\" | ForEach-Object {
-    . $_.FullName
-}
-'@ | Out-File -Append -Encoding utf8 $PROFILE
-# Generate script
-Set-ExecutionPolicy Unrestricted -Scope CurrentUser
-pdm completion powershell | Out-File -Encoding utf8 $PROFILE\..\Completions\pdm_completion.ps1
-
-
-
-
-

Virtualenv and PEP 582#

-

PDM offers experimental support for PEP 582 as an opt-in feature, in addition to virtualenv management. Although the Python Steering Council has rejected PEP 582, you can still test it out using PDM.

-

To learn more about the two modes, refer to the relevant chapters on Working with virtualenv and Working with PEP 582.

-

PDM Eco-system#

-

Awesome PDM is a curated list of awesome PDM plugins and resources.

-

Sponsors#

-

- - - -

- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/objects.inv b/2.10/objects.inv deleted file mode 100644 index a09d2cf2ec..0000000000 Binary files a/2.10/objects.inv and /dev/null differ diff --git a/2.10/plugin/fixtures/index.html b/2.10/plugin/fixtures/index.html deleted file mode 100644 index b9d9642488..0000000000 --- a/2.10/plugin/fixtures/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Redirecting... - - - - - - -Redirecting... - - diff --git a/2.10/plugin/reference/index.html b/2.10/plugin/reference/index.html deleted file mode 100644 index fd45b01bc2..0000000000 --- a/2.10/plugin/reference/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Redirecting... - - - - - - -Redirecting... - - diff --git a/2.10/plugin/write/index.html b/2.10/plugin/write/index.html deleted file mode 100644 index b493f21371..0000000000 --- a/2.10/plugin/write/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Redirecting... - - - - - - -Redirecting... - - diff --git a/2.10/pyproject/build/index.html b/2.10/pyproject/build/index.html deleted file mode 100644 index 47fcb1b07d..0000000000 --- a/2.10/pyproject/build/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Redirecting... - - - - - - -Redirecting... - - diff --git a/2.10/pyproject/pep621/index.html b/2.10/pyproject/pep621/index.html deleted file mode 100644 index 4ad7b13f9d..0000000000 --- a/2.10/pyproject/pep621/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Redirecting... - - - - - - -Redirecting... - - diff --git a/2.10/reference/api/index.html b/2.10/reference/api/index.html deleted file mode 100644 index 9c8bc24c81..0000000000 --- a/2.10/reference/api/index.html +++ /dev/null @@ -1,3026 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - API Reference - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
- -
- - - -
-
- - - - - - - -

API Reference#

- - -
- - - -

- pdm.core.Core - - -#

- - -
- - -

A high level object that manages all classes and configurations

- - - - - -
- - - - - - - - - -
- - - -

-add_config(name, config_item) - - - staticmethod - - -#

- - -
- -

Add a config item to the configuration class.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
name - str -

The name of the config item

- required -
config_item - pdm.project.config.ConfigItem -

The config item to add

- required -
- -
- -
- -
- - - -

-create_project(root_path=None, is_global=False, global_config=None) - -#

- - -
- -

Create a new project object

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
root_path - PathLike -

The path to the project root directory

- None -
is_global - bool -

Whether the project is a global project

- False -
global_config - str -

The path to the global config file

- None -
- -

Returns:

- - - - - - - - - - - - - -
TypeDescription
- Project -

The project object

- -
- -
- -
- - - -

-handle(project, options) - -#

- - -
- -

Called before command invocation

- -
- -
- -
- - - -

-load_plugins() - -#

- - -
- -

Import and load plugins under pdm.plugin namespace -A plugin is a callable that accepts the core object as the only argument.

- -
- Example -
1
-2
def my_plugin(core: pdm.core.Core) -> None:
-    ...
-
-
-
- -
- -
- - - -

-main(args=None, prog_name=None, obj=None, **extra) - -#

- - -
- -

The main entry function

- -
- -
- -
- - - -

-register_command(command, name=None) - -#

- - -
- -

Register a subcommand to the subparsers, -with an optional name of the subcommand.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
command - Type[pdm.cli.commands.base.BaseCommand] -

The command class to register

- required -
name - str -

The name of the subcommand, if not given, command.name -is used

- None -
- -
- -
- - - -
- -
- -
- -
- - - -

- pdm.core.Project - - -#

- - -
- - -

Core project class.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
core - Core -

The core instance.

- required -
root_path - str | Path | None -

The root path of the project.

- required -
is_global - bool -

Whether the project is global.

- False -
global_config - str | Path | None -

The path to the global config file.

- None -
- - - - - -
- - - - - - - -
- - - -

-default_source: RepositoryConfig - - - property - - -#

- - -
- -

Get the default source from the pypi setting

-
- -
- - - -
- - - -

-config() - -#

- - -
- -

A read-only dict configuration

- -
- -
- -
- - - -

-find_interpreters(python_spec=None) - -#

- - -
- -

Return an iterable of interpreter paths that matches the given specifier,

- -
- which can be -
    -
  1. a version specifier like 3.7
  2. -
  3. an absolute path
  4. -
  5. a short name like python3
  6. -
  7. None that returns all possible interpreters
  8. -
-
-
- -
- -
- - - -

-get_provider(strategy='all', tracked_names=None, for_install=False, ignore_compatibility=True, direct_minimal_versions=False) - -#

- - -
- -

Build a provider class for resolver.

-

:param strategy: the resolve strategy -:param tracked_names: the names of packages that needs to update -:param for_install: if the provider is for install -:param ignore_compatibility: if the provider should ignore the compatibility when evaluating candidates -:param direct_minimal_versions: if the provider should prefer minimal versions instead of latest -:returns: The provider object

- -
- -
- -
- - - -

-get_reporter(requirements, tracked_names=None, spinner=None) - -#

- - -
- -

Return the reporter object to construct a resolver.

-

:param requirements: requirements to resolve -:param tracked_names: the names of packages that needs to update -:param spinner: optional spinner object -:returns: a reporter

- -
- -
- -
- - - -

-get_repository(cls=None, ignore_compatibility=True) - -#

- - -
- -

Get the repository object

- -
- -
- -
- - - -

-project_config() - -#

- - -
- -

Read-and-writable configuration dict for project settings

- -
- -
- -
- - - -

-resolve_interpreter() - -#

- - -
- -

Get the Python interpreter path.

- -
- -
- -
- - - -

-use_pyproject_dependencies(group, dev=False) - -#

- - -
- -

Get the dependencies array and setter in the pyproject.toml -Return a tuple of two elements, the first is the dependencies array, -and the second value is a callable to set the dependencies array back.

- -
- -
- -
- - - -

-write_lockfile(toml_data, show_message=True, write=True, **_kwds) - -#

- - -
- -

Write the lock file to disk.

- -
- -
- - - -
- -
- -

Signals#

-

New in version 1.12.0

- - -
- - - -
- -

The signal definition for PDM.

- -
- Example -
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
from pdm.signals import post_init, post_install
-
-def on_post_init(project):
-    project.core.ui.echo("Project initialized")
-# Connect to the signal
-post_init.connect(on_post_init)
-# Or use as a decorator
-@post_install.connect
-def on_post_install(project, candidates, dry_run):
-    project.core.ui.echo("Project install succeeded")
-
-
- - -
- - - - - - - -
- - - -

-post_build: NamedSignal = pdm_signals.signal('post_build') - - - module-attribute - - -#

- - -
- -

Called after a project is built.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
artifacts - Sequence[str] -

The locations of built artifacts

- required -
config_settings - dict[str, str] | None -

Additional config settings passed via args

- required -
-
- -
- -
- - - -

-post_init: NamedSignal = pdm_signals.signal('post_init') - - - module-attribute - - -#

- - -
- -

Called after a project is initialized.

- -

Parameters:

- - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
-
- -
- -
- - - -

-post_install: NamedSignal = pdm_signals.signal('post_install') - - - module-attribute - - -#

- - -
- -

Called after a project is installed.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
candidates - dict[str, Candidate] -

The candidates installed

- required -
dry_run - bool -

If true, won't perform any actions

- required -
-
- -
- -
- - - -

-post_lock: NamedSignal = pdm_signals.signal('post_lock') - - - module-attribute - - -#

- - -
- -

Called after a project is locked.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
resolution - dict[str, Candidate] -

The resolved candidates

- required -
dry_run - bool -

If true, won't perform any actions

- required -
-
- -
- -
- - - -

-post_publish: NamedSignal = pdm_signals.signal('post_publish') - - - module-attribute - - -#

- - -
- -

Called after a project is published.

- -

Parameters:

- - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
-
- -
- -
- - - -

-post_run: NamedSignal = pdm_signals.signal('post_run') - - - module-attribute - - -#

- - -
- -

Called after any run.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
script - str -

the script name

- required -
args - Sequence[str] -

the command line provided arguments

- required -
-
- -
- -
- - - -

-post_script: NamedSignal = pdm_signals.signal('post_script') - - - module-attribute - - -#

- - -
- -

Called after any script.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
script - str -

the script name

- required -
args - Sequence[str] -

the command line provided arguments

- required -
-
- -
- -
- - - -

-post_use: NamedSignal = pdm_signals.signal('post_use') - - - module-attribute - - -#

- - -
- -

Called after use switched to a new Python version.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
python - PythonInfo -

Information about the new Python interpreter

- required -
-
- -
- -
- - - -

-pre_build: NamedSignal = pdm_signals.signal('pre_build') - - - module-attribute - - -#

- - -
- -

Called before a project is built.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
dest - str -

The destination location

- required -
config_settings - dict[str, str] | None -

Additional config settings passed via args

- required -
-
- -
- -
- - - -

-pre_install: NamedSignal = pdm_signals.signal('pre_install') - - - module-attribute - - -#

- - -
- -

Called before a project is installed.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
candidates - dict[str, Candidate] -

The candidates to install

- required -
dry_run - bool -

If true, won't perform any actions

- required -
-
- -
- -
- - - -

-pre_invoke: NamedSignal = pdm_signals.signal('pre_invoke') - - - module-attribute - - -#

- - -
- -

Called before any command is invoked.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
command - str | None -

the command name

- required -
options - Namespace -

the parsed arguments

- required -
-
- -
- -
- - - -

-pre_lock: NamedSignal = pdm_signals.signal('pre_lock') - - - module-attribute - - -#

- - -
- -

Called before a project is locked.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
requirements - list[Requirement] -

The requirements to lock

- required -
dry_run - bool -

If true, won't perform any actions

- required -
-
- -
- -
- - - -

-pre_publish: NamedSignal = pdm_signals.signal('pre_publish') - - - module-attribute - - -#

- - -
- -

Called before a project is published.

- -

Parameters:

- - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
-
- -
- -
- - - -

-pre_run: NamedSignal = pdm_signals.signal('pre_run') - - - module-attribute - - -#

- - -
- -

Called before any run.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
script - str -

the script name

- required -
args - Sequence[str] -

the command line provided arguments

- required -
-
- -
- -
- - - -

-pre_script: NamedSignal = pdm_signals.signal('pre_script') - - - module-attribute - - -#

- - -
- -

Called before any script.

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescriptionDefault
project - Project -

The project object

- required -
script - str -

the script name

- required -
args - Sequence[str] -

the command line provided arguments

- required -
-
- -
- - - - - -
- -
- -
- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/reference/build/index.html b/2.10/reference/build/index.html deleted file mode 100644 index 539123f268..0000000000 --- a/2.10/reference/build/index.html +++ /dev/null @@ -1,975 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Build Configuration - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

Build Configuration#

-

pdm uses the PEP 517 to build the package. It acts as a build frontend that calls the build backend to build the package.

-

A build backend is what drives the build system to build source distributions and wheels from arbitrary source trees.

-

If you run pdm init, PDM will let you choose the build backend to use. Unlike other package managers, PDM does not force you to use a specific build backend. You can choose the one you like. Here is a list of build backends and corresponding configurations initially supported by PDM:

-
-
-
-

pyproject.toml configuration:

-
1
-2
-3
[build-system]
-requires = ["pdm-backend"]
-build-backend = "pdm.backend"
-
-

📖 Read the docs

-
-
-

pyproject.toml configuration:

-
1
-2
-3
[build-system]
-requires = ["setuptools", "wheel"]
-build-backend = "setuptools.build_meta"
-
-

📖 Read the docs

-
-
-

pyproject.toml configuration:

-
1
-2
-3
[build-system]
-requires = ["flit_core >=3.2,<4"]
-build-backend = "flit_core.buildapi"
-
-

📖 Read the docs

-
-
-

pyproject.toml configuration:

-
1
-2
-3
[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
-
-

📖 Read the docs

-
-
-
-

Apart from the above mentioned backends, you can also use any other backend that supports PEP 621, however, poetry-core is not supported because it does not support reading PEP 621 metadata.

-
-

Info

-

If you are using a custom build backend that is not in the above list, PDM will handle the relative paths as PDM-style(${PROJECT_ROOT} variable).

-
- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/reference/cli/index.html b/2.10/reference/cli/index.html deleted file mode 100644 index 5a0d8d1555..0000000000 --- a/2.10/reference/cli/index.html +++ /dev/null @@ -1,2394 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - CLI Reference - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

CLI Reference# -

-

pdm#

-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -V, --version: Show the version and exit
  • -
  • -c, --config: Specify another config file path [env var: PDM_CONFIG_FILE]
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -I, --ignore-python: Ignore the Python path saved in.pdm-python. [env var: PDM_IGNORE_SAVED_PYTHON]
  • -
  • --pep582 SHELL: Print the command line to be eval'd by the shell
  • -
-

Commands:

-

add#

-
-

Add package(s) to pyproject.toml and install them

-
-

Package Arguments:

-
    -
  • -e, --editable: Specify editable packages
  • -
  • packages: Specify packages
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
  • -
  • --no-lock: Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]
  • -
  • --save-compatible: Save compatible version specifiers
  • -
  • --save-wildcard: Save wildcard version specifiers
  • -
  • --save-exact: Save exact version specifiers
  • -
  • --save-minimum: Save minimum version specifiers
  • -
  • --update-reuse: Reuse pinned versions already present in lock file if possible
  • -
  • --update-eager: Try to update the packages and their dependencies recursively
  • -
  • --update-all: Update all dependencies and sub-dependencies
  • -
  • --pre, --prerelease: Allow prereleases to be pinned
  • -
  • -u, --unconstrained: Ignore the version constraint of packages
  • -
  • --dry-run: Show the difference only and don't perform any action
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • -d, --dev: Add packages into dev dependencies
  • -
  • -G, --group: Specify the target dependency group to add into
  • -
  • --no-sync: Only writepyproject.toml and do not sync the working set (default: True)
  • -
-

Install Options:

-
    -
  • --no-editable: Install non-editable versions for all packages
  • -
  • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
  • -
  • --fail-fast, -x: Abort on first installation error
  • -
  • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
  • -
-

build#

-
-

Build artifacts for distribution

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • --no-sdist: Don't build source tarballs (default: True)
  • -
  • --no-wheel: Don't build wheels (default: True)
  • -
  • -d, --dest: Target directory to put artifacts (default: dist)
  • -
  • --no-clean: Do not clean the target directory (default: True)
  • -
  • --config-setting, -C: Pass options to the backend. options with a value must be specified after "=": --config-setting=--opt(=value) or -C--opt(=value)
  • -
-

cache#

-
-

Control the caches of PDM

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

Commands:

-

clear#

-
-

Clean all the files under cache directory

-
-

Positional Arguments:

-
    -
  • type: Clear the given type of caches
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

remove#

-
-

Remove files matching the given pattern

-
-

Positional Arguments:

-
    -
  • pattern: The pattern to remove
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

list#

-
-

List the built wheels stored in the cache

-
-

Positional Arguments:

-
    -
  • pattern: The pattern to list (default: *)
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

info#

-
-

Show the info and current size of caches

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

completion#

-
-

Generate completion scripts for the given shell

-
-

Positional Arguments:

-
    -
  • shell: The shell to generate the scripts for. If not given, PDM will properly guess from SHELL env var.
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
-

config#

-
-

Display the current configuration

-
-

Positional Arguments:

-
    -
  • key: Config key
  • -
  • value: Config value
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -l, --local: Set config in the project's local configuration file
  • -
  • -d, --delete: Unset a configuration key
  • -
  • -e, --edit: Edit the configuration file in the default editor(defined by EDITOR env var)
  • -
-

export#

-
-

Export the locked packages set to other formats

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
  • -
  • -f, --format: Specify the export file format (default: requirements)
  • -
  • --without-hashes: Don't include artifact hashes (default: True)
  • -
  • -o, --output: Write output to the given file, or print to stdout if not given
  • -
  • --pyproject: Read the list of packages frompyproject.toml
  • -
  • --expandvars: Expand environment variables in requirements
  • -
-

Dependencies Selection:

-
    -
  • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
  • -
  • --no-default: Don't include dependencies from the default group (default: True)
  • -
  • -d, --dev: Select dev dependencies
  • -
  • --prod, --production: Unselect dev dependencies (default: True)
  • -
-

fix#

-
-

Fix the project problems according to the latest version of PDM

-
-

Positional Arguments:

-
    -
  • problem: Fix the specific problem, or all if not given
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --dry-run: Only show the problems
  • -
-

import#

-
-

Import project metadata from other formats

-
-

Positional Arguments:

-
    -
  • filename: The file name
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -d, --dev: import packages into dev dependencies
  • -
  • -G, --group: Specify the target dependency group to import into
  • -
  • -f, --format: Specify the file format explicitly
  • -
-

info#

-
-

Show the project information

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • --python: Show the interpreter path
  • -
  • --where: Show the project root path
  • -
  • --packages: Show the local packages root
  • -
  • --env: Show PEP 508 environment markers
  • -
  • --json: Dump the information in JSON
  • -
-

init#

-
-

Initialize a pyproject.toml for PDM

-
-

Positional Arguments:

-
    -
  • template: Specify the project template, which can be a local path or a Git URL
  • -
  • generator_args: Arguments passed to the generator
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • --copier: Use Copier to generate project [not installed] (default: builtin)
  • -
  • --cookiecutter: Use Cookiecutter to generate project [not installed] (default: builtin)
  • -
  • -r, --overwrite: Overwrite existing files
  • -
-

Builtin Generator Options:

-
    -
  • -n, --non-interactive: Don't ask questions but use default values
  • -
  • --python: Specify the Python version/path to use
  • -
  • --backend: Specify the build backend
  • -
  • --lib: Create a library project
  • -
-

install#

-
-

Install dependencies from lock file

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --dry-run: Show the difference only and don't perform any action
  • -
  • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
  • -
  • --no-lock: Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • --check: Check if the lock file is up to date and fail otherwise
  • -
  • --plugins: Install the plugins specified inpyproject.toml
  • -
-

Install Options:

-
    -
  • --no-editable: Install non-editable versions for all packages
  • -
  • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
  • -
  • --fail-fast, -x: Abort on first installation error
  • -
  • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
  • -
-

Dependencies Selection:

-
    -
  • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
  • -
  • --no-default: Don't include dependencies from the default group (default: True)
  • -
  • -d, --dev: Select dev dependencies
  • -
  • --prod, --production: Unselect dev dependencies (default: True)
  • -
-

list#

-
-

List packages installed in the current working set

-
-

Positional Arguments:

-
    -
  • patterns: Filter packages by patterns. e.g. pdm list requests- flask-. In --tree mode, only show the subtree of the matched packages.
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • --freeze: Show the installed dependencies in pip's requirements.txt format
  • -
  • --tree, --graph: Display a tree of dependencies
  • -
  • -r, --reverse: Reverse the dependency tree
  • -
  • --resolve: Resolve all requirements to output licenses (instead of just showing those currently installed)
  • -
  • --fields: Select information to output as a comma separated string. All fields: groups,homepage,licenses,location,name,version. (default: name,version,location)
  • -
  • --sort: Sort the output using a given field name. If nothing is set, no sort is applied. Multiple fields can be combined with ','.
  • -
  • --csv: Output dependencies in CSV document format
  • -
  • --json: Output dependencies in JSON document format
  • -
  • --markdown: Output dependencies and legal notices in markdown document format - best effort basis
  • -
  • --include: Dependency groups to include in the output. By default all are included
  • -
  • --exclude: Exclude dependency groups from the output
  • -
-

lock#

-
-

Resolve and lock dependencies

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
  • -
  • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • --refresh: Don't update pinned versions, only refresh the lock file
  • -
  • --check: Check if the lock file is up to date and quit
  • -
-

Lock Strategy:

-
    -
  • --strategy, -S STRATEGY: Specify lock strategy (cross_platform, static_urls, direct_minimal_versions). Add 'no_' prefix to disable. Can be supplied multiple times or split by comma.
  • -
  • --no-cross-platform: [DEPRECATED] Only lock packages for the current platform
  • -
  • --static-urls: [DEPRECATED] Store static file URLs in the lockfile
  • -
  • --no-static-urls: [DEPRECATED] Do not store static file URLs in the lockfile
  • -
-

Dependencies Selection:

-
    -
  • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
  • -
  • --no-default: Don't include dependencies from the default group (default: True)
  • -
  • -d, --dev: Select dev dependencies
  • -
  • --prod, --production: Unselect dev dependencies (default: True)
  • -
-

publish#

-
-

Build and publish the project to PyPI

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • -r, --repository: The repository name or url to publish the package to [env var: PDM_PUBLISH_REPO]
  • -
  • -u, --username: The username to access the repository [env var: PDM_PUBLISH_USERNAME]
  • -
  • -P, --password: The password to access the repository [env var: PDM_PUBLISH_PASSWORD]
  • -
  • -S, --sign: Upload the package with PGP signature
  • -
  • -i, --identity: GPG identity used to sign files.
  • -
  • -c, --comment: The comment to include with the distribution file.
  • -
  • --no-build: Don't build the package before publishing (default: True)
  • -
  • --no-very-ssl: Disable SSL verification
  • -
  • --ca-certs: The path to a PEM-encoded Certificate Authority bundle to use for publish server validation [env var: PDM_PUBLISH_CA_CERTS]
  • -
-

remove#

-
-

Remove packages from pyproject.toml

-
-

Positional Arguments:

-
    -
  • packages: Specify the packages to remove
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --dry-run: Show the difference only and don't perform any action
  • -
  • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
  • -
  • --no-lock: Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • -d, --dev: Remove packages from dev dependencies
  • -
  • -G, --group: Specify the target dependency group to remove from
  • -
  • --no-sync: Only writepyproject.toml and do not uninstall packages (default: True)
  • -
-

Install Options:

-
    -
  • --no-editable: Install non-editable versions for all packages
  • -
  • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
  • -
  • --fail-fast, -x: Abort on first installation error
  • -
  • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
  • -
-

run#

-
-

Run commands or scripts with local packages loaded

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • -l, --list: Show all available scripts defined inpyproject.toml
  • -
  • -j, --json: Output all scripts infos in JSON
  • -
-

Execution Parameters:

-
    -
  • -s, --site-packages: Load site-packages from the selected interpreter
  • -
  • script: The command to run
  • -
  • args: Arguments that will be passed to the command
  • -
- -
-

Search for PyPI packages

-
-

Positional Arguments:

-
    -
  • query: Query string to search
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

self#

-
-

Manage the PDM program itself (previously known as plugin)

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

Commands:

-

list#

-
-

List all packages installed with PDM

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • --plugins: List plugins only
  • -
-

add#

-
-

Install packages to the PDM's environment

-
-

Positional Arguments:

-
    -
  • packages: Specify one or many package names, each package can have a version specifier
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • --pip-args: Arguments that will be passed to pip install
  • -
-

remove#

-
-

Remove packages from PDM's environment

-
-

Positional Arguments:

-
    -
  • packages: Specify one or many package names
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • --pip-args: Arguments that will be passed to pip uninstall
  • -
  • -y, --yes: Answer yes on the question
  • -
-

update#

-
-

Update PDM itself

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • --head: Update to the latest commit on the main branch
  • -
  • --pre: Update to the latest prerelease version
  • -
  • --pip-args: Additional arguments that will be passed to pip install
  • -
-

plugin#

-
-

Manage the PDM program itself (previously known as plugin)

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

Commands:

-

list#

-
-

List all packages installed with PDM

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • --plugins: List plugins only
  • -
-

add#

-
-

Install packages to the PDM's environment

-
-

Positional Arguments:

-
    -
  • packages: Specify one or many package names, each package can have a version specifier
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • --pip-args: Arguments that will be passed to pip install
  • -
-

remove#

-
-

Remove packages from PDM's environment

-
-

Positional Arguments:

-
    -
  • packages: Specify one or many package names
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • --pip-args: Arguments that will be passed to pip uninstall
  • -
  • -y, --yes: Answer yes on the question
  • -
-

update#

-
-

Update PDM itself

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • --head: Update to the latest commit on the main branch
  • -
  • --pre: Update to the latest prerelease version
  • -
  • --pip-args: Additional arguments that will be passed to pip install
  • -
-

show#

-
-

Show the package information

-
-

Positional Arguments:

-
    -
  • package: Specify the package name, or show this package if not given
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • --name: Show name
  • -
  • --version: Show version
  • -
  • --summary: Show summary
  • -
  • --license: Show license
  • -
  • --platform: Show platform
  • -
  • --keywords: Show keywords
  • -
-

sync#

-
-

Synchronize the current working set with lock file

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --dry-run: Show the difference only and don't perform any action
  • -
  • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • --clean: Clean packages not in the lockfile
  • -
  • --only-keep: Only keep the selected packages
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • -r, --reinstall: Force reinstall existing dependencies
  • -
-

Install Options:

-
    -
  • --no-editable: Install non-editable versions for all packages
  • -
  • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
  • -
  • --fail-fast, -x: Abort on first installation error
  • -
  • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
  • -
-

Dependencies Selection:

-
    -
  • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
  • -
  • --no-default: Don't include dependencies from the default group (default: True)
  • -
  • -d, --dev: Select dev dependencies
  • -
  • --prod, --production: Unselect dev dependencies (default: True)
  • -
-

update#

-
-

Update package(s) in pyproject.toml

-
-

Positional Arguments:

-
    -
  • packages: If packages are given, only update them
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
  • -
  • --no-lock: Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]
  • -
  • --save-compatible: Save compatible version specifiers
  • -
  • --save-wildcard: Save wildcard version specifiers
  • -
  • --save-exact: Save exact version specifiers
  • -
  • --save-minimum: Save minimum version specifiers
  • -
  • --update-reuse: Reuse pinned versions already present in lock file if possible
  • -
  • --update-eager: Try to update the packages and their dependencies recursively
  • -
  • --update-all: Update all dependencies and sub-dependencies
  • -
  • --pre, --prerelease: Allow prereleases to be pinned
  • -
  • -u, --unconstrained: Ignore the version constraint of packages
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
  • -
  • -t, --top: Only update those listed inpyproject.toml
  • -
  • --dry-run, --outdated: Show the difference only without modifying the lockfile content
  • -
  • --no-sync: Only update lock file but do not sync packages (default: True)
  • -
-

Install Options:

-
    -
  • --no-editable: Install non-editable versions for all packages
  • -
  • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
  • -
  • --fail-fast, -x: Abort on first installation error
  • -
  • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
  • -
-

Dependencies Selection:

-
    -
  • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
  • -
  • --no-default: Don't include dependencies from the default group (default: True)
  • -
  • -d, --dev: Select dev dependencies
  • -
  • --prod, --production: Unselect dev dependencies
  • -
-

use#

-
-

Use the given python version or path as base interpreter

-
-

Positional Arguments:

-
    -
  • python: Specify the Python version or path
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -g, --global: Use the global project, supply the project root with -p option
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
  • -
  • -f, --first: Select the first matched interpreter
  • -
  • -i, --ignore-remembered: Ignore the remembered selection
  • -
  • --venv: Use the interpreter in the virtual environment with the given name
  • -
-

venv#

-
-

Virtualenv management

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
  • -
  • --path: Show the path to the given virtualenv
  • -
  • --python: Show the python interpreter path for the given virtualenv
  • -
-

Commands:

-

create#

-
-

Create a virtualenv

-
-

Positional Arguments:

-
    -
  • python: Specify which python should be used to create the virtualenv
  • -
  • venv_args: Additional arguments that will be passed to the backend
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -w, --with: Specify the backend to create the virtualenv
  • -
  • -f, --force: Recreate if the virtualenv already exists
  • -
  • -n, --name: Specify the name of the virtualenv
  • -
  • --with-pip: Install pip with the virtualenv
  • -
-

list#

-
-

List all virtualenvs associated with this project

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

remove#

-
-

Remove the virtualenv with the given name

-
-

Positional Arguments:

-
    -
  • env: The key of the virtualenv
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -y, --yes: Answer yes on the following question
  • -
-

activate#

-
-

Print the command to activate the virtualenv with the given name

-
-

Positional Arguments:

-
    -
  • env: The key of the virtualenv
  • -
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
-

purge#

-
-

Purge selected/all created Virtualenvs

-
-

Options:

-
    -
  • -h, --help: Show this help message and exit.
  • -
  • -v, --verbose: Use -v for detailed output and -vv for more detailed
  • -
  • -q, --quiet: Suppress output
  • -
  • -f, --force: Force purging without prompting for confirmation
  • -
  • -i, --interactive: Interactively purge selected Virtualenvs
  • -
-

- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/reference/configuration/index.html b/2.10/reference/configuration/index.html deleted file mode 100644 index f74ef1f819..0000000000 --- a/2.10/reference/configuration/index.html +++ /dev/null @@ -1,1321 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Configurations - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

Configurations#

-

Color Theme#

-

The default theme used by PDM is as follows:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyDefault Style
primarycyan
successgreen
warningyellow
errorred
infoblue
reqbold green
-

You can change the theme colors with pdm config command. For example, to change the primary color to magenta:

-
1
pdm config theme.primary magenta
-
-

Or use a hex color code:

-
1
pdm config theme.success '#51c7bd'
-
-

Available Configurations#

-

The following configuration items can be retrieved and modified by pdm config command.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Config ItemDescriptionDefault ValueAvailable in ProjectEnv var
build_isolationIsolate the build environment from the project environmentYesYesPDM_BUILD_ISOLATION
cache_dirThe root directory of cached filesThe default cache location on OSNo
check_updateCheck if there is any newer version availableTrueNoPDM_CHECK_UPDATE
global_project.fallbackUse the global project implicitly if no local project is foundFalseNo
global_project.fallback_verboseIf True show message when global project is used implicitlyTrueNo
global_project.pathThe path to the global project<default config location on OS>/global-projectNo
global_project.user_siteWhether to install to user siteFalseNo
install.cacheEnable caching of wheel installationsFalseYes
install.cache_methodSpecify how to create links to the caches(symlink or pth)symlinkYes
install.parallelWhether to perform installation and uninstallation in parallelTrueYesPDM_PARALLEL_INSTALL
python.use_pyenvUse the pyenv interpreterTrueYes
python.use_venvUse virtual environments when availableTrueYesPDM_USE_VENV
python.providersList of python provider names for findpythonAll providers supported by findpythonYes
pypi.urlThe URL of PyPI mirrorhttps://pypi.org/simpleYesPDM_PYPI_URL
pypi.usernameThe username to access PyPIYesPDM_PYPI_USERNAME
pypi.passwordThe password to access PyPIYesPDM_PYPI_PASSWORD
pypi.ignore_stored_indexIgnore the configured indexesFalseYesPDM_IGNORE_STORED_INDEX
pypi.ca_certsPath to a PEM-encoded CA cert bundle (used for server cert verification)The CA certificates from certifiYes
pypi.client_certPath to a PEM-encoded client cert and optional keyNo
pypi.client_keyPath to a PEM-encoded client cert private key, if not in pypi.client_certNo
pypi.verify_sslVerify SSL certificate when query PyPITrueYes
pypi.json_apiConsult PyPI's JSON API for package metadataFalseYesPDM_PYPI_JSON_API
pypi.<name>.urlThe URL of custom package sourcehttps://pypi.org/simpleYes
pypi.<name>.usernameThe username to access custom sourceYes
pypi.<name>.passwordThe password to access custom sourceYes
pypi.<name>.typeindex or find_linksindexYes
pypi.<name>.verify_sslVerify SSL certificate when query custom sourceTrueYes
strategy.saveSpecify how to save versions when a package is addedminimum(can be: exact, wildcard, minimum, compatible)Yes
strategy.updateThe default strategy for updating packagesreuse(can be : eager)Yes
strategy.resolve_max_roundsSpecify the max rounds of resolution process10000YesPDM_RESOLVE_MAX_ROUNDS
venv.locationParent directory for virtualenvs<default data location on OS>/venvsNo
venv.backendDefault backend to create virtualenvvirtualenvYesPDM_VENV_BACKEND
venv.promptFormatted string to be displayed in the prompt when virtualenv is active{project_name}-{python_version}YesPDM_VENV_PROMPT
venv.in_projectCreate virtualenv in .venv under project rootTrueYesPDM_VENV_IN_PROJECT
venv.with_pipInstall pip when creating a new venvFalseYesPDM_VENV_WITH_PIP
repository.<name>.urlThe URL of custom package sourcehttps://pypi.org/simpleYes
repository.<name>.usernameThe username to access custom repositoryYes
repository.<name>.passwordThe password to access custom repositoryYes
repository.<name>.ca_certsPath to a PEM-encoded CA cert bundle (used for server cert verification)The CA certificates from certifiYes
repository.<name>.verify_sslVerify SSL certificate when uploading to repositoryTrueYes
-

If the corresponding env var is set, the value will take precedence over what is saved in the config file.

- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/reference/pep621/index.html b/2.10/reference/pep621/index.html deleted file mode 100644 index aa0c4e02d0..0000000000 --- a/2.10/reference/pep621/index.html +++ /dev/null @@ -1,1334 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - PEP 621 Metadata - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - -
- - - - - - - -
- -
- - - - -
-
- - - -
-
-
- - - - - - -
-
-
- - - -
-
- -
-
- - - -
-
- - - - - - - -

PEP 621 Metadata#

-

The project metadata are stored in the pyproject.toml. The specifications are defined by PEP 621, PEP 631 and PEP 639. Read the detailed specifications in the PEPs.

-

In the following part of this document, metadata should be written under [project] table if not given explicitly.

-

Multiline description#

-

You can split a long description onto multiple lines, thanks to TOML support for multiline strings. -Just remember to escape new lines, so the final description appears -on one line only in your package metadata. -Indentation will be removed as well when escaping new lines:

-
1
-2
-3
-4
-5
-6
description = """\
-    Lorem ipsum dolor sit amet, consectetur adipiscing elit, \
-    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \
-    Ut enim ad minim veniam, quis nostrud exercitation ullamco \
-    laboris nisi ut aliquip ex ea commodo consequat.\
-"""
-
-

See TOML's specification on strings.

-

Package version#

-
-
-
-
1
-2
[project]
-version = "1.0.0"
-
-
-
-
1
-2
-3
-4
-5
-6
[project]
-...
-dynamic = ["version"]
-
-[tool.pdm]
-version = { source = "file", path = "mypackage/__version__.py" }
-
-

The version will be read from the mypackage/__version__.py file searching for the pattern: __version__ = "{version}".

-

Read more information about other configurations in dynamic project version from the pdm-backend documentation.

-
-
-
-

Python version#

-

The required version of Python is specified as the string requires-python:

-
1
-2
-3
-4
-5
-6
-7
-8
requires-python = ">=3.9"
-classifiers = [
-    "Programming Language :: Python :: 3",
-    "Programming Language :: Python :: 3.9",
-    "Programming Language :: Python :: 3.10",
-    "Programming Language :: Python :: 3.11",
-    ...
-]
-
-

Note: As per PEP 621, -PDM is not permitted to dynamically update the classifiers section like some other non-compliant tools. -Thus, you should also include the appropriate trove classifiers -as shown above if you plan on publishing your package on PyPI.

-

License#

- - -

The license is specified as the string license:

-
1
-2
-3
-4
-5
license = {text = "BSD-2-Clause"}
-classifiers = [
-    "License :: OSI Approved :: BSD License",
-    ...
-]
-
-

Note: As per PEP 621, -PDM is not permitted to dynamically update the classifiers section like some other non-compliant tools. -Thus, you should also include the appropriate trove classifiers -as shown above if you plan on publishing your package on PyPI.

-

Dependency specification#

-

The project.dependencies is an array of dependency specification strings following the PEP 440 -and PEP 508.

-

Examples:

-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
[project]
-...
-dependencies = [
-    # Named requirement
-    "requests",
-    # Named requirement with version specifier
-    "flask >= 1.1.0",
-    # Requirement with environment marker
-    "pywin32; sys_platform == 'win32'",
-    # URL requirement
-    "pip @ git+https://github.com/pypa/pip.git@20.3.1"
-]
-
-

Optional dependencies#

-

You can have some requirements optional, which is similar to setuptools' extras_require parameter.

-
1
-2
-3
-4
-5
-6
-7
[project.optional-dependencies]
-socks = [ 'PySocks >= 1.5.6, != 1.5.7, < 2' ]
-tests = [
-  'ddt >= 1.2.2, < 2',
-  'pytest < 6',
-  'mock >= 1.0.1, < 4; python_version < "3.4"',
-]
-
-

To install a group of optional dependencies:

-
1
pdm install -G socks
-
-

-G option can be given multiple times to include more than one group.

-

Context variables expansion#

-

Depending on which build backend you are using, PDM will expand some variables in the dependency strings.

-

Environment variables#

-
-
-
-
1
-2
[project]
-dependencies = ["flask @ https://${USERNAME}:${PASSWORD}/artifacts.io/Flask-1.1.2.tar.gz"]
-
-
-
-
1
-2
[project]
-dependencies = ["flask @ https://{env:USERNAME}:{env:PASSWORD}/artifacts.io/Flask-1.1.2.tar.gz"]
-
-

Find more usages here

-
-
-
-

Don't worry about credential leakage, the environment variables will be expanded when needed and kept untouched in the lock file.

-

Relative paths#

-

When you add a package from a relative path, PDM will automatically save it as a relative path for pdm-backend and hatchling.

-

For example, if you run pdm add ./my-package, it will result in the following line in pyproject.toml.

-
-
-
-
1
-2
[project]
-dependencies = ["my-package @ file:///${PROJECT_ROOT}/my-package"]
-
-
-
-
1
-2
[project]
-dependencies = ["my-package @ {root:uri}/my-package"]
-
-

By default, hatchling doesn't support direct references -in the dependency string, you need to turn it on in pyproject.toml:

-
1
-2
[tool.hatch.metadata]
-allow-direct-references = true
-
-
-
-
-

The relative path will be expanded based on the project root when installing or locking.

-

Console scripts#

-

The following content:

-
1
-2
[project.scripts]
-mycli = "mycli.__main__:main"
-
-

will be translated to setuptools style:

-
1
-2
-3
-4
-5
entry_points = {
-    'console_scripts': [
-        'mycli=mycli.__main__:main'
-    ]
-}
-
-

Also, [project.gui-scripts] will be translated to gui_scripts entry points group in setuptools style.

-

Entry points#

-

Other types of entry points are given by [project.entry-points.<type>] section, with the same -format of [project.scripts]:

-
1
-2
[project.entry-points.pytest11]
-myplugin = "mypackage.plugin:pytest_plugin"
-
-

If the entry point name contains dots or other special characters, wrap it in quotes:

-
1
-2
[project.entry-points."flake8.extension"]
-myplugin = "mypackage.plugin:flake8_plugin"
-
- - - - - - - - -
-
- - -
- -
- - - - -
- - - - -
- - -
-
-
-
- - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/search/search_index.json b/2.10/search/search_index.json deleted file mode 100644 index 436091389d..0000000000 --- a/2.10/search/search_index.json +++ /dev/null @@ -1 +0,0 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Introduction","text":""},{"location":"#introduction","title":"Introduction","text":"

PDM, as described, is a modern Python package and dependency manager supporting the latest PEP standards. But it is more than a package manager. It boosts your development workflow in various aspects. The most significant benefit is it installs and manages packages in a similar way to npm that doesn't need to create a virtualenv at all!

"},{"location":"#feature-highlights","title":"Feature highlights","text":"
  • Simple and fast dependency resolver, mainly for large binary distributions.
  • A PEP 517 build backend.
  • PEP 621 project metadata.
  • Flexible and powerful plug-in system.
  • Versatile user scripts.
  • Opt-in centralized installation cache like pnpm.
"},{"location":"#installation","title":"Installation","text":"

PDM requires Python 3.7+ to be installed. It works on multiple platforms including Windows, Linux and macOS.

Note

You can still have your project working on lower Python versions, read how to do it here.

"},{"location":"#recommended-installation-method","title":"Recommended installation method","text":"

PDM requires python version 3.7 or higher.

Like Pip, PDM provides an installation script that will install PDM into an isolated environment.

Linux/MacWindows
curl -sSL https://pdm-project.org/install-pdm.py | python3 -\n
(Invoke-WebRequest -Uri https://pdm-project.org/install-pdm.py -UseBasicParsing).Content | python -\n

For security reasons, you should verify the checksum of install-pdm.py. It can be downloaded from install-pdm.py.sha256.

For example, on Linux/Mac:

curl -sSLO https://pdm-project.org/install-pdm.py\ncurl -sSL https://pdm-project.org/install-pdm.py.sha256 | shasum -a 256 -c -\n# Run the installer\npython3 install-pdm.py [options]\n

The installer will install PDM into the user site and the location depends on the system:

  • $HOME/.local/bin for Unix
  • %APPDATA%\\Python\\Scripts on Windows

You can pass additional options to the script to control how PDM is installed:

usage: install-pdm.py [-h] [-v VERSION] [--prerelease] [--remove] [-p PATH] [-d DEP]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -v VERSION, --version VERSION | envvar: PDM_VERSION\n                        Specify the version to be installed, or HEAD to install from the main branch\n  --prerelease | envvar: PDM_PRERELEASE    Allow prereleases to be installed\n  --remove | envvar: PDM_REMOVE            Remove the PDM installation\n  -p PATH, --path PATH | envvar: PDM_HOME  Specify the location to install PDM\n  -d DEP, --dep DEP | envvar: PDM_DEPS     Specify additional dependencies, can be given multiple times\n

You can either pass the options after the script or set the env var value.

"},{"location":"#other-installation-methods","title":"Other installation methods","text":"HomebrewScooppipxpipasdfinside project
brew install pdm\n
scoop bucket add frostming https://github.com/frostming/scoop-frostming.git\nscoop install pdm\n
pipx install pdm\n

Install the head version of GitHub repository. Make sure you have installed Git LFS on your system.

pipx install git+https://github.com/pdm-project/pdm.git@main#egg=pdm\n

To install PDM with all features:

pipx install pdm[all]\n

See also: https://pypa.github.io/pipx/

pip install --user pdm\n

Assuming you have asdf installed.

asdf plugin add pdm\nasdf local pdm latest\nasdf install pdm\n

By copying the Pyprojectx wrapper scripts to a project, you can install PDM as (npm-style) dev dependency inside that project. This allows different projects/branches to use different PDM versions.

To initialize a new or existing project, cd into the project folder and:

Linux/MacWindows
curl -LO https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip && unzip wrappers.zip && rm -f wrappers.zip\n./pw --init pdm\n
Invoke-WebRequest https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip -OutFile wrappers.zip; Expand-Archive -Path wrappers.zip -DestinationPath .; Remove-Item -Path wrappers.zip\n.\\pw --init pdm\n

When installing pdm with this method, you need to run all pdm commands through the pw wrapper:

Linux/Mac/Windows
./pw pdm install\n
"},{"location":"#update-the-pdm-version","title":"Update the PDM version","text":"
pdm self update\n
"},{"location":"#packaging-status","title":"Packaging Status","text":""},{"location":"#shell-completion","title":"Shell Completion","text":"

PDM supports generating completion scripts for Bash, Zsh, Fish or Powershell. Here are some common locations for each shell:

BashZshFishPowershell
pdm completion bash > /etc/bash_completion.d/pdm.bash-completion\n
# Make sure ~/.zfunc is added to fpath, before compinit.\npdm completion zsh > ~/.zfunc/_pdm\n

Oh-My-Zsh:

mkdir $ZSH_CUSTOM/plugins/pdm\npdm completion zsh > $ZSH_CUSTOM/plugins/pdm/_pdm\n

Then make sure pdm plugin is enabled in ~/.zshrc

pdm completion fish > ~/.config/fish/completions/pdm.fish\n
# Create a directory to store completion scripts\nmkdir $PROFILE\\..\\Completions\necho @'\nGet-ChildItem \"$PROFILE\\..\\Completions\\\" | ForEach-Object {\n    . $_.FullName\n}\n'@ | Out-File -Append -Encoding utf8 $PROFILE\n# Generate script\nSet-ExecutionPolicy Unrestricted -Scope CurrentUser\npdm completion powershell | Out-File -Encoding utf8 $PROFILE\\..\\Completions\\pdm_completion.ps1\n
"},{"location":"#virtualenv-and-pep-582","title":"Virtualenv and PEP 582","text":"

PDM offers experimental support for PEP 582 as an opt-in feature, in addition to virtualenv management. Although the Python Steering Council has rejected PEP 582, you can still test it out using PDM.

To learn more about the two modes, refer to the relevant chapters on Working with virtualenv and Working with PEP 582.

"},{"location":"#pdm-eco-system","title":"PDM Eco-system","text":"

Awesome PDM is a curated list of awesome PDM plugins and resources.

"},{"location":"#sponsors","title":"Sponsors","text":""},{"location":"dev/benchmark/","title":"Benchmark","text":"

This page has been removed, please visit https://lincolnloop.github.io/python-package-manager-shootout/ for a detailed benchmark report.

"},{"location":"dev/changelog/","title":"Changelog","text":"

Attention

Major and minor releases also include changes listed within prior beta releases.

"},{"location":"dev/changelog/#release-v2104-2023-11-24","title":"Release v2.10.4 (2023-11-24)","text":""},{"location":"dev/changelog/#bug-fixes","title":"Bug Fixes","text":"
  • Do not detect as requirements.txt if the file is a python script. #2416
  • Provide information of the original line when parsing requirement fails. #2417
  • Resolve -r requirements paths relative to the requirement file they are specified in #2422
  • Updating package now overwrites the old files instead of removing before installing. #2423
"},{"location":"dev/changelog/#release-v2103-2023-11-16","title":"Release v2.10.3 (2023-11-16)","text":""},{"location":"dev/changelog/#bug-fixes_1","title":"Bug Fixes","text":"
  • Create virtualenv for conda base Python. #2409
"},{"location":"dev/changelog/#release-v2102-2023-11-16","title":"Release v2.10.2 (2023-11-16)","text":""},{"location":"dev/changelog/#features-improvements","title":"Features & Improvements","text":"
  • Log the response text when pdm publish fails with HTTP error. #2400
"},{"location":"dev/changelog/#bug-fixes_2","title":"Bug Fixes","text":"
  • Improve the error message when a specific package can't be found in the lockfile. #2358
  • prevent wrong project name (including space and illegal characters) #2360
  • Fix a bug that PDM cannot detect namespace packages correctly when creating symlinks. The package's __init__.py contains an unusual line. #2378
  • Fix template files created by pdm init being read-only when copied from a read-only PDM installation. #2379
  • Don't reset the build backend when asking for import. #2388
  • Never wrap the output of the export command. #2390
  • Forbid global project in conda base environment, since it may remove conda-managed packages. #2409
"},{"location":"dev/changelog/#release-v2101-2023-11-07","title":"Release v2.10.1 (2023-11-07)","text":""},{"location":"dev/changelog/#bug-fixes_3","title":"Bug Fixes","text":"
  • Fix a bug preventing ctrl-c from interrupting program execution on 2nd invocation when using \"pdm run\" (Windows only). #2292
  • Fix list index out of range when build error message is empty. #2337
  • Fix find_link sources being exported as --extra--index-url #2342
  • Fix an installation failure when install.cache = true. #2355
  • Fix a resolution issue that extra dependencies are not resolved when the bare dependency has more specific version constraint. #2369
"},{"location":"dev/changelog/#documentation","title":"Documentation","text":"
  • Set up a chatbot powered by LLM on the doc page. #2365
"},{"location":"dev/changelog/#release-v2100-2023-10-26","title":"Release v2.10.0 (2023-10-26)","text":""},{"location":"dev/changelog/#features-improvements_1","title":"Features & Improvements","text":"
  • Allow binding packages to specific sources with include_packages and exclude_packages config under tool.pdm.source table. #1645
  • Show warnings when a package is rejected by the resolve because of uncovered requires-python range. And provide a way to ignore them per-package. #2304
  • Add -q/--quiet option to suppress some warnings printed to the console. This option is mutually exclusive with -v/--verbose. #2304
  • Introduce a new --strategy/-S option for lock command, to specify one or more strategy flags for resolving dependencies. --static-urls and --no-cross-platform are deprecated at the same time. #2310
  • Add lock option to resolve direct dependencies to the minimal versions available. #2310
  • Report the progress of download and unpacking when installing packages. #2328
"},{"location":"dev/changelog/#bug-fixes_4","title":"Bug Fixes","text":"
  • Change the venv backend clean function pdm.cli.commands.venv.backend.Backend._ensure_clean to empty the .venv folder instead of deleting it. #2282
  • Fix a bug that dependency groups from Poetry 1.2+ do not migrate properly to PDM. #2285
  • Fix a bug that build requirements are installed into wrong location when using --venv option. #2314
  • Fix a bug that global repository setting results in TypeError . #2330
  • Fix a credentials error when working with two indices on the same host #2333
"},{"location":"dev/changelog/#miscellany","title":"Miscellany","text":"
  • Officially supports python3.12 now. #2301
"},{"location":"dev/changelog/#release-v293-2023-09-25","title":"Release v2.9.3 (2023-09-25)","text":""},{"location":"dev/changelog/#bug-fixes_5","title":"Bug Fixes","text":"
  • Revert the changes to the behavior of installing self, introduced in #2162. Self package won't be installed when --no-default is requested. #2230
  • Reject the candidate if it contains invalid metadata, to avoid a crash in the process of resolution. #2261
"},{"location":"dev/changelog/#documentation_1","title":"Documentation","text":"
  • Clarify what --no-isolated does. #2071
"},{"location":"dev/changelog/#release-v292-2023-09-12","title":"Release v2.9.2 (2023-09-12)","text":""},{"location":"dev/changelog/#features-improvements_2","title":"Features & Improvements","text":"
  • Fix an issue that --no-lock option doesn't work as expected. Also support --no-lock option for add, remove and update commands. #2245
"},{"location":"dev/changelog/#bug-fixes_6","title":"Bug Fixes","text":"
  • Use findpython to find pythons with the spec given by the user. #2225
  • Use UTF-8 to read pyvenv.cfg. #2227
  • On Windows, try looking for the virtualenv python.exe binary under bin/ as well as Scripts/ and the virtualenv/conda root. #2236
  • Write relocatable dependency URLs with ${PROJECT_ROOT} variable in the lockfile. #2240
"},{"location":"dev/changelog/#release-v291-2023-09-03","title":"Release v2.9.1 (2023-09-03)","text":""},{"location":"dev/changelog/#features-improvements_3","title":"Features & Improvements","text":"
  • Support convert setup.cfg without existing setup.py. #2222
"},{"location":"dev/changelog/#bug-fixes_7","title":"Bug Fixes","text":"
  • pdm run should only find local file if the command starts with ./. #2221
"},{"location":"dev/changelog/#release-v290-2023-08-31","title":"Release v2.9.0 (2023-08-31)","text":""},{"location":"dev/changelog/#features-improvements_4","title":"Features & Improvements","text":"
  • Add an --overwrite option to pdm init to overwrite existing files(default False). #2163
  • Support passing filter patterns as positional arguments to pdm list command. Add --tree as an alias and preferred name of --graph option. #2165
  • Switch to truststore by default. #2195
  • Consider packages as installed if the venv includes them from the system-site-packages. #2216
  • Allow pdm run to run a script with the relative or absolute path. #2217
"},{"location":"dev/changelog/#bug-fixes_8","title":"Bug Fixes","text":"
  • Fix a bug that removing dev dependency uninstalls the project as well. #2150
  • Fix a bug that @ file:// dependencies can not be updated. #2169
  • Fix a bug that dependencies requested out of the range of requires-python cause PDM to crash. #2175
  • Fix the compatibility issue with copier 8.0+. #2177
  • Makes comarable_version(\"1.2.3+local1\") == Version(\"1.2.3\"). #2182
  • Default behavior for pdm venv activate when shell detection fails. #2187
  • Handle parsing errors when converting from poetry-style metadata. #2203
  • Don't copy .pyc files from the template directory. #2213
"},{"location":"dev/changelog/#removals-and-deprecations","title":"Removals and Deprecations","text":"
  • Remove the legacy build backend pdm-pep517. #2167
"},{"location":"dev/changelog/#release-v282-2023-07-31","title":"Release v2.8.2 (2023-07-31)","text":""},{"location":"dev/changelog/#features-improvements_5","title":"Features & Improvements","text":"
  • Allow setting username and password in URL for publish command #2140
"},{"location":"dev/changelog/#bug-fixes_9","title":"Bug Fixes","text":"
  • Use UTF-8 encoding when writing sitecustomize.py. #2139
"},{"location":"dev/changelog/#release-v281-2023-07-26","title":"Release v2.8.1 (2023-07-26)","text":""},{"location":"dev/changelog/#features-improvements_6","title":"Features & Improvements","text":"
  • Add keyring, copier, cookiecutter, template, truststore dependency groups. #2109
  • Ignore wheels for python versions not in range. #2113
  • Read default value from env var PDM_PROJECT for -p/--project option. #2126
"},{"location":"dev/changelog/#bug-fixes_10","title":"Bug Fixes","text":"
  • Fix the comparison of the candidate keys in the lockfile. #2120
  • Don't update pyproject.toml if both --unconstrained and --dry-run are passed to pdm update. #2125
  • Overwrite the build-system table when importing from other package manager. #2126
  • Skip sources with empty URL when merging sources. #2130
  • Fix the invalid requirement converted from poetry metadata. #2133
"},{"location":"dev/changelog/#dependencies","title":"Dependencies","text":"
  • Update unearth to 0.10.0 #2113
"},{"location":"dev/changelog/#release-v280-2023-07-15","title":"Release v2.8.0 (2023-07-15)","text":""},{"location":"dev/changelog/#features-improvements_7","title":"Features & Improvements","text":"
  • Support target python with other architectures. #2078
  • Display the help information when running pdm directly. #2081
  • Allow to change the python providers from the config. Support finding pythons from Rye installation location with the new findpython. #2099
  • Option to save static URLs in the lockfile. By default only filenames are saved. #2101
"},{"location":"dev/changelog/#bug-fixes_11","title":"Bug Fixes","text":"
  • Fix a bug that egg-info directories are not removed completely, leading to incomplete distribution. #2027
  • Skip distributions with wrong package meta information and duplicate path. #2075
  • Avoid mistakenly passing command-line arguments while testing. #2083
  • Fix a bug that lockfile groups are overwritten when running locking in a preceding step of pdm install. #2086
  • Tolerate and actually ignore the local versions in version specifiers. #2102
  • Fix a bug that shared cache cannot support overlapping namespace packages. #2105
"},{"location":"dev/changelog/#documentation_2","title":"Documentation","text":"
  • Add notes about using custom venv path. #2096
"},{"location":"dev/changelog/#release-v280a2-2023-06-30","title":"Release v2.8.0a2 (2023-06-30)","text":""},{"location":"dev/changelog/#bug-fixes_12","title":"Bug Fixes","text":"
  • Fix a bug that dependencies can't be updated when the table is separated by another table. #2056
  • Fix a bug that *_lock hooks are always emitted with dry_run=True in pdm update. #2060
  • Fix a bug that pdm install --plugins can't install self. #2062
  • Fix a cache collision between named requirements and url requirements. #2064
"},{"location":"dev/changelog/#release-v280a1-2023-06-27","title":"Release v2.8.0a1 (2023-06-27)","text":""},{"location":"dev/changelog/#features-improvements_8","title":"Features & Improvements","text":"
  • Add support for cookiecutter and copier as project generator. #2059
"},{"location":"dev/changelog/#release-v280a0-2023-06-27","title":"Release v2.8.0a0 (2023-06-27)","text":""},{"location":"dev/changelog/#features-improvements_9","title":"Features & Improvements","text":"
  • pdm init now accepts a template argument to initialize project from a built-in or Git template. #2053
  • Replace the DeprecationWarning with FutureWarning for better exposure. #2012
  • Serve install-pdm.py and its checksum file on the docs site. #2026
  • Add new option --edit/-e to pdm config to edit the config file in default editor. #2028
  • Add --project option to pdm venv to support another path as the project root. #2042
  • Add support for using truststore as the SSL backend. This only works on Python 3.10 or newer. #2049
"},{"location":"dev/changelog/#bug-fixes_13","title":"Bug Fixes","text":"
  • Fix the breaking change by adding the functions back to the old location with deprecation warnings. #2013
  • Fix the duplicate entries in the output of pdm self list. #2018
  • Disable hashes caching for local files. #2019
  • Populate the url field when converting requirements from a Pipfile-style file requirement. #2032
  • Fix a bug that empty source tables in configuration files causes errors when running pdm commands. #2034
  • Fix a resolution conflict caused by requested yanked version also in other transitive dependencies. #2038
  • Fix a bug that binary executables are corrupted when replacing shebangs. #2045
  • Do not normalize the package name when uploading to PyPI. #2057
"},{"location":"dev/changelog/#release-v274-2023-06-13","title":"Release v2.7.4 (2023-06-13)","text":"

No significant changes.

"},{"location":"dev/changelog/#release-v273-2023-06-13","title":"Release v2.7.3 (2023-06-13)","text":""},{"location":"dev/changelog/#bug-fixes_14","title":"Bug Fixes","text":"
  • Fix the warning of extras not found due to extra names not normalized. #2006
  • Pop up a warning when the deprecated parser argument is passed to BaseCommand.__init__() method. #2007
  • Fix a bug that merging settings with AoTs causing a failure. #2011
"},{"location":"dev/changelog/#release-v272-2023-06-12","title":"Release v2.7.2 (2023-06-12)","text":""},{"location":"dev/changelog/#features-improvements_10","title":"Features & Improvements","text":"
  • Add option to expand environment variables when exporting requirements. #1997
"},{"location":"dev/changelog/#bug-fixes_15","title":"Bug Fixes","text":"
  • Case-insensitive sorting in pdm list. #1973
  • Make a compatible cache reader to read the old cache files. #1981
  • Fix a bug that pdm init -n doesn't respect the --python option. #1984
  • Do not use the deprecated nested argument groups. #1988
  • Fix an error parsing setup.py if it prints something to stdout. #1995
  • Exclude yanked versions when running install-pdm.py. #1996
"},{"location":"dev/changelog/#release-v271-2023-06-06","title":"Release v2.7.1 (2023-06-06)","text":""},{"location":"dev/changelog/#features-improvements_11","title":"Features & Improvements","text":"
  • Switch HTTP data cache to use a split body setup, where the actual body contents are not written to disk unless changed. Previously, any changed headers would write the whole body to disk again. #1971
  • Show the specific install commands for different installations when checking update. This was removed before. #1972
"},{"location":"dev/changelog/#bug-fixes_16","title":"Bug Fixes","text":"
  • PDM ignores env vars PDM_PYPI_USERNAME and PDM_PYPI_PASSWORD when there are no defaults in config. #1961
  • Guess the project name from VCS url if it is missing when importing from requirements.txt. #1970
  • Correctly read the config from environment variables. #1977
"},{"location":"dev/changelog/#release-v270-2023-05-29","title":"Release v2.7.0 (2023-05-29)","text":""},{"location":"dev/changelog/#features-improvements_12","title":"Features & Improvements","text":"
  • When keyring is available, either by importing or by CLI, the credentials of repositories and PyPI indexes will be saved into it. #1908
  • Add support for reading metadata from simple index directly. #1919
  • Add a configuration to specify constant command arguments for every pdm invocation. #1923
  • Add ability to skip SSL verification for publish repositories via repository.custom.verify_ssl config option as well as new command line argument of publish command. #1928
  • Use lazy import to reduce the startup time of the CLI. #1929
  • Add the local plugin scripts to PATH env var. #1944
"},{"location":"dev/changelog/#bug-fixes_17","title":"Bug Fixes","text":"
  • Don't use install cache when installing build requirements to avoid race condition. #1869
  • Fix a number of ResourceWarnings when running the test suite with warnings enabled. #1915
  • Fix a bug that dev-dependencies group gets updated with the optional dependencies, causing the hash mismatch. #1916
  • Fix format conversion error from Poetry when tool.poetry.build doesn't exist. #1935
  • Add timeout when fetching .gitignore from GitHub. #1937
  • Keep the variables in the URL credentials when exporting. #1939
  • Convert to boolean when setting verify_ssl for custom indexes. #1945
  • pdm import clobbers build-system.requires value in pyproject.toml. #1948
"},{"location":"dev/changelog/#documentation_3","title":"Documentation","text":"
  • Update publish.md to use run instead of runs to match GitHub Actions steps documentation #1936
  • Update advanced.md to use pdm sync instead of pdm install --no-lock. #1947
"},{"location":"dev/changelog/#release-v261-2023-05-10","title":"Release v2.6.1 (2023-05-10)","text":""},{"location":"dev/changelog/#bug-fixes_18","title":"Bug Fixes","text":"
  • Fix the error when publishing using trusted publisher. #1868
  • Fix a bug that PATH env var isn't set correctly when running under non-isolation mode. #1904
"},{"location":"dev/changelog/#release-v260-2023-05-09","title":"Release v2.6.0 (2023-05-09)","text":""},{"location":"dev/changelog/#features-improvements_13","title":"Features & Improvements","text":"
  • Install project-level plugins from project config, with tool.pdm.plugins setting. #1461
  • Added a --json flag to both run and info command allowing to dump scripts and infos as JSON. #1854
  • Consider tasks with a name starting by an underscore (_) as internal tasks and hide them from the listing. #1855
  • When running pdm init -n(non-interactive mode), a venv will be created by default. Previously, the selected Python will be used under PEP 582 mode. #1862
  • Support Trusted Publisher. #1868
  • Add an ephemeral wheel cache in process for wheels built from non-static revision sources. #1885
  • Allow self-referencing groups in dev-dependencies. #1890
  • Add an option --no-cross-platform to pdm lock to create a non-cross-platform lockfile. #1898
"},{"location":"dev/changelog/#bug-fixes_19","title":"Bug Fixes","text":"
  • Fix brackets in --venv option descriptions in zsh completion script. #1847
  • The resolver doesn't take into account of the requirements for both bare package and package[extra]. #1851
  • Default pypi source does not use configured pypi.password, but \"\" instead. #1856
  • Detect Python interpreters under the root of virtual environments. #1866
  • Fix a race condition when the builder is creating a new build directory. #1869
  • Raise FileNotFoundError if the requirement path is not found. #1875
  • Fix a bug that the self package isn't uninstallable. #1901
  • "},{"location":"dev/changelog/#release-v256-2023-05-07","title":"Release v2.5.6 (2023-05-07)","text":""},{"location":"dev/changelog/#bug-fixes_20","title":"Bug Fixes","text":"
    • Fix a double reading issue due to cachecontrol not compatible with urllib3 2.0. #1894
    "},{"location":"dev/changelog/#release-v255-2023-05-05","title":"Release v2.5.5 (2023-05-05)","text":"

    No significant changes.

    "},{"location":"dev/changelog/#release-v254-2023-05-05","title":"Release v2.5.4 (2023-05-05)","text":""},{"location":"dev/changelog/#bug-fixes_21","title":"Bug Fixes","text":"
    • Pin the urllib3 to <2.0 to avoid incompatibility with cachecontrol. #1886
    "},{"location":"dev/changelog/#release-v253-2023-04-19","title":"Release v2.5.3 (2023-04-19)","text":""},{"location":"dev/changelog/#bug-fixes_22","title":"Bug Fixes","text":"
    • Fix the wrong argument validation for update command, where packages given with group option should be allowed. #1836
    "},{"location":"dev/changelog/#documentation_4","title":"Documentation","text":"
    • Update markdown-exec to 1.5.0 for rendering TOC in CLI reference page. #1836
    • Remove advertizing of PEP-582 from the feature highlights. Improve the anchor links for CLI reference. #1840
    "},{"location":"dev/changelog/#release-v252-2023-04-10","title":"Release v2.5.2 (2023-04-10)","text":""},{"location":"dev/changelog/#bug-fixes_23","title":"Bug Fixes","text":"
    • Regression(#1710): Don't crash when trying to update the shebang in a binary script #1827
    • Rename the env var PDM_USE_VENV as PDM_IN_VENV for --venv flag as it mistakenly override another existing env var. #1829
    "},{"location":"dev/changelog/#release-v251-2023-04-09","title":"Release v2.5.1 (2023-04-09)","text":""},{"location":"dev/changelog/#bug-fixes_24","title":"Bug Fixes","text":"
    • Fix a bug that pdm --pep582 raises an argument error. #1823
    "},{"location":"dev/changelog/#release-v250-2023-04-09","title":"Release v2.5.0 (2023-04-09)","text":""},{"location":"dev/changelog/#features-improvements_14","title":"Features & Improvements","text":"
    • When resolution.respect-source-order is enabled, sources are lazily evaluated. This means that if a match is found on the first source, the remaining sources will not be requested. #1509
    • New option --venv <venv> to run a command in the virtual environment with the given name. #1705
    • Allow to prefer binary distributions when locking and installing packages, via PDM_PREFER_BINARY environment variable. #1817
    "},{"location":"dev/changelog/#bug-fixes_25","title":"Bug Fixes","text":"
    • Do not validate selected groups against the locked grouped when running pdm lock. #1796
    • Avoid duplicate .pdm-python in .gitignore. #1800
    • Fix a backwards compatibility issue by adding back the environment.is_global property. #1814
    • Fix a resolution conflict when a relative path requirement resolves to the same path as another file requirement with absolute path. #1822
    • Fix an error when running pdm init -p <dir> if the target directory is not created yet. #1822
    "},{"location":"dev/changelog/#release-v250b0-2023-03-29","title":"Release v2.5.0b0 (2023-03-29)","text":""},{"location":"dev/changelog/#breaking-changes","title":"Breaking Changes","text":"
    • Switch the default build backend to pdm-backend. #1684
    • Only lock selected groups into the lockfile. Modify other commands to honor the groups included in the lockfile. #1704
    • Move the project python path to its own file, and rename the project config file as pdm.toml which can be committed to the VCS. #1742
    • Refactor the environment package. Environment is renamed to PythonLocalEnvironment and GlobalEnvironment is renamed to PythonEnvironment. Move pdm.models.environment module to pdm.environments package. #1791
    "},{"location":"dev/changelog/#features-improvements_15","title":"Features & Improvements","text":"
    • Add option to fail on the first install error. #1614
    • Upgrade unearth to 0.8 to allow calling keyring from CLI. #1653
    • Merge the index parameters from different configuration files. #1667
    • Add new options to venv command to show the path or the python interpreter for a managed venv. #1680
    • Write the groups of resolved dependencies to the metadata table in lockfile. #1692
    • Introduce --lib option to init command to create a library project without prompting. #1708
    • New command: pdm fix to migrate to the new PDM features. Add a hint when invoking PDM commands. #1743
    • Include .pdm-python in project root .gitignore when running pdm init. #1749
    • Allow to ignore the activated venv with PDM_IGNORE_ACTIVE_VENV env var. #1782
    • Add a signal pre_invoke to emit before any command is invoked. #1792
    "},{"location":"dev/changelog/#bug-fixes_26","title":"Bug Fixes","text":"
    • Fix a bug that install warning prints to terminal under non-verbose mode. #1635
    • Fix the random failure of pdm export due to non-deterministic order of group iteration. #1786
    • Show the actual version when running pdm show --version #1788
    "},{"location":"dev/changelog/#documentation_5","title":"Documentation","text":"
    • Restructure the documentation. #1687
    "},{"location":"dev/changelog/#dependencies_1","title":"Dependencies","text":"
    • Update installer to 0.7.0 and emit a warning if the RECORD validation fails. #1784
    "},{"location":"dev/changelog/#release-v249-2023-03-16","title":"Release v2.4.9 (2023-03-16)","text":""},{"location":"dev/changelog/#bug-fixes_27","title":"Bug Fixes","text":"
    • Fix a bug of synchronization of not considering the revision of VCS requirement in comparison. #1762
    • Improve the error message when parsing an invalid requirement string. #1765
    • Fix a bug that pdm export output doesn't include the extras of the dependencies. #1767
    "},{"location":"dev/changelog/#release-v248-2023-03-09","title":"Release v2.4.8 (2023-03-09)","text":""},{"location":"dev/changelog/#bug-fixes_28","title":"Bug Fixes","text":"
    • Fix the resolution order to prefer the packages causing the conflict. This can make the resolution reach a solution faster. #1752
    • Fix a bug that embedded credentials in URL are not respected for the default source. #1757
    "},{"location":"dev/changelog/#release-v247-2023-03-02","title":"Release v2.4.7 (2023-03-02)","text":""},{"location":"dev/changelog/#bug-fixes_29","title":"Bug Fixes","text":"
    • Abort if lockfile isn't generated when executing pdm export. #1730
    • Ignore venv.prompt configuration when using conda as the backend. #1734
    • Fix a bug of finding local packages in the parent folder when it exists in the current folder. #1736
    • Ensure UTF-8 encoding when generating README.md. #1739
    • Fix a bug of show command not showing metadata of the current project. #1740
    • Replace . with - when normalizing package name. #1745
    "},{"location":"dev/changelog/#documentation_6","title":"Documentation","text":"
    • Support using pdm venv activate without specifying env_name to activate in project venv created by conda #1735
    "},{"location":"dev/changelog/#release-v246-2023-02-20","title":"Release v2.4.6 (2023-02-20)","text":""},{"location":"dev/changelog/#bug-fixes_30","title":"Bug Fixes","text":"
    • Fix a resolution failure when the project has cascading relative path dependencies. #1702
    • Don't crash when trying to update the shebang in a binary script. #1709
    • Handle the legacy specifiers that is unable to parse with packaging>22.0. #1719
    • Fix the setup.py parser to ignore the expressions unable to parse as a string. This is safe for initializing a requirement. #1720
    • Fix a bug converting from flit metadata when the source file can't be found. #1726
    "},{"location":"dev/changelog/#documentation_7","title":"Documentation","text":"
    • Add config example for Emacs using eglot + pyright #1721
    "},{"location":"dev/changelog/#miscellany_1","title":"Miscellany","text":"
    • Use ruff as the linter. #1715
    • Document installation via asdf. #1725
    "},{"location":"dev/changelog/#release-v245-2023-02-10","title":"Release v2.4.5 (2023-02-10)","text":""},{"location":"dev/changelog/#bug-fixes_31","title":"Bug Fixes","text":"
    • Fix a bug that built wheels are prioritized over source distributions with higher version number. #1698
    "},{"location":"dev/changelog/#release-v244-2023-02-10","title":"Release v2.4.4 (2023-02-10)","text":""},{"location":"dev/changelog/#features-improvements_16","title":"Features & Improvements","text":"
    • Add more intuitive error message when the requires-python doesn't work for all dependencies. #1690
    "},{"location":"dev/changelog/#bug-fixes_32","title":"Bug Fixes","text":"
    • Prefer built distributions when finding packages for metadata extraction. #1535
    "},{"location":"dev/changelog/#release-v243-2023-02-06","title":"Release v2.4.3 (2023-02-06)","text":""},{"location":"dev/changelog/#features-improvements_17","title":"Features & Improvements","text":"
    • Allow creating venv in project forcely if it already exists. #1666
    • Always ignore remembered selection in pdm init. #1672
    "},{"location":"dev/changelog/#bug-fixes_33","title":"Bug Fixes","text":"
    • Fix the fallback build backend to pdm-pep517 instead of setuptools. #1658
    • Eliminate the deprecation warnings from importlib.resources. #1660
    • Don't crash when failed to get the latest version of PDM for checking update. #1663
    • Fix the priorities of importable formats to make sure the correct format is used. #1669
    • Import editable requirements into dev dependencies. #1674
    "},{"location":"dev/changelog/#release-v242-2023-01-31","title":"Release v2.4.2 (2023-01-31)","text":""},{"location":"dev/changelog/#bug-fixes_34","title":"Bug Fixes","text":"
    • Skip some tests on packaging < 22. #1649
    • Fix a bug that sources from the project config are not loaded. #1651
    • Set VIRTUAL_ENV in pdm run. #1652
    "},{"location":"dev/changelog/#release-v241-2023-01-28","title":"Release v2.4.1 (2023-01-28)","text":""},{"location":"dev/changelog/#features-improvements_18","title":"Features & Improvements","text":"
    • Add proper display for the extra pypi sources in pdm config. #1622
    • Support running python scripts without prefixing with python. #1626
    "},{"location":"dev/changelog/#bug-fixes_35","title":"Bug Fixes","text":"
    • Ignore the python requirement for overriden packages. #1575
    • Fix the wildcards in requirement specifiers to make it pass the new parser of packaging>=22. #1619
    • Add the missing subdirectory attribute to the lockfile entry. #1630
    • Fix a bug that VCS locks don't update when the rev part changes. #1640
    • Redirect the spinner output to stderr. #1646
    • Ensure the destination directory exists before building the packages. #1647
    "},{"location":"dev/changelog/#release-v240-2023-01-12","title":"Release v2.4.0 (2023-01-12)","text":""},{"location":"dev/changelog/#features-improvements_19","title":"Features & Improvements","text":"
    • Support multiple PyPI indexes in the configuration. They will be tried after the sources in pyproject.toml. #1310
    • Accept yanked versions when the requirement version is pinned. #1575
    • Expose PDM fixtures as a pytest plugin pdm.pytest for plugin developers. #1594
    • Show message in the status when fetching package hashes. Fetch hashes from the JSON API response as well. #1609
    • Mark pdm.lock with an @generated comment. #1611
    "},{"location":"dev/changelog/#bug-fixes_36","title":"Bug Fixes","text":"
    • Exclude site-packages for symlinks of the python interpreter as well. #1598
    • Fix a bug that error output can't be decoded correctly on Windows. #1602
    "},{"location":"dev/changelog/#release-v234-2022-12-27","title":"Release v2.3.4 (2022-12-27)","text":""},{"location":"dev/changelog/#features-improvements_20","title":"Features & Improvements","text":"
    • Detect PDM inside a zipapp and disable some functions. #1578
    "},{"location":"dev/changelog/#bug-fixes_37","title":"Bug Fixes","text":"
    • Don't write sitecustomize to the home directory if it exists in the filesystem(not packed in a zipapp). #1572
    • Fix a bug that a directory is incorrectly marked as to be deleted when it contains symlinks. #1580
    "},{"location":"dev/changelog/#release-v233-2022-12-15","title":"Release v2.3.3 (2022-12-15)","text":""},{"location":"dev/changelog/#bug-fixes_38","title":"Bug Fixes","text":"
    • Allow relative paths in build-system.requires, since build and hatch both support it. Be aware it is not allowed in the standard. #1560
    • Strip the local part when building a specifier for comparison with the package version. This is not permitted by PEP 508 as implemented by packaging 22.0. #1562
    • Update the version for check_update after self update #1563
    • Replace the __file__ usages with importlib.resources, to make PDM usable in a zipapp. #1567
    • Fix the matching problem of packages in the lockfile. #1569
    "},{"location":"dev/changelog/#dependencies_2","title":"Dependencies","text":"
    • Exclude package==22.0 from the dependencies to avoid some breakages to the end users. #1568
    "},{"location":"dev/changelog/#release-v232-2022-12-08","title":"Release v2.3.2 (2022-12-08)","text":""},{"location":"dev/changelog/#bug-fixes_39","title":"Bug Fixes","text":"
    • Fix an installation failure when the RECORD file contains commas in the file path. #1010
    • Fallback to pdm.pep517 as the metadata transformer for unknown custom build backends. #1546
    • Fix a bug that Ctrl + C kills the python interactive session instead of clearing the current line. #1547
    • Fix a bug with egg segment for local dependency #1552
    "},{"location":"dev/changelog/#dependencies_3","title":"Dependencies","text":"
    • Update installer to 0.6.0. #1550
    • Update minimum version of unearth to 0.6.3 and test against packaging==22.0. #1555
    "},{"location":"dev/changelog/#release-v231-2022-12-05","title":"Release v2.3.1 (2022-12-05)","text":""},{"location":"dev/changelog/#bug-fixes_40","title":"Bug Fixes","text":"
    • Fix a resolution loop issue when the current project depends on itself and it uses the dynamic version from SCM. #1541
    • Don't give duplicate results when specifying a relative path for pdm use. #1542
    "},{"location":"dev/changelog/#release-v230-2022-12-02","title":"Release v2.3.0 (2022-12-02)","text":""},{"location":"dev/changelog/#features-improvements_21","title":"Features & Improvements","text":"
    • Beautify the error message of build errors. Default to showing the last 10 lines of the build output. #1491
    • Rename the tool.pdm.overrides table to tool.pdm.resolution.overrides. The old name is deprecated at the same time. #1503
    • Add backend selection and --backend option to pdm init command, users can choose a favorite backend from setuptools, flit, hatchling and pdm-pep517(default), since they all support PEP 621 standards. #1504
    • Allows specifying the insertion position of user provided arguments in scripts with the {args[:default]} placeholder. #1507
    "},{"location":"dev/changelog/#bug-fixes_41","title":"Bug Fixes","text":"
    • The local package is now treated specially during installation and locking. This means it will no longer be included in the lockfile, and should never be installed twice even when using nested extras. This will ensure the lockdown stays relevant when the version changes. #1481
    • Fix the version diff algorithm of installed packages to consider local versions as compatible. #1497
    • Fix the confusing message when detecting a Python interpreter under python.use_venv=False #1508
    • Fix the test failure with the latest findpython installed. #1516
    • Fix the module missing error of pywin32 in a virtualenv with install.cache set to true and caching method is pth. #863
    "},{"location":"dev/changelog/#dependencies_4","title":"Dependencies","text":"
    • Drop the dependency pdm-pep517. #1504
    • Replace pep517 with pyproject-hooks because of the rename. #1528
    "},{"location":"dev/changelog/#removals-and-deprecations_1","title":"Removals and Deprecations","text":"
    • Remove the support for exporting the project file to a setup.py format, users are encouraged to migrate to the PEP 621 metadata. #1504
    "},{"location":"dev/changelog/#release-v221-2022-11-03","title":"Release v2.2.1 (2022-11-03)","text":""},{"location":"dev/changelog/#features-improvements_22","title":"Features & Improvements","text":"
    • Make sitecustomize.py respect the PDM_PROJECT_MAX_DEPTH environment variable #1471
    "},{"location":"dev/changelog/#bug-fixes_42","title":"Bug Fixes","text":"
    • Fix the comparison of python_version in the environment marker. When the version contains only one digit, the result was incorrect. #1484
    "},{"location":"dev/changelog/#release-v220-2022-10-31","title":"Release v2.2.0 (2022-10-31)","text":""},{"location":"dev/changelog/#features-improvements_23","title":"Features & Improvements","text":"
    • Add venv.prompt configuration to allow customizing prompt when a virtualenv is activated #1332
    • Allow the use of custom CA certificates per publish repository using ca_certs or from the command line via pdm publish --ca-certs <path> .... #1392
    • Rename the plugin command to self, and it can not only manage plugins but also all dependencies. Add a subcommand self update to update PDM itself. #1406
    • Allow pdm init to receive a Python path or version via --python option. #1412
    • Add a default value for requires-python when importing from other formats. #1426
    • Use pdm instead of pip to resolve and install build requirements. So that PDM configurations can control the process. #1429
    • Customizable color theme via pdm config command. #1450
    • A new pdm lock --check flag to validate whether the lock is up to date. #1459
    • Add both option and config item to ship pip when creating a new venv. #1463
    • Issue warning and skip the requirement if it has the same name as the current project. #1466
    • Enhance the pdm list command with new formats: --csv,--markdown and add options --fields,--sort to control the output contents. Users can also include licenses in the --fields option to display the package licenses. #1469
    • A new pre-commit hook to run pdm lock --check in pre-commit. #1471
    "},{"location":"dev/changelog/#bug-fixes_43","title":"Bug Fixes","text":"
    • Fix the issue that relative paths don't work well with --project argument. #1220
    • It is now possible to refer to a package from outside the project with relative paths in dependencies. #1381
    • Ensure pypi.[ca,client]_cert[s] config items are passed to distribution builder install steps to allow for custom PyPI index sources with self signed certificates. #1396
    • Fix a crash issue when depending on editable packages with extras. #1401
    • Do not save the python path when using non-interactive mode in pdm init. #1410
    • Fix the matching of python* command in pdm run. #1414
    • Show the Python path, instead of the real executable, in the Python selection menu. #1418
    • Fix the HTTP client of package publishment to prompt for password and read PDM configurations correctly. #1430
    • Ignore the unknown fields when constructing a requirement object. #1445
    • Fix a bug of unrelated candidates being fetched if the requirement is matching wildcard versions(e.g. ==1.*). #1465
    • Use importlib-metadata from PyPI for Python < 3.10. #1467
    "},{"location":"dev/changelog/#documentation_8","title":"Documentation","text":"
    • Clarify the difference between a library and an application. Update the guide of multi-stage docker build. #1371
    "},{"location":"dev/changelog/#removals-and-deprecations_2","title":"Removals and Deprecations","text":"
    • Remove all top-level imports, users should import from the submodules instead. #1404
    • Remove the usages of old config names deprecated since 2.0. #1422
    • Remove the deprecated color functions, use rich's console markup instead. #1452
    "},{"location":"dev/changelog/#release-v215-2022-10-05","title":"Release v2.1.5 (2022-10-05)","text":""},{"location":"dev/changelog/#bug-fixes_44","title":"Bug Fixes","text":"
    • Ensure pypi.[ca,client]_cert[s] config items are passed to distribution builder install steps to allow for custom PyPI index sources with self signed certificates. #1396
    • Fix a crash issue when depending on editable packages with extras. #1401
    • Do not save the python path when using non-interactive mode in pdm init. #1410
    • Restrict importlib-metadata (<5.0.0) for Python <3.8 #1411
    "},{"location":"dev/changelog/#release-v214-2022-09-17","title":"Release v2.1.4 (2022-09-17)","text":""},{"location":"dev/changelog/#bug-fixes_45","title":"Bug Fixes","text":"
    • Fix a lock failure when depending on self with URL requirements. #1347
    • Ensure list to concatenate args for composite scripts. #1359
    • Fix an error in pdm lock --refresh if some packages has URLs. #1361
    • Fix unnecessary package downloads and VCS clones for certain commands. #1370
    • Fix a conversion error when converting a list of conditional dependencies from a Poetry format. #1383
    "},{"location":"dev/changelog/#documentation_9","title":"Documentation","text":"
    • Adds a section to the docs on how to correctly work with PDM and version control systems. #1364
    "},{"location":"dev/changelog/#release-v213-2022-08-30","title":"Release v2.1.3 (2022-08-30)","text":""},{"location":"dev/changelog/#features-improvements_24","title":"Features & Improvements","text":"
    • When adding a package to (or removing from) a group, enhance the formatting of the group name in the printed message. #1329
    "},{"location":"dev/changelog/#bug-fixes_46","title":"Bug Fixes","text":"
    • Fix a bug of missing hashes for packages with file:// links the first time they are added. #1325
    • Ignore invalid values of data-requires-python when parsing package links. #1334
    • Leave an incomplete project metadata if PDM fails to parse the project files, but emit a warning. #1337
    • Fix the bug that editables package isn't installed for self package. #1344
    • Fix a decoding error for non-ASCII characters in package description when publishing it. #1345
    "},{"location":"dev/changelog/#documentation_10","title":"Documentation","text":"
    • Clarify documentation explaining setup-script, run-setuptools, and is-purelib. #1327
    "},{"location":"dev/changelog/#release-v212-2022-08-15","title":"Release v2.1.2 (2022-08-15)","text":""},{"location":"dev/changelog/#bug-fixes_47","title":"Bug Fixes","text":"
    • Fix a bug that dependencies from different versions of the same package override each other. #1307
    • Forward SIGTERM to child processes in pdm run. #1312
    • Fix errors when running on FIPS 140-2 enabled systems using Python 3.9 and newer. #1313
    • Fix the build failure when the subprocess outputs with non-UTF8 characters. #1319
    • Delay the trigger of post_lock for add and update operations, to ensure the pyproject.toml is updated before the hook is run. #1320
    "},{"location":"dev/changelog/#release-v211-2022-08-05","title":"Release v2.1.1 (2022-08-05)","text":""},{"location":"dev/changelog/#features-improvements_25","title":"Features & Improvements","text":"
    • Add a env_file.override option that allows the user to specify that the env_file should override any existing environment variables. This is not the default as the environment the code runs it should take precedence. #1299
    "},{"location":"dev/changelog/#bug-fixes_48","title":"Bug Fixes","text":"
    • Fix a bug that unnamed requirements can't override the old ones in either add or update command. #1287
    • Support mutual TLS to private repositories via pypi.client_cert and pypi.client_key config options. #1290
    • Set a minimum version for the packaging dependency to ensure that packaging.utils.parse_wheel_filename is available. #1293
    • Fix a bug that checking for PDM update creates a venv. #1301
    • Prefer compatible packages when fetching metadata. #1302
    "},{"location":"dev/changelog/#release-v210-2022-07-29","title":"Release v2.1.0 (2022-07-29)","text":""},{"location":"dev/changelog/#features-improvements_26","title":"Features & Improvements","text":"
    • Allow the use of custom CA certificates using the pypi.ca_certs config entry. #1240
    • Add pdm export to available pre-commit hooks. #1279
    "},{"location":"dev/changelog/#bug-fixes_49","title":"Bug Fixes","text":"
    • Skip incompatible requirements when installing build dependencies. #1264
    • Fix a crash when pdm tries to publish a package with non-ASCII characters in the metadata. #1270
    • Try to read the lock file even if the lock version is incompatible. #1273
    • For packages that are only available as source distribution, the summary field in pdm.lock contains the description from the package's pyproject.toml. #1274
    • Do not crash when calling pdm show for a package that is only available as source distribution. #1276
    • Fix a bug that completion scripts are interpreted as rich markups. #1283
    "},{"location":"dev/changelog/#dependencies_5","title":"Dependencies","text":"
    • Remove the dependency of pip. #1268
    "},{"location":"dev/changelog/#removals-and-deprecations_3","title":"Removals and Deprecations","text":"
    • Deprecate the top-level imports from pdm module, it will be removed in the future. #1282
    "},{"location":"dev/changelog/#release-v203-2022-07-22","title":"Release v2.0.3 (2022-07-22)","text":""},{"location":"dev/changelog/#bug-fixes_50","title":"Bug Fixes","text":"
    • Support Conda environments when detecting the project environment. #1253
    • Fix the interpreter resolution to first try python executable in the PATH. #1255
    • Stabilize sorting of URLs in metadata.files in pdm.lock. #1256
    • Don't expand credentials in the file URLs in the [metada.files] table of the lock file. #1259
    "},{"location":"dev/changelog/#release-v202-2022-07-20","title":"Release v2.0.2 (2022-07-20)","text":""},{"location":"dev/changelog/#features-improvements_27","title":"Features & Improvements","text":"
    • env_file variables no longer override existing environment variables. #1235
    • Support referencing other optional groups in optional-dependencies with <this_package_name>[group1, group2] #1241
    "},{"location":"dev/changelog/#bug-fixes_51","title":"Bug Fixes","text":"
    • Respect requires-python when creating the default venv. #1237
    "},{"location":"dev/changelog/#release-v201-2022-07-17","title":"Release v2.0.1 (2022-07-17)","text":""},{"location":"dev/changelog/#bug-fixes_52","title":"Bug Fixes","text":"
    • Write lockfile before calling 'post_lock' hook #1224
    • Suppress errors when cache dir isn't accessible. #1226
    • Don't save python path for venv commands. #1230
    "},{"location":"dev/changelog/#release-v200-2022-07-15","title":"Release v2.0.0 (2022-07-15)","text":""},{"location":"dev/changelog/#bug-fixes_53","title":"Bug Fixes","text":"
    • Fix a bug that the running env overrides the PEP 582 PYTHONPATH. #1211
    • Add pwsh as an alias of powershell for shell completion. #1216
    • Fixed a bug with zsh completion regarding --pep582 flag. #1218
    • Fix a bug of requirement checking under non-isolated mode. #1219
    • Fix a bug when removing packages, TOML document might become invalid. #1221
    "},{"location":"dev/changelog/#release-v200b2-2022-07-08","title":"Release v2.0.0b2 (2022-07-08)","text":""},{"location":"dev/changelog/#breaking-changes_1","title":"Breaking Changes","text":"
    • Store file URLs instead of filenames in the lock file, bump lock version to 4.0. #1203
    "},{"location":"dev/changelog/#features-improvements_28","title":"Features & Improvements","text":"
    • Read site-wide configuration, which serves as the lowest-priority layer. This layer will be read-only in the CLI. #1200
    • Get package links from the urls stored in the lock file. #1204
    "},{"location":"dev/changelog/#bug-fixes_54","title":"Bug Fixes","text":"
    • Fix a bug that the host pip(installed with pdm) may not be compatible with the project python. #1196
    • Update unearth to fix a bug that install links with weak hashes are skipped. This often happens on self-hosted PyPI servers. #1202
    "},{"location":"dev/changelog/#release-v200b1-2022-07-02","title":"Release v2.0.0b1 (2022-07-02)","text":""},{"location":"dev/changelog/#features-improvements_29","title":"Features & Improvements","text":"
    • Integrate pdm venv commands into the main program. Make PEP 582 an opt-in feature. #1162
    • Add config global_project.fallback_verbose defaulting to True. When set to False disables message Project is not found, fallback to the global project #1188
    • Add --only-keep option to pdm sync to keep only selected packages. Originally requested at #398. #1191
    "},{"location":"dev/changelog/#bug-fixes_55","title":"Bug Fixes","text":"
    • Fix a bug that requirement extras and underlying are resolved to the different version #1173
    • Update unearth to 0.4.1 to skip the wheels with invalid version parts. #1178
    • Fix reading PDM_RESOLVE_MAX_ROUNDS environment variable (was spelled \u2026ROUDNS before). #1180
    • Deduplicate the list of found Python versions. #1182
    • Use the normal stream handler for logging, to fix some display issues under non-tty environments. #1184
    "},{"location":"dev/changelog/#removals-and-deprecations_4","title":"Removals and Deprecations","text":"
    • Remove the useless --no-clean option from pdm sync command. #1191
    "},{"location":"dev/changelog/#release-v200a1-2022-06-29","title":"Release v2.0.0a1 (2022-06-29)","text":""},{"location":"dev/changelog/#breaking-changes_2","title":"Breaking Changes","text":"
    • Editable dependencies in the [project] table is not allowed, according to PEP 621. They are however still allowed in the [tool.pdm.dev-dependencies] table. PDM will emit a warning when it finds editable dependencies in the [project] table, or will abort when you try to add them into the [project] table via CLI. #1083
    • Now the paths to the global configurations and global project are calculated according to platform standards. #1161
    "},{"location":"dev/changelog/#features-improvements_30","title":"Features & Improvements","text":"
    • Add support for importing from a setup.py project. #1062
    • Switch the UI backend to rich. #1091
    • Improved the terminal UI and logging. Disable live progress under verbose mode. The logger levels can be controlled by the -v option. #1096
    • Use unearth to replace pip's PackageFinder and related data models. PDM no longer relies on pip internals, which are unstable across updates. #1096
    • Lazily load the candidates returned by find_matches() to speed up the resolution. #1098
    • Add a new command publish to PDM since it is required for so many people and it will make the workflow easier. #1107
    • Add a composite script kind allowing to run multiple defined scripts in a single command as well as reusing scripts but overriding env or env_file. #1117
    • Add a new execution option --skip to opt-out some scripts and hooks from any execution (both scripts and PDM commands). #1127
    • Add the pre/post_publish, pre/post_run and pre/post_script hooks as well as an extensive lifecycle and hooks documentation. #1147
    • Shorter scripts listing, especially for multilines and composite scripts. #1151
    • Build configurations have been moved to [tool.pdm.build], according to pdm-pep517 1.0.0. At the same time, warnings will be shown against old usages. #1153
    • Improve the lock speed by parallelizing the hash fetching. #1154
    • Retrieve the candidate metadata by parsing the pyproject.toml rather than building it. #1156
    • Update the format converters to support the new [tool.pdm.build] table. #1157
    • Scripts are now available as root command if they don't conflict with any builtin or plugin-contributed command. #1159
    • Add a post_use hook triggered after successfully switching Python version. #1163
    • Add project configuration respect-source-order under [tool.pdm.resolution] to respect the source order in the pyproject.toml file. Packages will be returned by source earlier in the order or later ones if not found. #593
    "},{"location":"dev/changelog/#bug-fixes_56","title":"Bug Fixes","text":"
    • Fix a bug that candidates with local part in the version can't be found and installed correctly. #1093
    "},{"location":"dev/changelog/#dependencies_6","title":"Dependencies","text":"
    • Prefer tomllib on Python 3.11 #1072
    • Drop the vendored libraries click, halo, colorama and log_symbols. PDM has no vendors now. #1091
    • Update dependency version pdm-pep517 to 1.0.0. #1153
    "},{"location":"dev/changelog/#removals-and-deprecations_5","title":"Removals and Deprecations","text":"
    • PDM legacy metadata format(from pdm 0.x) is no longer supported. #1157
    "},{"location":"dev/changelog/#miscellany_2","title":"Miscellany","text":"
    • Provide a tox.ini file for easier local testing against all Python versions. #1160
    "},{"location":"dev/changelog/#release-v1154-2022-06-28","title":"Release v1.15.4 (2022-06-28)","text":""},{"location":"dev/changelog/#bug-fixes_57","title":"Bug Fixes","text":"
    • Revert #1106: Do not use venv scheme for prefix kind install scheme. #1158
    • Fix a bug when updating a package with extra requirements, the package version doesn't get updated correctly. #1166
    "},{"location":"dev/changelog/#miscellany_3","title":"Miscellany","text":"
    • Add additional installation option via asdf-pdm. Add skip-add-to-path option to installer in order to prevent changing PATH. Replace bin variable name with bin_dir. #1145
    "},{"location":"dev/changelog/#release-v1153-2022-06-14","title":"Release v1.15.3 (2022-06-14)","text":""},{"location":"dev/changelog/#bug-fixes_58","title":"Bug Fixes","text":"
    • Fix a defect in the resolution preferences that causes an infinite resolution loop. #1119
    • Update the poetry importer to support the new [tool.poetry.build] config table. #1131
    "},{"location":"dev/changelog/#improved-documentation","title":"Improved Documentation","text":"
    • Add support for multiple versions of documentations. #1126
    "},{"location":"dev/changelog/#release-v1152-2022-06-06","title":"Release v1.15.2 (2022-06-06)","text":""},{"location":"dev/changelog/#bug-fixes_59","title":"Bug Fixes","text":"
    • Fix bug where SIGINT is sent to the main pdm process and not to the process actually being run. #1095
    • Fix a bug due to the build backend fallback, which causes different versions of the same requirement to exist in the build environment, making the building unstable depending on which version being used. #1099
    • Don't include the version in the cache key of the locked candidates if they are from a URL requirement. #1099
    • Fix a bug where dependencies with requires-python pre-release versions caused pdm update to fail with InvalidPyVersion. #1111
    "},{"location":"dev/changelog/#release-v1151-2022-06-02","title":"Release v1.15.1 (2022-06-02)","text":""},{"location":"dev/changelog/#bug-fixes_60","title":"Bug Fixes","text":"
    • Fix a bug that dependencies are missing from the dep graph when they are depended by a requirement with extras. #1097
    • Give a default version if the version is dynamic in setup.cfg or setup.py. #1101
    • Fix a bug that the hashes for file URLs are not included in the lock file. #1103
    • Fix a bug that package versions are updated even when they are excluded by pdm update command. #1104
    • Prefer venv install scheme when available. This scheme is more stable than posix_prefix scheme since the latter is often patched by distributions. #1106
    "},{"location":"dev/changelog/#miscellany_4","title":"Miscellany","text":"
    • Move the test artifacts to a submodule. It will make it easier to package this project. #1084
    "},{"location":"dev/changelog/#release-v1150-2022-05-16","title":"Release v1.15.0 (2022-05-16)","text":""},{"location":"dev/changelog/#features-improvements_31","title":"Features & Improvements","text":"
    • Allow specifying lockfile other than pdm.lock by --lockfile option or PDM_LOCKFILE env var. #1038
    "},{"location":"dev/changelog/#bug-fixes_61","title":"Bug Fixes","text":"
    • Replace the editable entry in pyproject.toml when running pdm add --no-editable <package>. #1050
    • Ensure the pip module inside venv in installation script. #1053
    • Fix the py2 compatibility issue in the in-process get_sysconfig_path.py script. #1056
    • Fix a bug that file paths in URLs are not correctly unquoted. #1073
    • Fix a bug on Python 3.11 that overriding an existing command from plugins raises an error. #1075
    • Replace the ${PROJECT_ROOT} variable in the result of export command. #1079
    "},{"location":"dev/changelog/#removals-and-deprecations_6","title":"Removals and Deprecations","text":"
    • Show a warning if Python 2 interpreter is being used and remove the support on 2.0. #1082
    "},{"location":"dev/changelog/#release-v1141-2022-04-21","title":"Release v1.14.1 (2022-04-21)","text":""},{"location":"dev/changelog/#features-improvements_32","title":"Features & Improvements","text":"
    • Ask for description when doing pdm init and create default README for libraries. #1041
    "},{"location":"dev/changelog/#bug-fixes_62","title":"Bug Fixes","text":"
    • Fix a bug of missing subdirectory fragment when importing from a requirements.txt. #1036
    • Fix use_cache.json with corrupted python causes pdm use error. #1039
    • Ignore the optional key when converting from Poetry's dependency entries. #1042
    "},{"location":"dev/changelog/#improved-documentation_1","title":"Improved Documentation","text":"
    • Clarify documentation on enabling PEP582 globally. #1033
    "},{"location":"dev/changelog/#release-v1140-2022-04-08","title":"Release v1.14.0 (2022-04-08)","text":""},{"location":"dev/changelog/#features-improvements_33","title":"Features & Improvements","text":"
    • Editable installations won't be overridden unless --no-editable is passed. pdm add --no-editable will now override the editable mode of the given packages. #1011
    • Re-calculate the file hashes when running pdm lock --refresh. #1019
    "},{"location":"dev/changelog/#bug-fixes_63","title":"Bug Fixes","text":"
    • Fix a bug that requirement with extras isn't resolved to the version as specified by the range. #1001
    • Replace the ${PROJECT_ROOT} in the output of pdm list. #1004
    • Further fix the python path issue of macOS system installed Python. #1023
    • Fix the install path issue on Python 3.10 installed from homebrew. #996
    "},{"location":"dev/changelog/#improved-documentation_2","title":"Improved Documentation","text":"
    • Document how to install PDM inside a project with Pyprojectx. #1004
    "},{"location":"dev/changelog/#dependencies_7","title":"Dependencies","text":"
    • Support installer 0.5.x. #1002
    "},{"location":"dev/changelog/#release-v1136-2022-03-28","title":"Release v1.13.6 (2022-03-28)","text":""},{"location":"dev/changelog/#bug-fixes_64","title":"Bug Fixes","text":"
    • Default the optional license field to \"None\". #991
    • Don't create project files in pdm search command. #993
    • Fix a bug that the env vars in source urls in exported result are not expanded. #997
    "},{"location":"dev/changelog/#release-v1135-2022-03-23","title":"Release v1.13.5 (2022-03-23)","text":""},{"location":"dev/changelog/#features-improvements_34","title":"Features & Improvements","text":"
    • Users can change the install destination of global project to the user site(~/.local) with global_project.user_site config. #885
    • Make the path to the global project configurable. Rename the configuration auto_global to global_project.fallback and deprecate the old name. #986
    "},{"location":"dev/changelog/#bug-fixes_65","title":"Bug Fixes","text":"
    • Fix the compatibility when fetching license information in show command. #966
    • Don't follow symlinks for the paths in the requirement strings. #976
    • Use the default install scheme when installing build requirements. #983
    • Fix a bug that _.site_packages is overridden by default option value. #985
    "},{"location":"dev/changelog/#release-v1134-2022-03-09","title":"Release v1.13.4 (2022-03-09)","text":""},{"location":"dev/changelog/#features-improvements_35","title":"Features & Improvements","text":"
    • Update the dependency pdm-pep517 to support PEP 639. #959
    "},{"location":"dev/changelog/#bug-fixes_66","title":"Bug Fixes","text":"
    • Filter out the unmatched python versions when listing the available versions. #941
    • Fix a bug displaying the available python versions. #943
    • Fix a bug under non-UTF8 console encoding. #960
    • Fix a bug that data files are not copied to the destination when using installation cache. #961
    "},{"location":"dev/changelog/#release-v1133-2022-02-24","title":"Release v1.13.3 (2022-02-24)","text":""},{"location":"dev/changelog/#bug-fixes_67","title":"Bug Fixes","text":"
    • Fix a bug that VCS repo name are parsed as the package name. #928
    • Support prerelease versions for global projects. #932
    • Fix a bug that VCS revision in the lock file isn't respected when installing. #933
    "},{"location":"dev/changelog/#dependencies_8","title":"Dependencies","text":"
    • Switch from pythonfinder to findpython as the Python version finder. #930
    "},{"location":"dev/changelog/#release-v1132-2022-02-20","title":"Release v1.13.2 (2022-02-20)","text":""},{"location":"dev/changelog/#bug-fixes_68","title":"Bug Fixes","text":"
    • Fix a regression issue that prereleases can't be installed if the version specifier of the requirement doesn't imply that. #920
    "},{"location":"dev/changelog/#release-v1131-2022-02-18","title":"Release v1.13.1 (2022-02-18)","text":""},{"location":"dev/changelog/#bug-fixes_69","title":"Bug Fixes","text":"
    • Fix a bug that bad pip cache dir value breaks PDM's check update function. #922
    • Fix a race condition in parallel installation by changing metadata to a lazy property. This fixes a bug that incompatible wheels are installed unexpectedly. #924
    "},{"location":"dev/changelog/#release-v1130post0-2022-02-18","title":"Release v1.13.0.post0 (2022-02-18)","text":""},{"location":"dev/changelog/#bug-fixes_70","title":"Bug Fixes","text":"
    • Fix a bug that incompatible platform-specific wheels are installed. #921
    "},{"location":"dev/changelog/#release-v1130-2022-02-18","title":"Release v1.13.0 (2022-02-18)","text":""},{"location":"dev/changelog/#features-improvements_36","title":"Features & Improvements","text":"
    • Support pre_* and post_* scripts for task composition. Pre- and Post- scripts for init, build, install and lock will be run if present. #789
    • Support --config/-c option to specify another global configuration file. #883
    • Packages with extras require no longer inherit the dependencies from the same package without extras. It is because the package without extras are returned as one of the dependencies. This change won't break the existing lock files nor dependency cache. #892
    • Support version ranges in [tool.pdm.overrides] table. #909
    • Rename config use_venv to python.use_venv; rename config feature.install_cache to install.cache; rename config feature.install_cache_method to install.cache_method; rename config parallel_install to install.parallel. #914
    "},{"location":"dev/changelog/#bug-fixes_71","title":"Bug Fixes","text":"
    • Fix a bug that file URLs or VCS URLs don't work in [tool.pdm.overrides] table. #861
    • Fix a bug of identifier mismatch for URL requirements without an explicit name. #901
    • No requires-python should be produced if ANY(*) is given. #917
    • Fix a bug that pdm.lock gets created when --dry-run is passed to pdm add. #918
    "},{"location":"dev/changelog/#improved-documentation_3","title":"Improved Documentation","text":"
    • The default editable backend becomes path. #904
    "},{"location":"dev/changelog/#removals-and-deprecations_7","title":"Removals and Deprecations","text":"
    • Stop auto-migrating projects from PDM 0.x format. #912
    "},{"location":"dev/changelog/#refactor","title":"Refactor","text":"
    • Rename ExtrasError to ExtrasWarning for better understanding. Improve the warning message. #892
    • Extract the environment related code from Candidate into a new class PreparedCandidate. Candidate no longer holds an Environment instance. #920
    "},{"location":"dev/changelog/#release-v1128-2022-02-06","title":"Release v1.12.8 (2022-02-06)","text":""},{"location":"dev/changelog/#features-improvements_37","title":"Features & Improvements","text":"
    • Print the error and continue if a plugin fails to load. #878
    "},{"location":"dev/changelog/#bug-fixes_72","title":"Bug Fixes","text":"
    • PDM now ignores configuration of uninstalled plugins. #872
    • Fix the compatibility issue with pip>=22.0. #875
    "},{"location":"dev/changelog/#release-v1127-2022-01-31","title":"Release v1.12.7 (2022-01-31)","text":""},{"location":"dev/changelog/#features-improvements_38","title":"Features & Improvements","text":"
    • If no command is given to pdm run, it will run the Python REPL. #856
    "},{"location":"dev/changelog/#bug-fixes_73","title":"Bug Fixes","text":"
    • Fix the hash calculation when generating direct_url.json for a local pre-built wheel. #861
    • PDM no longer migrates project meta silently. #867
    "},{"location":"dev/changelog/#dependencies_9","title":"Dependencies","text":"
    • Pin pip<22.0. #874
    "},{"location":"dev/changelog/#miscellany_5","title":"Miscellany","text":"
    • Reduce the number of tests that require network, and mark the rest with network marker. #858
    "},{"location":"dev/changelog/#release-v1126-2022-01-12","title":"Release v1.12.6 (2022-01-12)","text":""},{"location":"dev/changelog/#bug-fixes_74","title":"Bug Fixes","text":"
    • Fix a bug that cache dir isn't created. #843
    "},{"location":"dev/changelog/#release-v1125-2022-01-11","title":"Release v1.12.5 (2022-01-11)","text":""},{"location":"dev/changelog/#bug-fixes_75","title":"Bug Fixes","text":"
    • Fix a resolution error that dots in the package name are normalized to - unexpectedly. #853
    "},{"location":"dev/changelog/#release-v1124-2022-01-11","title":"Release v1.12.4 (2022-01-11)","text":""},{"location":"dev/changelog/#features-improvements_39","title":"Features & Improvements","text":"
    • Remember the last selection in use command to save the human effort. And introduce an -i option to ignored that remembered value. #846
    "},{"location":"dev/changelog/#bug-fixes_76","title":"Bug Fixes","text":"
    • Fix a bug of uninstall crash when the package has directories in RECORD. #847
    • Fix the ModuleNotFoundError during uninstall when the modules required are removed. #850
    "},{"location":"dev/changelog/#release-v1123-2022-01-07","title":"Release v1.12.3 (2022-01-07)","text":""},{"location":"dev/changelog/#features-improvements_40","title":"Features & Improvements","text":"
    • Support setting Python path in global configuration. #842
    "},{"location":"dev/changelog/#bug-fixes_77","title":"Bug Fixes","text":"
    • Lowercase the package names in the lock file make it more stable. #836
    • Show the packages to be updated in dry run mode of pdm update even if --no-sync is passed. #837
    • Improve the robustness of update check code. #841
    • Fix a bug that export result has environment markers that don't apply for all requirements. #843
    "},{"location":"dev/changelog/#release-v1122-2021-12-30","title":"Release v1.12.2 (2021-12-30)","text":""},{"location":"dev/changelog/#features-improvements_41","title":"Features & Improvements","text":"
    • Allow changing the installation linking method by feature.install_cache_method config. #822
    "},{"location":"dev/changelog/#bug-fixes_78","title":"Bug Fixes","text":"
    • Fix a bug that namespace packages can't be symlinked to the cache due to existing links. #820
    • Make PDM generated pth files processed as early as possible. #821
    • Fix a UnicodeDecodeError for subprocess logger under Windows/GBK. #823
    "},{"location":"dev/changelog/#release-v1121-2021-12-24","title":"Release v1.12.1 (2021-12-24)","text":""},{"location":"dev/changelog/#bug-fixes_79","title":"Bug Fixes","text":"
    • Don't symlink pycaches to the target place. #817
    "},{"location":"dev/changelog/#release-v1120-2021-12-22","title":"Release v1.12.0 (2021-12-22)","text":""},{"location":"dev/changelog/#features-improvements_42","title":"Features & Improvements","text":"
    • Add lock --refresh to update the hash stored with the lock file without updating the pinned versions. #642
    • Support resolution overriding in the [tool.pdm.overrides] table. #790
    • Add support for signals for basic operations, now including post_init, pre_lock, post_lock, pre_install and post_install. #798
    • Add install --check to check if the lock file is up to date. #810
    • Use symlinks to cache installed packages when it is supported by the file system. #814
    "},{"location":"dev/changelog/#bug-fixes_80","title":"Bug Fixes","text":"
    • Fix a bug that candidates from urls are rejected by the allow_prereleases setting. Now non-named requirements are resolved earlier than pinned requirements. #799
    "},{"location":"dev/changelog/#improved-documentation_4","title":"Improved Documentation","text":"
    • Add a new doc page: API reference. #802
    "},{"location":"dev/changelog/#dependencies_10","title":"Dependencies","text":"
    • Switch back from atoml to tomlkit as the style-preserving TOML parser. The latter has supported TOML v1.0.0. #809
    "},{"location":"dev/changelog/#miscellany_6","title":"Miscellany","text":"
    • Cache the latest version of PDM for one week to reduce the request frequency. #800
    "},{"location":"dev/changelog/#release-v1113-2021-12-15","title":"Release v1.11.3 (2021-12-15)","text":""},{"location":"dev/changelog/#features-improvements_43","title":"Features & Improvements","text":"
    • Change the default version save strategy to minimum, without upper bounds. #787
    "},{"location":"dev/changelog/#bug-fixes_81","title":"Bug Fixes","text":"
    • Fix the patching of sysconfig in PEP 582 initialization script. #796
    "},{"location":"dev/changelog/#miscellany_7","title":"Miscellany","text":"
    • Fix an installation failure of the bootstrap script on macOS Catalina. #793
    • Add a basic benchmarking script. #794
    "},{"location":"dev/changelog/#release-v1112-2021-12-10","title":"Release v1.11.2 (2021-12-10)","text":""},{"location":"dev/changelog/#bug-fixes_82","title":"Bug Fixes","text":"
    • Fix the resolution order to reduce the loop number to find a conflict. #781
    • Patch the functions in sysconfig to return the PEP 582 scheme in pdm run. #784
    "},{"location":"dev/changelog/#dependencies_11","title":"Dependencies","text":"
    • Remove the upper bound of version constraints for most dependencies, except for some zero-versioned ones. #787
    "},{"location":"dev/changelog/#release-v1111-2021-12-08","title":"Release v1.11.1 (2021-12-08)","text":""},{"location":"dev/changelog/#features-improvements_44","title":"Features & Improvements","text":"
    • Support --pre/--prelease option for pdm add and pdm update. It will allow prereleases to be pinned. #774
    • Improve the error message when python is found but not meeting the python requirement. #777
    "},{"location":"dev/changelog/#bug-fixes_83","title":"Bug Fixes","text":"
    • Fix a bug that git+https candidates cannot be resolved. #771
    • Fix an infinite resolution loop by resolving the top-level packages first. Also deduplicate the lines from the same requirement in the error output. #776
    "},{"location":"dev/changelog/#miscellany_8","title":"Miscellany","text":"
    • Fix the install script to use a zipapp of virtualenv when it isn't installed. #780
    "},{"location":"dev/changelog/#release-v1110-2021-11-30","title":"Release v1.11.0 (2021-11-30)","text":""},{"location":"dev/changelog/#features-improvements_45","title":"Features & Improvements","text":"
    • Move version from [project] table to [tool.pdm] table, delete classifiers from dynamic, and warn usage about the deprecated usages. #748
    • Add support for Conda environments in addition to Python virtual environments. #749
    • Add support for saving only the lower bound x >= VERSION when adding dependencies. #752
    • Improve the error message when resolution fails. #754
    "},{"location":"dev/changelog/#bug-fixes_84","title":"Bug Fixes","text":"
    • Switch to self-implemented pdm list --freeze to fix a bug due to Pip's API change. #533
    • Fix an infinite loop issue when resolving candidates with incompatible requires-python. #744
    • Fix the python finder to support pyenv-win. #745
    • Fix the ANSI color output for Windows cmd and Powershell terminals. #753
    "},{"location":"dev/changelog/#removals-and-deprecations_8","title":"Removals and Deprecations","text":"
    • Remove -s/--section option from all previously supported commands. Use -G/--group instead. #756
    "},{"location":"dev/changelog/#release-v1103-2021-11-18","title":"Release v1.10.3 (2021-11-18)","text":""},{"location":"dev/changelog/#bug-fixes_85","title":"Bug Fixes","text":"
    • Use importlib to replace imp in the sitecustomize module for Python 3. #574
    • Fix the lib paths under non-isolated build. #740
    • Exclude the dependencies with extras in the result of pdm export. #741
    "},{"location":"dev/changelog/#release-v1102-2021-11-14","title":"Release v1.10.2 (2021-11-14)","text":""},{"location":"dev/changelog/#features-improvements_46","title":"Features & Improvements","text":"
    • Add a new option -s/--site-packages to pdm run as well as a script config item. When it is set to True, site-packages from the selected interpreter will be loaded into the running environment. #733
    "},{"location":"dev/changelog/#bug-fixes_86","title":"Bug Fixes","text":"
    • Now NO_SITE_PACKAGES isn't set in pdm run if the executable is out of local packages. #733
    "},{"location":"dev/changelog/#release-v1101-2021-11-09","title":"Release v1.10.1 (2021-11-09)","text":""},{"location":"dev/changelog/#features-improvements_47","title":"Features & Improvements","text":"
    • Isolate the project environment with system site packages in pdm run, but keep them seen when PEP 582 is enabled. #708
    "},{"location":"dev/changelog/#bug-fixes_87","title":"Bug Fixes","text":"
    • Run pip with --isolated when building wheels. In this way some env vars like PIP_REQUIRE_VIRTUALENV can be ignored. #669
    • Fix the install script to ensure pip is not DEBUNDLED. #685
    • Fix a bug that when summary is None, the lockfile can't be generated. #719
    • ${PROJECT_ROOT} should be written in the URL when relative path is given. #721
    • Fix a bug that when project table already exists, pdm import can't merge the settings correctly. #723
    "},{"location":"dev/changelog/#release-v1100-2021-10-25","title":"Release v1.10.0 (2021-10-25)","text":""},{"location":"dev/changelog/#features-improvements_48","title":"Features & Improvements","text":"
    • Add --no-sync option to update command. #684
    • Support find_links source type. It can be specified via type key of [[tool.pdm.source]] table. #694
    • Add --dry-run option to add, install and remove commands. #698
    "},{"location":"dev/changelog/#bug-fixes_88","title":"Bug Fixes","text":"
    • Remove trailing whitespace with terminal output of tables (via project.core.ui.display_columns), fixing unnecessary wrapping due to / with empty lines full of spaces in case of long URLs in the last column. #680
    • Include files should be installed under venv's base path. #682
    • Ensure the value of check_update is boolean. #689
    "},{"location":"dev/changelog/#improved-documentation_5","title":"Improved Documentation","text":"
    • Update the contributing guide, remove the usage of setup_dev.py in favor of pip install. #676
    "},{"location":"dev/changelog/#release-v190-2021-10-12","title":"Release v1.9.0 (2021-10-12)","text":""},{"location":"dev/changelog/#bug-fixes_89","title":"Bug Fixes","text":"
    • Fix a bug that requires-python is not recognized in candidates evaluation. #657
    • Fix the path order when pdm run so that executables in local packages dir are found first. #678
    "},{"location":"dev/changelog/#dependencies_12","title":"Dependencies","text":"
    • Update installer to 0.3.0, fixing a bug that broke installation of some packages with unusual wheel files. #653
    • Change packaging and typing-extensions to direct dependencies. #674
    "},{"location":"dev/changelog/#refactor_1","title":"Refactor","text":"
    • requires-python now participates in the resolution as a dummy requirement. #658
    "},{"location":"dev/changelog/#release-v185-2021-09-16","title":"Release v1.8.5 (2021-09-16)","text":""},{"location":"dev/changelog/#bug-fixes_90","title":"Bug Fixes","text":"
    • Fix the error of regex to find the shebang line. #656
    "},{"location":"dev/changelog/#release-v184-2021-09-15","title":"Release v1.8.4 (2021-09-15)","text":""},{"location":"dev/changelog/#features-improvements_49","title":"Features & Improvements","text":"
    • Support --no-isolation option for install, lock, update, remove, sync commands. #640
    • Make project_max_depth configurable and default to 5. #643
    "},{"location":"dev/changelog/#bug-fixes_91","title":"Bug Fixes","text":"
    • Don't try pdm-pep517 backend on Python 2.7 when installing self as editable. #640
    • Fix a bug that existing shebang can't be replaced correctly. #651
    • Fix the version range saving for prerelease versions. #654
    "},{"location":"dev/changelog/#release-v183-2021-09-07","title":"Release v1.8.3 (2021-09-07)","text":""},{"location":"dev/changelog/#features-improvements_50","title":"Features & Improvements","text":"
    • Allow to build in non-isolated environment, to enable optional speedups depending on the environment. #635
    "},{"location":"dev/changelog/#bug-fixes_92","title":"Bug Fixes","text":"
    • Don't copy *-nspkg.pth files in install_cache mode. It will still work without them. #623
    "},{"location":"dev/changelog/#release-v182-2021-09-01","title":"Release v1.8.2 (2021-09-01)","text":""},{"location":"dev/changelog/#bug-fixes_93","title":"Bug Fixes","text":"
    • Fix the removal issue of standalone pyc files #633
    "},{"location":"dev/changelog/#release-v181-2021-08-26","title":"Release v1.8.1 (2021-08-26)","text":""},{"location":"dev/changelog/#features-improvements_51","title":"Features & Improvements","text":"
    • Add -r/--reinstall option to sync command to force re-install the existing dependencies. #601
    • Show update hint after every pdm command. #603
    • pdm cache clear can clear cached installations if not needed any more. #604
    "},{"location":"dev/changelog/#bug-fixes_94","title":"Bug Fixes","text":"
    • Fix the editable install script so that setuptools won't see the dependencies under local packages. #601
    • Preserve the executable bit when installing wheels. #606
    • Write PEP 610 metadata direct_url.json when installing wheels. #607
    • Fix a bug that * fails to be converted as SpecifierSet. #609
    "},{"location":"dev/changelog/#refactor_2","title":"Refactor","text":"
    • Build editable packages are into wheels via PEP 660 build backend. Now all installations are unified into wheels. #612
    "},{"location":"dev/changelog/#release-v180-2021-08-16","title":"Release v1.8.0 (2021-08-16)","text":""},{"location":"dev/changelog/#features-improvements_52","title":"Features & Improvements","text":"
    • Added a new mode --json to the list command which outputs the dependency graph as a JSON document. #583
    • Add a new config feature.install_cache. When it is turned on, wheels will be installed into a centralized package repo and create .pth files under project packages directory to link to the cached package. #589
    "},{"location":"dev/changelog/#bug-fixes_95","title":"Bug Fixes","text":"
    • Fix env vars in source URLs not being expanded in all cases. #570
    • Fix the weird output of pdm show. #580
    • Prefer ~/.pyenv/shims/python3 as the pyenv interpreter. #590
    • Fix a bug that installing will download candidates that do not match the locked hashes. #596
    "},{"location":"dev/changelog/#improved-documentation_6","title":"Improved Documentation","text":"
    • Added instructions to the Contributing section for creating news fragments #573
    "},{"location":"dev/changelog/#removals-and-deprecations_9","title":"Removals and Deprecations","text":"
    • Deprecate -s/--section option in favor of -G/--group. #591
    "},{"location":"dev/changelog/#refactor_3","title":"Refactor","text":"
    • Switch to a self-implemented version of uninstaller. #586
    • pdm/installers/installers.py is renamed to pdm/installers/manager.py to be more accurate. The Installer class under that file is renamed to InstallerManager and is exposed in the pdm.core.Core object for overriding. The new pdm/installers/installers.py contains some installation implementations. #589
    • Switch from pkg_resources.Distribution to the implementation of importlib.metadata. #592
    "},{"location":"dev/changelog/#release-v172-2021-07-30","title":"Release v1.7.2 (2021-07-30)","text":""},{"location":"dev/changelog/#bug-fixes_96","title":"Bug Fixes","text":"
    • Remove the existing files before installing. #565
    • Deduplicate the plugins list. #566
    "},{"location":"dev/changelog/#release-v171-2021-07-29","title":"Release v1.7.1 (2021-07-29)","text":""},{"location":"dev/changelog/#bug-fixes_97","title":"Bug Fixes","text":"
    • Accept non-canonical distribution name in the wheel's dist-info directory name. #529
    • Prefer requirements with narrower version constraints or allowing prereleases to find matches. #551
    • Use the underlying real executable path for writing shebangs. #553
    • Fix a bug that extra markers cannot be extracted when combined with other markers with \"and\". #559
    • Fix a bug that redacted credentials in source urls get overwritten with the plain text after locking. #561
    "},{"location":"dev/changelog/#refactor_4","title":"Refactor","text":"
    • Use installer as the wheel installer, replacing distlib. #519
    "},{"location":"dev/changelog/#release-v170-2021-07-20","title":"Release v1.7.0 (2021-07-20)","text":""},{"location":"dev/changelog/#features-improvements_53","title":"Features & Improvements","text":"
    • Support showing individual fields by --<field-name> options in pdm show. When no package is given, show this project. #527
    • Add --freeze option to pdm list command which shows the dependencies list as pip's requirements.txt format. #531
    "},{"location":"dev/changelog/#bug-fixes_98","title":"Bug Fixes","text":"
    • Fix the path manipulation on Windows, now the PEP 582 path is prepended to the PYTHONPATH. #522
    • Fix the handling of auth prompting: will try keyring in non-verbose mode. #523
    • Recognize old entry point name \"pdm.plugin\" for backward-compatibility. #530
    • Match the VCS scheme in case-insensitive manner. #537
    • Use the default permission bits when writing project files. #542
    • Fix the VCS url to be consistent between lock and install. #547
    "},{"location":"dev/changelog/#improved-documentation_7","title":"Improved Documentation","text":"
    • Add installation instructions for Scoop. #522
    "},{"location":"dev/changelog/#dependencies_13","title":"Dependencies","text":"
    • Update pdm-pep517 to 0.8.0. #524
    • Switch from toml to tomli. #541
    "},{"location":"dev/changelog/#refactor_5","title":"Refactor","text":"
    • Separate the build env into two different levels for better caching. #541
    • Refactor the build part into smaller functions. #543
    "},{"location":"dev/changelog/#release-v164-2021-06-23","title":"Release v1.6.4 (2021-06-23)","text":""},{"location":"dev/changelog/#features-improvements_54","title":"Features & Improvements","text":"
    • Extract package name from egg-info in filename when eligible. Remove the patching code of resolvelib's inner class. #441
    • Support installing packages from subdiretories of VCS repository. #507
    • Add an install script to bootstrap PDM quickly without help of other tools. Modify docs to recommend this installation method. #508
    • Add a new subcommand plugin to manage pdm plugins, including add, remove and list commands. #510
    "},{"location":"dev/changelog/#bug-fixes_99","title":"Bug Fixes","text":"
    • Don't monkeypatch the internal class of resolvelib any more. This makes PDM more stable across updates of sub-dependencies. #515
    "},{"location":"dev/changelog/#miscellany_9","title":"Miscellany","text":"
    • Clear the type errors from mypy. #261
    "},{"location":"dev/changelog/#release-v163-2021-06-17","title":"Release v1.6.3 (2021-06-17)","text":""},{"location":"dev/changelog/#features-improvements_55","title":"Features & Improvements","text":"
    • Add an option -u/--unconstrained to support unconstraining version specifiers when adding packages. #501
    "},{"location":"dev/changelog/#bug-fixes_100","title":"Bug Fixes","text":"
    • Fix the format of dependency arrays when a new value is appended. #487
    • Allow missing email attribute for authors and maintainers. #492
    • Fix a bug that editable install shouldn't require pyproject.toml to be valid. #497
    • Fix a bug on macOS that purelib and platlib paths of isolated build envs cannot be substituted correctly if the Python is a framework build. #502
    • Fix the version sort of candidates. #506
    "},{"location":"dev/changelog/#release-v162-2021-05-31","title":"Release v1.6.2 (2021-05-31)","text":"

    No significant changes.

    "},{"location":"dev/changelog/#release-v161-2021-05-31","title":"Release v1.6.1 (2021-05-31)","text":"

    No significant changes.

    "},{"location":"dev/changelog/#release-v160-2021-05-31","title":"Release v1.6.0 (2021-05-31)","text":""},{"location":"dev/changelog/#features-improvements_56","title":"Features & Improvements","text":"
    • Use a new approach to determine the packages to be installed. This requires a quick resolution step before installation. #456
    • pdm export no longer produces requirements file applicable for all platforms due to the new approach. #456
    • Add structural typing for requirements module. Refactor the requirements module for that purpose. #433
    • Introduce --no-editable option to install non-editable versions of all packages. #443
    • Introduce --no-self option to prevent the project itself from being installed. #444
    • Add a default .gitignore file in the __pypackages__ directory. #446
    • Check if the lock file version is compatible with PDM program before installation. #463
    • Expose the project root path via PDM_PROJECT_ROOT env var. Change to the project root when executing scripts. #470
    • Fix a bug that installation resolution doesn't respect the requirement markers from pyproject config. #480
    "},{"location":"dev/changelog/#bug-fixes_101","title":"Bug Fixes","text":"
    • Changing to multiline breaks the parsing of TOML document. #462
    • Fix a bug that transient dependencies of conditional requirements can't be resolved. #472
    • Fix a bug that invalid wheels are rejected while they are acceptable for resolution. #473
    • Fix a bug that build environment is not fully isolated with the hosted environment. #477
    • Ensure the lock file is compatible before looking for the locked candidates. #484
    "},{"location":"dev/changelog/#improved-documentation_8","title":"Improved Documentation","text":"
    • Fix 404 links in documentation. #472
    "},{"location":"dev/changelog/#dependencies_14","title":"Dependencies","text":"
    • Migrate from tomlkit to atoml as the style-preserving TOML parser and writer. #465
    "},{"location":"dev/changelog/#removals-and-deprecations_10","title":"Removals and Deprecations","text":"
    • Remove the warning of --dev flag for older versions of PDM. #444
    "},{"location":"dev/changelog/#miscellany_10","title":"Miscellany","text":"
    • Add Python 3.10 beta CI job. #457
    "},{"location":"dev/changelog/#release-v153-2021-05-10","title":"Release v1.5.3 (2021-05-10)","text":""},{"location":"dev/changelog/#features-improvements_57","title":"Features & Improvements","text":"
    • Support passing options to the build backends via --config-setting. #452
    "},{"location":"dev/changelog/#bug-fixes_102","title":"Bug Fixes","text":"
    • Seek for other sitecustomize.py to import. #422
    • Fix an unescaped single quote in fish completion script. #423
    • The hashes of a remote file candidate should be calculated from the link itself. #450
    "},{"location":"dev/changelog/#dependencies_15","title":"Dependencies","text":"
    • Remove keyring as a dependency and guide users to install it when it is not available. #442
    • Specify the minimum version of distlib. #447
    "},{"location":"dev/changelog/#miscellany_11","title":"Miscellany","text":"
    • Add log output about found candidates and their origin. #421
    • Add mypy pre-commit hook #427
    • Improve type safety of pdm.cli.actions #428
    • Fix wrong mypy configuration. #451
    "},{"location":"dev/changelog/#release-v152-2021-04-27","title":"Release v1.5.2 (2021-04-27)","text":""},{"location":"dev/changelog/#features-improvements_58","title":"Features & Improvements","text":"
    • Allow pdm use with no argument given, which will list all available pythons for pick. #409
    "},{"location":"dev/changelog/#bug-fixes_103","title":"Bug Fixes","text":"
    • Inform user to enable PEP 582 for development script to work. #404
    • Check the existence of pyenv shim Python interpreter before using it. #406
    • Fix a bug that executing setup.py failed for NameError. #407
    • Check before setting the PYTHONPATH environment variable for PEP582 #410
    • Fix development setup error. #415
    "},{"location":"dev/changelog/#dependencies_16","title":"Dependencies","text":"
    • Update pip to 21.1 and fix compatibility issues. #412
    "},{"location":"dev/changelog/#release-v151-2021-04-22","title":"Release v1.5.1 (2021-04-22)","text":""},{"location":"dev/changelog/#bug-fixes_104","title":"Bug Fixes","text":"
    • Make func translate_sections pure to avoid exporting requirements in random order. #401
    • Expand the variables in install requirements' attributes for build. #402
    "},{"location":"dev/changelog/#release-v150-2021-04-20","title":"Release v1.5.0 (2021-04-20)","text":""},{"location":"dev/changelog/#features-improvements_59","title":"Features & Improvements","text":"
    • Include dev dependencies by default for install and sync commands. Add a new option --prod/--production to exclude them. Improve the dependency selection logic to be more convenient to use \u2014 the more common the usage is, the shorter the command is. #391
    "},{"location":"dev/changelog/#bug-fixes_105","title":"Bug Fixes","text":"
    • Enquote executable path to ensure generating valid scripts. #387
    • Consider hashes when fetching artifact link for build. #389
    • Considier the sources settings when building. #399
    "},{"location":"dev/changelog/#improved-documentation_9","title":"Improved Documentation","text":"
    • New pdm setting source-includes to mark files to be included only in sdist builds. #390
    "},{"location":"dev/changelog/#dependencies_17","title":"Dependencies","text":"
    • Update pdm-pep517 to 0.7.0; update resolvelib to0.7.0. #390
    "},{"location":"dev/changelog/#removals-and-deprecations_11","title":"Removals and Deprecations","text":"
    • Deprecate the usage of -d/--dev option in install and sync commands. #391
    "},{"location":"dev/changelog/#release-v150b1-2021-04-12","title":"Release v1.5.0b1 (2021-04-12)","text":""},{"location":"dev/changelog/#features-improvements_60","title":"Features & Improvements","text":"
    • Improve the env builder to run in isolated mode. #384
    "},{"location":"dev/changelog/#bug-fixes_106","title":"Bug Fixes","text":"
    • Remove the incompatible code from the files that will be run in-process. #375
    • Get the correct Python ABI tag of selected interpreter #378
    • Error out when doing pdm run on a directory not initialized yet.
    • Give warning message when the project automatically fallbacks to the global project.
    "},{"location":"dev/changelog/#dependencies_18","title":"Dependencies","text":"
    • Upgrade resolvelib to 0.6.0. #381
    "},{"location":"dev/changelog/#miscellany_12","title":"Miscellany","text":"
    • refactor pdm.models.readers to improve typing support #321
    • Add a basic integration test for cross-python check. #377
    • Refactor the project.python_executable to project.python that contains all info of the interpreter. #382
    • Continue refactoring Python info to extract to its own module. #383
    • Refactor the creation of project.
    "},{"location":"dev/changelog/#release-v150b0-2021-04-03","title":"Release v1.5.0b0 (2021-04-03)","text":""},{"location":"dev/changelog/#features-improvements_61","title":"Features & Improvements","text":"
    • Add hand-written zsh completion script. #188
    • Add a special value :all given to -s/--section to refer to all sections under the same species. Adjust add, sync, install, remove and update to support the new dev-dependencies groups. Old behavior will be kept the same. #351
    • dev-dependencies is now a table of dependencies groups, where key is the group name and value is an array of dependencies. These dependencies won't appear in the distribution's metadata. dev-depedencies of the old format will turn into dev group under dev-dependencies. #351
    • Move dev-dependencies, includes, excludes and package-dir out from [project] table to [tool.pdm] table. The migration will be done automatically if old format is detected. #351
    • Throws an error with meaningful message when no candidate is found for one requirement. #357
    • Support --dry-run option for update command to display packages that need update, install or removal. Add --top option to limit to top level packages only. #358
    • Full-featured completion scripts for Zsh and Powershell - section selection, package name autocompletion and so on. Windows is a first-class citizen! #367
    • Support non-interactive init command via -n/--non-interactive option. No question will be asked in this mode. #368
    • Show project packages path(PEP 582) in the output of pdm info, also add an option --packages to show that value only. #372
    "},{"location":"dev/changelog/#bug-fixes_107","title":"Bug Fixes","text":"
    • Fix a bug that pure python libraries are not loaded to construct the WorkingSet. #346
    • Don't write <script>-X.Y variant to the bin folder. #365
    • Python is now run in isolated mode via subprocess to avoid accidentally importing user packages. #369
    • Don't overwrite existing dependencies when importing from requirements.txt. #370
    "},{"location":"dev/changelog/#improved-documentation_10","title":"Improved Documentation","text":"
    • Add instructions of how to integrate PDM with Emacs, contributed by @linw1995. #372
    "},{"location":"dev/changelog/#removals-and-deprecations_12","title":"Removals and Deprecations","text":"
    • Remove the support of project path following -g/--global that was deprecated in 1.4.0. One should use -g -p <project_path> for that purpose. #361
    "},{"location":"dev/changelog/#miscellany_13","title":"Miscellany","text":"
    • Add test coverage to PDM. #109
    • Add type annotations into untyped functions to start using mypy. #354
    • Refactor the format converter code to be more explicit. #360
    "},{"location":"dev/changelog/#release-v145-2021-03-30","title":"Release v1.4.5 (2021-03-30)","text":""},{"location":"dev/changelog/#features-improvements_62","title":"Features & Improvements","text":"
    • Skip the first prompt of pdm init #352
    "},{"location":"dev/changelog/#bug-fixes_108","title":"Bug Fixes","text":"
    • Fix a test failure when using homebrew installed python. #348
    • Get revision from the VCS URL if source code isn't downloaded to local. #349
    "},{"location":"dev/changelog/#dependencies_19","title":"Dependencies","text":"
    • Update dependency pdm-pep517 to 0.6.1. #353
    "},{"location":"dev/changelog/#release-v144-2021-03-27","title":"Release v1.4.4 (2021-03-27)","text":""},{"location":"dev/changelog/#features-improvements_63","title":"Features & Improvements","text":"
    • Emit warning if version or description can't be retrieved when importing from flit metadata. #342
    • Add type argument to pdm cache clear and improve its UI. #343
    • Always re-install the editable packages when syncing the working set. This can help tracking the latest change of entry-points. #344
    "},{"location":"dev/changelog/#bug-fixes_109","title":"Bug Fixes","text":"
    • Make installer quit early if a wheel isn't able to build. #338
    "},{"location":"dev/changelog/#miscellany_14","title":"Miscellany","text":"
    • ignore type checking in models.project_info.ProjectInfo, which indexes distlib.metadata._data #335
    "},{"location":"dev/changelog/#release-v143-2021-03-24","title":"Release v1.4.3 (2021-03-24)","text":""},{"location":"dev/changelog/#features-improvements_64","title":"Features & Improvements","text":"
    • Change the group name of entry points from pdm.plugins to pdm. Export some useful objects and models for shorter import path. #318
    • Field cmd in tools.pdm.scripts configuration items now allows specifying an argument array instead of a string.
    • Refactor: Remove the reference of stream singleton, improve the UI related code. #320
    • Support dependencies managed by poetry and flit being installed as editable packages. #324
    • Refactor: Extract the logic of finding interpreters to method for the sake of subclass overriding. #326
    • Complete the cache command, add list, remove and info subcommands. #329
    • Refactor: Unify the code about selecting interpreter to reduce the duplication. #331
    • Retrieve the version and description of a flit project by parsing the AST of the main file. #333
    "},{"location":"dev/changelog/#bug-fixes_110","title":"Bug Fixes","text":"
    • Fix a parsing error when non-ascii characters exist in pyproject.toml. #308
    • Fix a bug that non-editable VCS candidates can't satisfy their requirements once locked in the lock file. #314
    • Fix a bug of import-on-init that fails when requirements.txt is detected. #328
    "},{"location":"dev/changelog/#miscellany_15","title":"Miscellany","text":"
    • refactor pdm.iostream to improve 'typing' support #301
    • fix some typos #323
    "},{"location":"dev/changelog/#release-v142-2021-03-18","title":"Release v1.4.2 (2021-03-18)","text":""},{"location":"dev/changelog/#features-improvements_65","title":"Features & Improvements","text":"
    • Refactor the code, extract the version related logic from specifiers.py to a separated module. #303
    "},{"location":"dev/changelog/#bug-fixes_111","title":"Bug Fixes","text":"
    • Fix a bug that get_dependencies() returns error when the setup.py has no intall_requires key. #299
    • Pin the VCS revision for non-editable VCS candidates in the lock file. #305
    • Fix a bug that editable build hits the cached wheel unexpectedly. #307
    "},{"location":"dev/changelog/#miscellany_16","title":"Miscellany","text":"
    • replace 'typing comments' with type annotations throughout #298
    "},{"location":"dev/changelog/#release-v141-2021-03-12","title":"Release v1.4.1 (2021-03-12)","text":""},{"location":"dev/changelog/#features-improvements_66","title":"Features & Improvements","text":"
    • Support importing dependencies from requirements.txt to dev-dependencies or sections. #291
    "},{"location":"dev/changelog/#bug-fixes_112","title":"Bug Fixes","text":"
    • Fallback to static parsing when building was failed to find the dependencies of a candidate. #293
    • Fix a bug that pdm init fails when pyproject.toml exists but has no [project] section. #295
    "},{"location":"dev/changelog/#improved-documentation_11","title":"Improved Documentation","text":"
    • Document about how to use PDM with Nox. #281
    "},{"location":"dev/changelog/#release-v140-2021-03-05","title":"Release v1.4.0 (2021-03-05)","text":""},{"location":"dev/changelog/#features-improvements_67","title":"Features & Improvements","text":"
    • When -I/--ignore-python passed or PDM_IGNORE_SAVED_PYTHON=1, ignore the interpreter set in .pdm.toml and don't save to it afterwards. #283
    • A new option -p/--project is introduced to specify another path for the project base. It can also be combined with -g/--global option. The latter is changed to a flag only option that does not accept values. #286
    • Support -f setuppy for pdm export to export the metadata as setup.py #289
    "},{"location":"dev/changelog/#bug-fixes_113","title":"Bug Fixes","text":"
    • Fix a bug that editable local package requirements cannot be parsed rightly. #285
    • Change the priority of metadata files to parse so that PEP 621 metadata will be parsed first. #288
    "},{"location":"dev/changelog/#improved-documentation_12","title":"Improved Documentation","text":"
    • Add examples of how to integrate with CI pipelines (and tox). #281
    "},{"location":"dev/changelog/#release-v134-2021-03-01","title":"Release v1.3.4 (2021-03-01)","text":""},{"location":"dev/changelog/#improved-documentation_13","title":"Improved Documentation","text":"
    • added documentation on a task provider for vscode #280
    "},{"location":"dev/changelog/#bug-fixes_114","title":"Bug Fixes","text":"
    • Ignore the python requires constraints when fetching the link from the PyPI index.
    "},{"location":"dev/changelog/#release-v133-2021-02-26","title":"Release v1.3.3 (2021-02-26)","text":""},{"location":"dev/changelog/#bug-fixes_115","title":"Bug Fixes","text":"
    • Fix the requirement string of a VCS requirement to comply with PEP 508. #275
    • Fix a bug that editable packages with src directory can't be uninstalled correctly. #277
    • Fix a bug that editable package doesn't override the non-editable version in the working set. #278
    "},{"location":"dev/changelog/#release-v132-2021-02-25","title":"Release v1.3.2 (2021-02-25)","text":""},{"location":"dev/changelog/#features-improvements_68","title":"Features & Improvements","text":"
    • Abort and tell user the selected section following pdm sync or pdm install is not present in the error message. #274
    "},{"location":"dev/changelog/#bug-fixes_116","title":"Bug Fixes","text":"
    • Fix a bug that candidates' sections cannot be retrieved rightly when circular dependencies exist. #270
    • Don't pass the help argument into the run script method. #272
    "},{"location":"dev/changelog/#release-v131-2021-02-19","title":"Release v1.3.1 (2021-02-19)","text":""},{"location":"dev/changelog/#bug-fixes_117","title":"Bug Fixes","text":"
    • Use the absolute path when importing from a Poetry pyproject.toml. #262
    • Fix a bug that old toml table head is kept when converting to PEP 621 metadata format. #263
    • Postpone the evaluation of requires-python attribute when fetching the candidates of a package. #264
    "},{"location":"dev/changelog/#release-v130-2021-02-09","title":"Release v1.3.0 (2021-02-09)","text":""},{"location":"dev/changelog/#features-improvements_69","title":"Features & Improvements","text":"
    • Increase the default value of the max rounds of resolution to 1000, make it configurable. #238
    • Rewrite the project's egg-info directory when dependencies change. So that pdm list --graph won't show invalid entries. #240
    • When importing requirements from a requirements.txt file, build the package to find the name if not given in the URL. #245
    • When initializing the project, prompt user for whether the project is a library, and give empty name and version if not. #253
    "},{"location":"dev/changelog/#bug-fixes_118","title":"Bug Fixes","text":"
    • Fix the version validator of wheel metadata to align with the implementation of packaging. #130
    • Preserve the sections value of a pinned candidate to be reused. #234
    • Strip spaces in user input when prompting for the python version to use. #252
    • Fix the version parsing of Python requires to allow >, >=, <, <= to combine with star versions. #254
    "},{"location":"dev/changelog/#release-v120-2021-01-26","title":"Release v1.2.0 (2021-01-26)","text":""},{"location":"dev/changelog/#features-improvements_70","title":"Features & Improvements","text":"
    • Change the behavior of --save-compatible slightly. Now the version specifier saved is using the REAL compatible operator ~= as described in PEP 440. Before: requests<3.0.0,>=2.19.1, After: requests~=2.19. The new specifier accepts requests==2.19.0 as compatible version. #225
    • Environment variable ${PROJECT_ROOT} in the dependency specification can be expanded to refer to the project root in pyproject.toml. The environment variables will be kept as they are in the lock file. #226
    • Change the dependencies of a package in the lock file to a list of PEP 508 strings #236
    "},{"location":"dev/changelog/#bug-fixes_119","title":"Bug Fixes","text":"
    • Ignore user's site and PYTHONPATH(with python -I mode) when executing pip commands. #231
    "},{"location":"dev/changelog/#improved-documentation_14","title":"Improved Documentation","text":"
    • Document about how to activate and use a plugin. #227
    "},{"location":"dev/changelog/#dependencies_20","title":"Dependencies","text":"
    • Test project on pip 21.0. #235
    "},{"location":"dev/changelog/#release-v110-2021-01-18","title":"Release v1.1.0 (2021-01-18)","text":""},{"location":"dev/changelog/#features-improvements_71","title":"Features & Improvements","text":"
    • Allow users to hide secrets from the pyproject.toml.
    • Dynamically expand env variables in the URLs in dependencies and indexes.
    • Ask whether to store the credentials provided by the user.
    • A user-friendly error will show when credentials are not provided nor correct. #198
    • Use a different package dir for 32-bit installation(Windows). #212
    • Auto disable PEP 582 when a venv-like python is given as the interpreter path. #219
    • Support specifying Python interpreter by pdm use <path-to-python-root>. #221
    "},{"location":"dev/changelog/#bug-fixes_120","title":"Bug Fixes","text":"
    • Fix a bug of PYTHONPATH manipulation under Windows platform. #215
    "},{"location":"dev/changelog/#removals-and-deprecations_13","title":"Removals and Deprecations","text":"
    • Remove support of the old PEP 517 backend API path. #217
    "},{"location":"dev/changelog/#release-v100-2021-01-05","title":"Release v1.0.0 (2021-01-05)","text":""},{"location":"dev/changelog/#bug-fixes_121","title":"Bug Fixes","text":"
    • Correctly build wheels for dependencies with build-requirements but without a specified build-backend #213
    "},{"location":"dev/changelog/#release-v100b2-2020-12-29","title":"Release v1.0.0b2 (2020-12-29)","text":""},{"location":"dev/changelog/#features-improvements_72","title":"Features & Improvements","text":"
    • Fallback to pypi.org when /search endpoint is not available on given index. #211
    "},{"location":"dev/changelog/#bug-fixes_122","title":"Bug Fixes","text":"
    • Fix a bug that PDM fails to parse python version specifiers with more than 3 parts. #210
    "},{"location":"dev/changelog/#release-v100b0-2020-12-24","title":"Release v1.0.0b0 (2020-12-24)","text":""},{"location":"dev/changelog/#features-improvements_73","title":"Features & Improvements","text":"
    • Fully support of PEP 621 specification.
    • Old format is deprecated at the same time.
    • PDM will migrate the project file for you when old format is detected.
    • Other metadata formats(Poetry, Pipfile, flit) can also be imported as PEP 621 metadata. #175
    • Re-implement the pdm search to query the /search HTTP endpoint. #195
    • Reuse the cached built wheels to accelerate the installation. #200
    • Make update strategy and save strategy configurable in pdm config. #202
    • Improve the error message to give more insight on what to do when resolution fails. #207
    • Set classifiers dynamic in pyproject.toml template for autogeneration. #209
    "},{"location":"dev/changelog/#bug-fixes_123","title":"Bug Fixes","text":"
    • Fix a bug that distributions are not removed clearly in parallel mode. #204
    • Fix a bug that python specifier is_subset() returns incorrect result. #206
    "},{"location":"dev/changelog/#release-v0123-2020-12-21","title":"Release v0.12.3 (2020-12-21)","text":""},{"location":"dev/changelog/#dependencies_21","title":"Dependencies","text":"
    • Pin pdm-pep517 to <0.3.0, this is the last version to support legacy project metadata format.
    "},{"location":"dev/changelog/#release-v0122-2020-12-17","title":"Release v0.12.2 (2020-12-17)","text":""},{"location":"dev/changelog/#features-improvements_74","title":"Features & Improvements","text":"
    • Update the lock file schema, move the file hashes to [metadata.files] table. #196
    • Retry failed jobs when syncing packages. #197
    "},{"location":"dev/changelog/#removals-and-deprecations_14","title":"Removals and Deprecations","text":"
    • Drop pip-shims package as a dependency. #132
    "},{"location":"dev/changelog/#miscellany_17","title":"Miscellany","text":"
    • Fix the cache path for CI. #199
    "},{"location":"dev/changelog/#release-v0121-2020-12-14","title":"Release v0.12.1 (2020-12-14)","text":""},{"location":"dev/changelog/#features-improvements_75","title":"Features & Improvements","text":"
    • Provide an option to export requirements from pyproject.toml #190
    • For Windows users, pdm --pep582 can enable PEP 582 globally by manipulating the WinReg. #191
    "},{"location":"dev/changelog/#bug-fixes_124","title":"Bug Fixes","text":"
    • Inject __pypackages__ into PATH env var during pdm run. #193
    "},{"location":"dev/changelog/#release-v0120-2020-12-08","title":"Release v0.12.0 (2020-12-08)","text":""},{"location":"dev/changelog/#features-improvements_76","title":"Features & Improvements","text":"
    • Improve the user experience of pdm run:
    • Add a special key in tool.pdm.scripts that holds configurations shared by all scripts.
    • Support loading env var from a dot-env file.
    • Add a flag -s/--site-packages to include system site-packages when running. #178
    • Now PEP 582 can be enabled in the Python interpreter directly! #181
    "},{"location":"dev/changelog/#bug-fixes_125","title":"Bug Fixes","text":"
    • Ensure setuptools is installed before invoking editable install script. #174
    • Require wheel not wheels for global projects #182
    • Write a sitecustomize.py instead of a .pth file to enable PEP 582. Thanks @Aloxaf. Update get_package_finder() to be compatible with pip 20.3. #185
    • Fix the help messages of commands \"cache\" and \"remove\" #187
    "},{"location":"dev/changelog/#release-v0110-2020-11-20","title":"Release v0.11.0 (2020-11-20)","text":""},{"location":"dev/changelog/#features-improvements_77","title":"Features & Improvements","text":"
    • Support custom script shortcuts in pyproject.toml.
    • Support custom script shortcuts defined in [tool.pdm.scripts] section.
    • Add pdm run --list/-l to show the list of script shortcuts. #168
    • Patch the halo library to support parallel spinners.
    • Change the looking of pdm install. #169
    "},{"location":"dev/changelog/#bug-fixes_126","title":"Bug Fixes","text":"
    • Fix a bug that package's marker fails to propagate to its grandchildren if they have already been resolved. #170
    • Fix a bug that bare version specifiers in Poetry project can't be converted correctly. #172
    • Fix the build error that destination directory is not created automatically. #173
    "},{"location":"dev/changelog/#release-v0102-2020-11-05","title":"Release v0.10.2 (2020-11-05)","text":""},{"location":"dev/changelog/#bug-fixes_127","title":"Bug Fixes","text":"
    • Building editable distribution does not install build-system.requires anymore. #167
    "},{"location":"dev/changelog/#release-v0101-2020-11-04","title":"Release v0.10.1 (2020-11-04)","text":""},{"location":"dev/changelog/#bug-fixes_128","title":"Bug Fixes","text":"
    • Switch the PEP 517 build frontend from build to a home-grown version. #162
    • Synchronize the output of LogWrapper. #164
    • Fix a bug that is_subset and is_superset may return wrong result when wildcard excludes overlaps with the upper bound. #165
    "},{"location":"dev/changelog/#release-v0100-2020-10-20","title":"Release v0.10.0 (2020-10-20)","text":""},{"location":"dev/changelog/#features-improvements_78","title":"Features & Improvements","text":"
    • Change to Git style config command. #157
    • Add a command to generate scripts for autocompletion, which is backed by pycomplete. #159
    "},{"location":"dev/changelog/#bug-fixes_129","title":"Bug Fixes","text":"
    • Fix a bug that sitecustomize.py incorrectly gets injected into the editable console scripts. #158
    "},{"location":"dev/changelog/#release-v092-2020-10-13","title":"Release v0.9.2 (2020-10-13)","text":""},{"location":"dev/changelog/#features-improvements_79","title":"Features & Improvements","text":"
    • Cache the built wheels to accelerate resolution and installation process. #153
    "},{"location":"dev/changelog/#bug-fixes_130","title":"Bug Fixes","text":"
    • Fix a bug that no wheel is matched when finding candidates to install. #155
    • Fix a bug that installation in parallel will cause encoding initialization error on Ubuntu. #156
    "},{"location":"dev/changelog/#release-v091-2020-10-13","title":"Release v0.9.1 (2020-10-13)","text":""},{"location":"dev/changelog/#features-improvements_80","title":"Features & Improvements","text":"
    • Display plain text instead of spinner bar under verbose mode. #150
    "},{"location":"dev/changelog/#bug-fixes_131","title":"Bug Fixes","text":"
    • Fix a bug that the result of find_matched() is exhausted when accessed twice. #149
    "},{"location":"dev/changelog/#release-v090-2020-10-08","title":"Release v0.9.0 (2020-10-08)","text":""},{"location":"dev/changelog/#features-improvements_81","title":"Features & Improvements","text":"
    • Allow users to combine several dependency sections to form an extra require. #131
    • Split the PEP 517 backend to its own(battery included) package. #134
    • Add a new option to list command to show reverse dependency graph. #137
    "},{"location":"dev/changelog/#bug-fixes_132","title":"Bug Fixes","text":"
    • Fix a bug that spaces in path causes requirement parsing error. #138
    • Fix a bug that requirement's python constraint is not respected when resolving. #141
    "},{"location":"dev/changelog/#dependencies_22","title":"Dependencies","text":"
    • Update pdm-pep517 to 0.2.0 that supports reading version from SCM. #146
    "},{"location":"dev/changelog/#miscellany_18","title":"Miscellany","text":"
    • Add Python 3.9 to the CI version matrix to verify. #144
    "},{"location":"dev/changelog/#release-v087-2020-09-04","title":"Release v0.8.7 (2020-09-04)","text":""},{"location":"dev/changelog/#bug-fixes_133","title":"Bug Fixes","text":"
    • Fix a compatibility issue with wheel==0.35. #135
    "},{"location":"dev/changelog/#release-v086-2020-07-09","title":"Release v0.8.6 (2020-07-09)","text":""},{"location":"dev/changelog/#bug-fixes_134","title":"Bug Fixes","text":"
    • Fix a bug that extra sources are not respected when fetching distributions. #127
    "},{"location":"dev/changelog/#release-v085-2020-06-24","title":"Release v0.8.5 (2020-06-24)","text":""},{"location":"dev/changelog/#bug-fixes_135","title":"Bug Fixes","text":"
    • Fix a bug that pdm export fails when the project doesn't have name property. #126
    "},{"location":"dev/changelog/#dependencies_23","title":"Dependencies","text":"
    • Upgrade dependency pip to 20.1. #125
    "},{"location":"dev/changelog/#release-v084-2020-05-21","title":"Release v0.8.4 (2020-05-21)","text":""},{"location":"dev/changelog/#features-improvements_82","title":"Features & Improvements","text":"
    • Add a new command export to export to alternative formats. #117
    "},{"location":"dev/changelog/#miscellany_19","title":"Miscellany","text":"
    • Add Dockerfile and pushed to Docker Hub. #122
    "},{"location":"dev/changelog/#release-v083-2020-05-15","title":"Release v0.8.3 (2020-05-15)","text":""},{"location":"dev/changelog/#bug-fixes_136","title":"Bug Fixes","text":"
    • Fix the version constraint parsing of wheel metadata. #120
    "},{"location":"dev/changelog/#release-v082-2020-05-03","title":"Release v0.8.2 (2020-05-03)","text":""},{"location":"dev/changelog/#bug-fixes_137","title":"Bug Fixes","text":"
    • Update resolvers to resolvelib 0.4.0. #118
    "},{"location":"dev/changelog/#release-v081-2020-04-22","title":"Release v0.8.1 (2020-04-22)","text":""},{"location":"dev/changelog/#dependencies_24","title":"Dependencies","text":"
    • Switch to upstream resolvelib 0.3.0. #116
    "},{"location":"dev/changelog/#release-v080-2020-04-20","title":"Release v0.8.0 (2020-04-20)","text":""},{"location":"dev/changelog/#features-improvements_83","title":"Features & Improvements","text":"
    • Add a new command to search for packages #111
    • Add show command to show package metadata. #114
    "},{"location":"dev/changelog/#bug-fixes_138","title":"Bug Fixes","text":"
    • Fix a bug that environment markers cannot be evaluated correctly if extras are connected with \"or\". #107
    • Don't consult PyPI JSON API by default for package metadata. #112
    • Eliminate backslashes in markers for TOML documents. #115
    "},{"location":"dev/changelog/#release-v071-2020-04-13","title":"Release v0.7.1 (2020-04-13)","text":""},{"location":"dev/changelog/#bug-fixes_139","title":"Bug Fixes","text":"
    • Editable packages requires setuptools to be installed in the isolated environment.
    "},{"location":"dev/changelog/#release-v070-2020-04-12","title":"Release v0.7.0 (2020-04-12)","text":""},{"location":"dev/changelog/#features-improvements_84","title":"Features & Improvements","text":"
    • Disable loading of site-packages under PEP 582 mode. #100
    "},{"location":"dev/changelog/#bug-fixes_140","title":"Bug Fixes","text":"
    • Fix a bug that TOML parsing error is not correctly captured. #101
    • Fix a bug of building wheels with C extensions that the platform in file name is incorrect. #99
    "},{"location":"dev/changelog/#release-v065-2020-04-07","title":"Release v0.6.5 (2020-04-07)","text":""},{"location":"dev/changelog/#bug-fixes_141","title":"Bug Fixes","text":"
    • Unix style executable script suffix is missing.
    "},{"location":"dev/changelog/#release-v064-2020-04-07","title":"Release v0.6.4 (2020-04-07)","text":""},{"location":"dev/changelog/#features-improvements_85","title":"Features & Improvements","text":"
    • Update shebang lines in the executable scripts when doing pdm use. #96
    • Auto-detect commonly used venv directories. #97
    "},{"location":"dev/changelog/#release-v063-2020-03-30","title":"Release v0.6.3 (2020-03-30)","text":""},{"location":"dev/changelog/#bug-fixes_142","title":"Bug Fixes","text":"
    • Fix a bug of moving files across different file system. #95
    "},{"location":"dev/changelog/#release-v062-2020-03-29","title":"Release v0.6.2 (2020-03-29)","text":""},{"location":"dev/changelog/#bug-fixes_143","title":"Bug Fixes","text":"
    • Validate user input for python_requires when initializing project. #89
    • Ensure wheel package is available before building packages. #90
    • Fix an issue of remove command that will unexpectedly uninstall packages in default section. #92
    "},{"location":"dev/changelog/#dependencies_25","title":"Dependencies","text":"
    • Update dependencies pythonfinder, python-cfonts, pip-shims and many others. Drop dependency vistir. #89
    "},{"location":"dev/changelog/#release-v061-2020-03-25","title":"Release v0.6.1 (2020-03-25)","text":""},{"location":"dev/changelog/#features-improvements_86","title":"Features & Improvements","text":"
    • Redirect output messages to log file for installation and locking. #84
    "},{"location":"dev/changelog/#bug-fixes_144","title":"Bug Fixes","text":"
    • Fix a bug that parallel installation fails due to setuptools reinstalling. #83
    "},{"location":"dev/changelog/#release-v060-2020-03-20","title":"Release v0.6.0 (2020-03-20)","text":""},{"location":"dev/changelog/#features-improvements_87","title":"Features & Improvements","text":"
    • Support specifying build script for C extensions. #23
    • Add test cases for pdm build. #81
    • Make it configurable whether to consult PyPI JSON API since it may be not trustable.
    • Support parallel installation.
    • Add new command pmd import to import project metadata from Pipfile, poetry, flit, requirements.txt. #79
    • pdm init and pdm install will auto-detect possible files that can be imported.
    "},{"location":"dev/changelog/#bug-fixes_145","title":"Bug Fixes","text":"
    • Fix wheel builds when package_dir is mapped. #81
    • pdm init will use the current directory rather than finding the parents when global project is not activated.
    "},{"location":"dev/changelog/#release-v050-2020-03-14","title":"Release v0.5.0 (2020-03-14)","text":""},{"location":"dev/changelog/#features-improvements_88","title":"Features & Improvements","text":"
    • Introduce a super easy-to-extend plug-in system to PDM. #75
    "},{"location":"dev/changelog/#improved-documentation_15","title":"Improved Documentation","text":"
    • Documentation on how to write a plugin. #75
    "},{"location":"dev/changelog/#bug-fixes_146","title":"Bug Fixes","text":"
    • Fix a typo in metadata parsing from plugins to entry_points
    "},{"location":"dev/changelog/#release-v042-2020-03-13","title":"Release v0.4.2 (2020-03-13)","text":""},{"location":"dev/changelog/#features-improvements_89","title":"Features & Improvements","text":"
    • Refactor the CLI part, switch from click to argparse, for better extensibility. #73
    • Allow users to configure to install packages into venv when it is activated. #74
    "},{"location":"dev/changelog/#release-v041-2020-03-11","title":"Release v0.4.1 (2020-03-11)","text":""},{"location":"dev/changelog/#features-improvements_90","title":"Features & Improvements","text":"
    • Add a minimal dependency set for global project. #72
    "},{"location":"dev/changelog/#release-v040-2020-03-10","title":"Release v0.4.0 (2020-03-10)","text":""},{"location":"dev/changelog/#features-improvements_91","title":"Features & Improvements","text":"
    • Global project support
    • Add a new option -g/--global to manage global project. The default location is at ~/.pdm/global-project.
    • Use the virtualenv interpreter when detected inside an activated venv.
    • Add a new option -p/--project to select project root other than the default one. #30
    • Add a new command pdm config del to delete an existing config item. #71
    "},{"location":"dev/changelog/#bug-fixes_147","title":"Bug Fixes","text":"
    • Fix a URL parsing issue that username will be dropped in the SSH URL. #68
    "},{"location":"dev/changelog/#improved-documentation_16","title":"Improved Documentation","text":"
    • Add docs for global project and selecting project path. #30
    "},{"location":"dev/changelog/#release-v032-2020-03-08","title":"Release v0.3.2 (2020-03-08)","text":""},{"location":"dev/changelog/#features-improvements_92","title":"Features & Improvements","text":"
    • Display all available Python interpreters if users don't give one in pdm init. #67
    "},{"location":"dev/changelog/#bug-fixes_148","title":"Bug Fixes","text":"
    • Regard 4.0 as infinite upper bound when checking subsetting. #66
    "},{"location":"dev/changelog/#release-v031-2020-03-07","title":"Release v0.3.1 (2020-03-07)","text":""},{"location":"dev/changelog/#bug-fixes_149","title":"Bug Fixes","text":"
    • Fix a bug that ImpossiblePySpec's hash clashes with normal one.
    "},{"location":"dev/changelog/#release-v030-2020-02-28","title":"Release v0.3.0 (2020-02-28)","text":""},{"location":"dev/changelog/#features-improvements_93","title":"Features & Improvements","text":"
    • Add a new command pdm config to inspect configurations. #26
    • Add a new command pdm cache clear to clean caches. #63
    "},{"location":"dev/changelog/#bug-fixes_150","title":"Bug Fixes","text":"
    • Correctly show dependency graph when circular dependencies exist. #62
    "},{"location":"dev/changelog/#improved-documentation_17","title":"Improved Documentation","text":"
    • Write the initial documentation for PDM. #14
    "},{"location":"dev/changelog/#release-v026-2020-02-25","title":"Release v0.2.6 (2020-02-25)","text":""},{"location":"dev/changelog/#features-improvements_94","title":"Features & Improvements","text":"
    • Improve the user interface of selecting Python interpreter. #54
    "},{"location":"dev/changelog/#bug-fixes_151","title":"Bug Fixes","text":"
    • Fix the wheel installer to correctly unparse the flags of console scripts. #56
    • Fix a bug that OS-dependent hashes are not saved. #57
    "},{"location":"dev/changelog/#release-v025-2020-02-22","title":"Release v0.2.5 (2020-02-22)","text":""},{"location":"dev/changelog/#features-improvements_95","title":"Features & Improvements","text":"
    • Allow specifying Python interpreter via --python option in pdm init. #49
    • Set python_requires when initializing and defaults to >={current_version}. #50
    "},{"location":"dev/changelog/#bug-fixes_152","title":"Bug Fixes","text":"
    • Always consider wheels before tarballs; correctly merge markers from different parents. #47
    • Filter out incompatible wheels when installing. #48
    "},{"location":"dev/changelog/#release-v024-2020-02-21","title":"Release v0.2.4 (2020-02-21)","text":""},{"location":"dev/changelog/#bug-fixes_153","title":"Bug Fixes","text":"
    • Use the project local interpreter to build wheels. #43
    • Correctly merge Python specifiers when possible. #4
    "},{"location":"dev/changelog/#release-v023-2020-02-21","title":"Release v0.2.3 (2020-02-21)","text":""},{"location":"dev/changelog/#bug-fixes_154","title":"Bug Fixes","text":"
    • Fix a bug that editable build generates a malformed setup.py.
    "},{"location":"dev/changelog/#release-v022-2020-02-20","title":"Release v0.2.2 (2020-02-20)","text":""},{"location":"dev/changelog/#features-improvements_96","title":"Features & Improvements","text":"
    • Add a fancy greeting banner when user types pdm --help. #42
    "},{"location":"dev/changelog/#bug-fixes_155","title":"Bug Fixes","text":"
    • Fix the RECORD file in built wheel. #41
    "},{"location":"dev/changelog/#dependencies_26","title":"Dependencies","text":"
    • Add dependency python-cfonts to display banner. #42
    "},{"location":"dev/changelog/#release-v021-2020-02-18","title":"Release v0.2.1 (2020-02-18)","text":""},{"location":"dev/changelog/#bug-fixes_156","title":"Bug Fixes","text":"
    • Fix a bug that short python_version markers can't be parsed correctly. #38
    • Make _editable_intall.py compatible with Py2.
    "},{"location":"dev/changelog/#release-v020-2020-02-14","title":"Release v0.2.0 (2020-02-14)","text":""},{"location":"dev/changelog/#features-improvements_97","title":"Features & Improvements","text":"
    • New option: pdm list --graph to show a dependency graph of the working set. #10
    • New option: pdm update --unconstrained to ignore the version constraint of given packages. #13
    • Improve the error message when project is not initialized before running commands. #19
    • Pinned candidates in lock file are reused when relocking during pdm install. #33
    • Use the pyenv interpreter value if pyenv is installed. #36
    • Introduce a new command pdm info to show project environment information. #9
    "},{"location":"dev/changelog/#bug-fixes_157","title":"Bug Fixes","text":"
    • Fix a bug that candidate hashes will be lost when reused. #11
    "},{"location":"dev/changelog/#dependencies_27","title":"Dependencies","text":"
    • Update pip to 20.0, update pip_shims to 0.5.0. #28
    "},{"location":"dev/changelog/#miscellany_20","title":"Miscellany","text":"
    • Add a script named setup_dev.py for the convenience to setup pdm for development. #29
    "},{"location":"dev/changelog/#release-v012-2020-02-09","title":"Release v0.1.2 (2020-02-09)","text":""},{"location":"dev/changelog/#features","title":"Features","text":"
    • New command pdm use to switch python versions. #8
    • New option pdm list --graph to show a dependency graph. #10
    • Read metadata from lockfile when pinned candidate is reused.
    "},{"location":"dev/changelog/#release-v011-2020-02-07","title":"Release v0.1.1 (2020-02-07)","text":""},{"location":"dev/changelog/#features_1","title":"Features","text":"
    • Get version from the specified file. #6
    • Add column header to pdm list output.
    "},{"location":"dev/changelog/#release-v010-2020-02-07","title":"Release v0.1.0 (2020-02-07)","text":""},{"location":"dev/changelog/#bugfixes","title":"Bugfixes","text":"
    • Pass exit code to parent process in pdm run.
    • Fix error handling for CLI. #19
    "},{"location":"dev/changelog/#miscellany_21","title":"Miscellany","text":"
    • Refactor the installer mocking for tests.
    "},{"location":"dev/changelog/#release-v005-2020-01-22","title":"Release v0.0.5 (2020-01-22)","text":""},{"location":"dev/changelog/#improvements","title":"Improvements","text":"
    • Ensure pypi index url is fetched in addition to the source settings. #3
    "},{"location":"dev/changelog/#bugfixes_1","title":"Bugfixes","text":"
    • Fix an issue that leading \"c\"s are mistakenly stripped. #5
    • Fix an error with PEP 517 building.
    "},{"location":"dev/changelog/#release-v004-2020-01-22","title":"Release v0.0.4 (2020-01-22)","text":""},{"location":"dev/changelog/#improvements_1","title":"Improvements","text":"
    • Fix editable installation, now editable scripts can also be executed from outside!
    • Content hash is calculated based on dependencies and sources, not other metadata.
    "},{"location":"dev/changelog/#bugfixes_2","title":"Bugfixes","text":"
    • Fix an issue that editable distributions can not be removed.
    "},{"location":"dev/changelog/#release-v003-2020-01-22","title":"Release v0.0.3 (2020-01-22)","text":""},{"location":"dev/changelog/#features_2","title":"Features","text":"
    • Add pdm init to bootstrap a project.
    "},{"location":"dev/changelog/#release-v002-2020-01-22","title":"Release v0.0.2 (2020-01-22)","text":""},{"location":"dev/changelog/#features_3","title":"Features","text":"
    • A complete functioning PEP 517 build backend.
    • pdm build command.
    "},{"location":"dev/changelog/#miscellany_22","title":"Miscellany","text":"
    • Add a Chinese README
    "},{"location":"dev/changelog/#features_4","title":"Features","text":"
    • Add pdm init to bootstrap a project.
    "},{"location":"dev/changelog/#release-v001-2020-01-20","title":"Release v0.0.1 (2020-01-20)","text":""},{"location":"dev/changelog/#features_5","title":"Features","text":"
    • A dependency resolver that just works.
    • A PEP 582 installer.
    • PEP 440 version specifiers.
    • PEP 508 environment markers.
    • Running scripts with PEP 582 local packages.
    • Console scripts are injected with local paths.
    • A neat CLI.
    • add, lock, list, update, remove commands.
    • PEP 517 build backends.
    • Continuous Integration.
    "},{"location":"dev/contributing/","title":"Contributing to PDM","text":"

    First off, thanks for taking the time to contribute! Contributions include but are not restricted to:

    • Reporting bugs
    • Contributing to code
    • Writing tests
    • Writing documentation

    The following is a set of guidelines for contributing.

    "},{"location":"dev/contributing/#a-recommended-flow-of-contributing-to-an-open-source-project","title":"A recommended flow of contributing to an Open Source project","text":"

    This section is for beginners to OSS. If you are an experienced OSS developer, you can skip this section.

    1. First, fork this project to your own namespace using the fork button at the top right of the repository page.
    2. Clone the upstream repository to local:
      git clone https://github.com/pdm-project/pdm.git\n# Or if you prefer SSH clone:\ngit clone git@github.com:pdm-project/pdm.git\n
    3. Add the fork as a new remote:
      git remote add fork https://github.com/yourname/pdm.git\ngit fetch fork\n
      where fork is the remote name of the fork repository.

    ProTips:

    1. Don't modify code on the main branch, the main branch should always keep track of origin/main.

    To update main branch to date:

    git pull origin main\n# In rare cases that your local main branch diverges from the remote main:\ngit fetch origin && git reset --hard main\n
    1. Create a new branch based on the up-to-date main branch for new patches.
    2. Create a Pull Request from that patch branch.
    "},{"location":"dev/contributing/#local-development","title":"Local development","text":"

    We recommend working in a virtual environment. Feel free to create a virtual environment with either the venv module or the virtualenv tool. For example:

    python -m venv .venv\n. .venv/bin/activate  # linux\n.venv/Scripts/activate  # windows\n

    Make sure your pip is newer than 21.3 to install PDM in develop/editable mode.

    python -m pip install -U \"pip>=21.3\"\npython -m pip install -e .\n

    Make sure PDM uses the virtual environment you just created:

    pdm config -l python.use_venv true\npdm config -l venv.in_project true\n

    Install PDM development dependencies:

    pdm install\n

    Now, all dependencies are installed into the Python environment you chose, which will be used for development after this point.

    "},{"location":"dev/contributing/#run-tests","title":"Run tests","text":"
    pdm run test\n

    The test suite is still simple and needs expansion! Please help write more test cases.

    Note

    You can also run your test suite against all supported Python version using tox with the tox-pdm plugin. You can either run it by yourself with:

    tox\n

    or from pdm with:

    pdm run tox\n
    "},{"location":"dev/contributing/#code-style","title":"Code style","text":"

    PDM uses pre-commit for linting. Install pre-commit first, for example with pip or pipx:

    python -m pip install pre-commit\n
    pipx install pre-commit\n

    Then initialize pre-commit:

    pre-commit install\n

    You can now lint the code with:

    pdm run lint\n

    PDM uses black for code style and isort for sorting import statements. If you are not following them, the CI will fail and your Pull Request will not be merged.

    "},{"location":"dev/contributing/#news-fragments","title":"News fragments","text":"

    When you make changes such as fixing a bug or adding a feature, you must add a news fragment describing your change. News fragments are placed in the news/ directory, and should be named according to this pattern: <issue_num>.<issue_type>.md (e.g., 566.bugfix.md).

    "},{"location":"dev/contributing/#issue-types","title":"Issue Types","text":"
    • feature: Features and improvements
    • bugfix: Bug fixes
    • refactor: Code restructures
    • doc: Added or improved documentation
    • dep: Changes to dependencies
    • removal: Removals or deprecations in the API
    • misc: Miscellaneous changes that don't fit any of the other categories

    The contents of the file should be a single sentence in the imperative mood that describes your changes. (e.g., Deduplicate the plugins list. ) See entries in the Change Log for more examples.

    "},{"location":"dev/contributing/#preview-the-documentation","title":"Preview the documentation","text":"

    If you make some changes to the docs/ and you want to preview the build result, simply do:

    pdm run doc\n
    "},{"location":"dev/contributing/#release","title":"Release","text":"

    Once all changes are done and ready to release, you can preview the changelog contents by running:

    pdm run release --dry-run\n

    Make sure the next version and the changelog are as expected in the output.

    Then cut a release on the main branch:

    pdm run release\n

    GitHub action will create the release and upload the distributions to PyPI.

    Read more options about version bumping by pdm run release --help.

    "},{"location":"dev/fixtures/","title":"Pytest fixtures","text":"

    Some reusable fixtures for pytest.

    New in version 2.4.0

    To enable them in your test, add pdm.pytest as a plugin. You can do so in your root conftest.py:

    conftest.py
    # single plugin\npytest_plugins = \"pytest.plugin\"\n\n# many plugins\npytest_plugins = [\n    ...\n    \"pdm.pytest\",\n    ...\n]\n
    "},{"location":"dev/fixtures/#pdm.pytest.IndexMap","title":"IndexMap = Dict[str, Path] module-attribute","text":"

    Path some root-relative http paths to some local paths

    "},{"location":"dev/fixtures/#pdm.pytest.IndexOverrides","title":"IndexOverrides = Dict[str, str] module-attribute","text":"

    PyPI indexes overrides fixture format

    "},{"location":"dev/fixtures/#pdm.pytest.IndexesDefinition","title":"IndexesDefinition = Dict[str, Union[Tuple[IndexMap, IndexOverrides, bool], IndexMap]] module-attribute","text":"

    Mock PyPI indexes format

    "},{"location":"dev/fixtures/#pdm.pytest.Distribution","title":"Distribution","text":"

    A mock Distribution

    "},{"location":"dev/fixtures/#pdm.pytest.LocalFileAdapter","title":"LocalFileAdapter","text":"

    Bases: requests.adapters.BaseAdapter

    A local file adapter for request.

    Allows to mock some HTTP requests with some local files

    "},{"location":"dev/fixtures/#pdm.pytest.MockWorkingSet","title":"MockWorkingSet","text":"

    Bases: collections.abc.MutableMapping

    A mock working set

    "},{"location":"dev/fixtures/#pdm.pytest.PDMCallable","title":"PDMCallable","text":"

    Bases: Protocol

    The PDM fixture callable signature

    "},{"location":"dev/fixtures/#pdm.pytest.PDMCallable.__call__","title":"__call__(args, strict=False, input=None, obj=None, env=None, **kwargs)","text":"

    Parameters:

    Name Type Description Default args str | list[str]

    the command arguments as a single lexable string or a strings array

    required strict bool

    raise an exception on failure instead of returning if enabled

    False input str | None

    an optional string to be submitted too stdin

    None obj Project | None

    an optional existing Project.

    None env Mapping[str, str] | None

    override the environment variables with those

    None

    Returns:

    Type Description RunResult

    The command result

    "},{"location":"dev/fixtures/#pdm.pytest.RunResult","title":"RunResult dataclass","text":"

    Store a command execution result.

    "},{"location":"dev/fixtures/#pdm.pytest.RunResult.exception","title":"exception: Exception | None = None instance-attribute class-attribute","text":"

    If set, the exception raised on execution

    "},{"location":"dev/fixtures/#pdm.pytest.RunResult.exit_code","title":"exit_code: int instance-attribute","text":"

    The execution exit code

    "},{"location":"dev/fixtures/#pdm.pytest.RunResult.output","title":"output: str property","text":"

    The execution stdout output (stdout alias)

    "},{"location":"dev/fixtures/#pdm.pytest.RunResult.outputs","title":"outputs: str property","text":"

    The execution stdout and stderr outputs concatenated

    "},{"location":"dev/fixtures/#pdm.pytest.RunResult.stderr","title":"stderr: str instance-attribute","text":"

    The execution stderr output

    "},{"location":"dev/fixtures/#pdm.pytest.RunResult.stdout","title":"stdout: str instance-attribute","text":"

    The execution stdout output

    "},{"location":"dev/fixtures/#pdm.pytest.RunResult.print","title":"print()","text":"

    A debugging facility

    "},{"location":"dev/fixtures/#pdm.pytest.TestRepository","title":"TestRepository","text":"

    Bases: BaseRepository

    A mock repository to ease testing dependencies

    "},{"location":"dev/fixtures/#pdm.pytest.build_env","title":"build_env(build_env_wheels, tmp_path_factory)","text":"

    A fixture build environment

    Parameters:

    Name Type Description Default build_env_wheels Iterable[Path]

    a list of wheel to install in the environment

    required

    Returns:

    Type Description Path

    The build environment temporary path

    "},{"location":"dev/fixtures/#pdm.pytest.build_env_wheels","title":"build_env_wheels()","text":"

    Expose some wheels to be installed in the build environment.

    Override to provide your owns.

    Returns:

    Type Description Iterable[Path]

    a list of wheels paths to install

    "},{"location":"dev/fixtures/#pdm.pytest.local_finder_artifacts","title":"local_finder_artifacts()","text":"

    The local finder search path as a fixture

    Override to provides your own artifacts.

    Returns:

    Type Description Path

    The path to the artifacts root

    "},{"location":"dev/fixtures/#pdm.pytest.pdm","title":"pdm(core, monkeypatch)","text":"

    A fixture allowing to execute PDM commands

    Returns:

    Type Description PDMCallable

    A pdm fixture command.

    "},{"location":"dev/fixtures/#pdm.pytest.project","title":"project(project_no_init)","text":"

    A fixture creating an initialized test project for the current test.

    Returns:

    Type Description Project

    The initialized project

    "},{"location":"dev/fixtures/#pdm.pytest.project_no_init","title":"project_no_init(tmp_path, mocker, core, pdm_session, monkeypatch, build_env)","text":"

    A fixture creating a non-initialized test project for the current test.

    Returns:

    Type Description Project

    The non-initialized project

    "},{"location":"dev/fixtures/#pdm.pytest.pypi_indexes","title":"pypi_indexes()","text":"

    Provides some mocked PyPI entries

    Returns:

    Type Description IndexesDefinition

    a definition of the mocked indexes

    "},{"location":"dev/fixtures/#pdm.pytest.remove_pep582_path_from_pythonpath","title":"remove_pep582_path_from_pythonpath(pythonpath)","text":"

    Remove all pep582 paths of PDM from PYTHONPATH

    "},{"location":"dev/fixtures/#pdm.pytest.repository","title":"repository(project, mocker, repository_pypi_json, local_finder)","text":"

    A fixture providing a mock PyPI repository

    Returns:

    Type Description TestRepository

    A mock repository

    "},{"location":"dev/fixtures/#pdm.pytest.repository_pypi_json","title":"repository_pypi_json()","text":"

    The test repository fake PyPI definition path as a fixture

    Override to provides your own definition path.

    Returns:

    Type Description Path

    The path to a fake PyPI repository JSON definition

    "},{"location":"dev/fixtures/#pdm.pytest.venv_backends","title":"venv_backends(project, request)","text":"

    A fixture iterating over venv backends

    "},{"location":"dev/fixtures/#pdm.pytest.working_set","title":"working_set(mocker, repository)","text":"

    a mock working set as a fixture

    Returns:

    Type Description MockWorkingSet

    a mock working set

    "},{"location":"dev/write/","title":"PDM Plugins","text":"

    PDM is aiming at being a community driven package manager. It is shipped with a full-featured plug-in system, with which you can:

    • Develop a new command for PDM
    • Add additional options to existing PDM commands
    • Change PDM's behavior by reading additional config items
    • Control the process of dependency resolution or installation
    "},{"location":"dev/write/#what-should-a-plugin-do","title":"What should a plugin do","text":"

    The core PDM project focuses on dependency management and package publishing. Other functionalities you wish to integrate with PDM are preferred to lie in their own plugins and released as standalone PyPI projects. In case the plugin is considered a good supplement of the core project it may have a chance to be absorbed into PDM.

    "},{"location":"dev/write/#write-your-own-plugin","title":"Write your own plugin","text":"

    In the following sections, I will show an example of adding a new command hello which reads the hello.name config.

    "},{"location":"dev/write/#write-the-command","title":"Write the command","text":"

    The PDM's CLI module is designed in a way that user can easily \"inherit and modify\". To write a new command:

    from pdm.cli.commands.base import BaseCommand\n\nclass HelloCommand(BaseCommand):\n\"\"\"Say hello to the specified person.\n    If none is given, will read from \"hello.name\" config.\n    \"\"\"\n\n    def add_arguments(self, parser):\n        parser.add_argument(\"-n\", \"--name\", help=\"the person's name to whom you greet\")\n\n    def handle(self, project, options):\n        if not options.name:\n            name = project.config[\"hello.name\"]\n        else:\n            name = options.name\n        print(f\"Hello, {name}\")\n

    First, let's create a new HelloCommand class inheriting from pdm.cli.commands.base.BaseCommand. It has two major functions:

    • add_arguments() to manipulate the argument parser passed as the only argument, where you can add additional command line arguments to it
    • handle() to do something when the subcommand is matched, you can do nothing by writing a single pass statement. It accepts two arguments: an pdm.project.Project object as the first one and the parsed argparse.Namespace object as the second.

    The document string will serve as the command help text, which will be shown in pdm --help.

    Besides, PDM's subcommand has two default options: -v/--verbose to change the verbosity level and -g/--global to enable global project. If you don't want these default options, override the arguments class attribute to a list of pdm.cli.options.Option objects, or assign it to an empty list to have no default options:

    class HelloCommand(BaseCommand):\n\narguments = []\n

    Note

    The default options are loaded first, then add_arguments() is called.

    "},{"location":"dev/write/#register-the-command-to-the-core-object","title":"Register the command to the core object","text":"

    Write a function somewhere in your plugin project. There is no limit on what the name of the function is, but the function should take only one argument -- the PDM core object:

    def hello_plugin(core):\ncore.register_command(HelloCommand, \"hello\")\n

    Call core.register_command() to register the command. The second argument as the name of the subcommand is optional. PDM will look for the HelloCommand's name attribute if the name is not passed.

    "},{"location":"dev/write/#add-a-new-config-item","title":"Add a new config item","text":"

    Let's recall the first code snippet, hello.name config key is consulted for the name if not passed via the command line.

    class HelloCommand(BaseCommand):\n\"\"\"Say hello to the specified person.\n    If none is given, will read from \"hello.name\" config.\n    \"\"\"\n\n    def add_arguments(self, parser):\n        parser.add_argument(\"-n\", \"--name\", help=\"the person's name to whom you greet\")\n\n    def handle(self, project, options):\n        if not options.name:\nname = project.config[\"hello.name\"]\nelse:\n            name = options.name\n        print(f\"Hello, {name}\")\n

    Till now, if you query the config value by pdm config get hello.name, an error will pop up saying it is not a valid config key. You need to register the config item, too:

    from pdm.project.config import ConfigItem\n\ndef hello_plugin(core):\n    core.register_command(HelloCommand, \"hello\")\ncore.add_config(\"hello.name\", ConfigItem(\"The person's name\", \"John\"))\n

    where ConfigItem class takes 4 parameters, in the following order:

    • description: a description of the config item
    • default: default value of the config item
    • global_only: whether the config is allowed to set in home config only
    • env_var: the name of environment variable which will be read as the config value
    "},{"location":"dev/write/#other-plugin-points","title":"Other plugin points","text":"

    Besides of commands and configurations, the core object exposes some other methods and attributes to override. PDM also provides some signals you can listen to. Please read the API reference for more details.

    "},{"location":"dev/write/#tips-about-developing-a-pdm-plugin","title":"Tips about developing a PDM plugin","text":"

    When developing a plugin, one hopes to activate and plugin in development and get updated when the code changes.

    You can achieve this by installing the plugin in editable mode. To do this, specify the dependencies in tool.pdm.plugins array:

    [tool.pdm]\nplugins = [\n\"-e file:///${PROJECT_ROOT}\"\n]\n

    Then install it with:

    pdm install --plugins\n

    After that, all the dependencies are available in a project plugin library, including the plugin itself, in editable mode. That means any change to the codebase will take effect immediately without re-installation. The pdm executable also uses a Python interpreter under the hood, so if you run pdm from inside the plugin project, the plugin in development will be activated automatically, and you can do some testing to see how it works.

    "},{"location":"dev/write/#testing-your-plugin","title":"Testing your plugin","text":"

    PDM exposes some pytest fixtures as a plugin in the pdm.pytest module. To benefit from them, you must add pdm[pytest] as a test dependency.

    To enable them in your test, add pdm.pytest as a plugin. You can do so by in your root conftest.py:

    conftest.py
    # single plugin\npytest_plugins = \"pytest.plugin\"\n\n# many plugins\npytest_plugins = [\n    ...\n    \"pdm.pytest\",\n    ...\n]\n

    You can see some usage examples into PDM own tests, especially the conftest.py file for configuration.

    See the pytest fixtures documentation for more details.

    "},{"location":"dev/write/#publish-your-plugin","title":"Publish your plugin","text":"

    Now you have defined your plugin already, let's distribute it to PyPI. PDM's plugins are discovered by entry point types. Create an pdm entry point and point to your plugin callable (yeah, it doesn't need to be a function, any callable object can work):

    PEP 621:

    # pyproject.toml\n\n[project.entry-points.pdm]\nhello = \"my_plugin:hello_plugin\"\n

    setuptools:

    # setup.py\n\nsetup(\n    ...\n    entry_points={\"pdm\": [\"hello = my_plugin:hello_plugin\"]}\n    ...\n)\n
    "},{"location":"dev/write/#activate-the-plugin","title":"Activate the plugin","text":"

    As plugins are loaded via entry points, they can be activated with no more steps than just installing the plugin. For convenience, PDM provides a plugin command group to manage plugins.

    Assume your plugin is published as pdm-hello:

    pdm self add pdm-hello\n

    Now type pdm --help in the terminal, you will see the new added hello command and use it:

    $ pdm hello Jack\nHello, Jack\n

    See more plugin management subcommands by typing pdm self --help in the terminal.

    "},{"location":"dev/write/#specify-the-plugins-in-project","title":"Specify the plugins in project","text":"

    To specify the required plugins for a project, you can use the tool.pdm.plugins config in the pyproject.toml file. These dependencies can be installed into a project plugin library by running pdm install --plugins. The project plugin library will be loaded in subsequent PDM commands.

    This is useful when you want to share the same plugin set with the contributors.

    # pyproject.toml\n[tool.pdm]\nplugins = [\n\"pdm-packer\"\n]\n

    Run pdm install --plugins to install and activate the plugins.

    Alternatively, you can have project-local plugins that are not published to PyPI, by using editable local dependencies:

    # pyproject.toml\n[tool.pdm]\nplugins = [\n\"-e file:///${PROJECT_ROOT}/plugins/my_plugin\"\n]\n
    "},{"location":"reference/api/","title":"API Reference","text":""},{"location":"reference/api/#pdm.core.Core","title":"pdm.core.Core","text":"

    A high level object that manages all classes and configurations

    "},{"location":"reference/api/#pdm.core.Core.add_config","title":"add_config(name, config_item) staticmethod","text":"

    Add a config item to the configuration class.

    Parameters:

    Name Type Description Default name str

    The name of the config item

    required config_item pdm.project.config.ConfigItem

    The config item to add

    required"},{"location":"reference/api/#pdm.core.Core.create_project","title":"create_project(root_path=None, is_global=False, global_config=None)","text":"

    Create a new project object

    Parameters:

    Name Type Description Default root_path PathLike

    The path to the project root directory

    None is_global bool

    Whether the project is a global project

    False global_config str

    The path to the global config file

    None

    Returns:

    Type Description Project

    The project object

    "},{"location":"reference/api/#pdm.core.Core.handle","title":"handle(project, options)","text":"

    Called before command invocation

    "},{"location":"reference/api/#pdm.core.Core.load_plugins","title":"load_plugins()","text":"

    Import and load plugins under pdm.plugin namespace A plugin is a callable that accepts the core object as the only argument.

    Example
    def my_plugin(core: pdm.core.Core) -> None:\n    ...\n
    "},{"location":"reference/api/#pdm.core.Core.main","title":"main(args=None, prog_name=None, obj=None, **extra)","text":"

    The main entry function

    "},{"location":"reference/api/#pdm.core.Core.register_command","title":"register_command(command, name=None)","text":"

    Register a subcommand to the subparsers, with an optional name of the subcommand.

    Parameters:

    Name Type Description Default command Type[pdm.cli.commands.base.BaseCommand]

    The command class to register

    required name str

    The name of the subcommand, if not given, command.name is used

    None"},{"location":"reference/api/#pdm.core.Project","title":"pdm.core.Project","text":"

    Core project class.

    Parameters:

    Name Type Description Default core Core

    The core instance.

    required root_path str | Path | None

    The root path of the project.

    required is_global bool

    Whether the project is global.

    False global_config str | Path | None

    The path to the global config file.

    None"},{"location":"reference/api/#pdm.project.core.Project.default_source","title":"default_source: RepositoryConfig property","text":"

    Get the default source from the pypi setting

    "},{"location":"reference/api/#pdm.project.core.Project.config","title":"config()","text":"

    A read-only dict configuration

    "},{"location":"reference/api/#pdm.project.core.Project.find_interpreters","title":"find_interpreters(python_spec=None)","text":"

    Return an iterable of interpreter paths that matches the given specifier,

    which can be
    1. a version specifier like 3.7
    2. an absolute path
    3. a short name like python3
    4. None that returns all possible interpreters
    "},{"location":"reference/api/#pdm.project.core.Project.get_provider","title":"get_provider(strategy='all', tracked_names=None, for_install=False, ignore_compatibility=True, direct_minimal_versions=False)","text":"

    Build a provider class for resolver.

    :param strategy: the resolve strategy :param tracked_names: the names of packages that needs to update :param for_install: if the provider is for install :param ignore_compatibility: if the provider should ignore the compatibility when evaluating candidates :param direct_minimal_versions: if the provider should prefer minimal versions instead of latest :returns: The provider object

    "},{"location":"reference/api/#pdm.project.core.Project.get_reporter","title":"get_reporter(requirements, tracked_names=None, spinner=None)","text":"

    Return the reporter object to construct a resolver.

    :param requirements: requirements to resolve :param tracked_names: the names of packages that needs to update :param spinner: optional spinner object :returns: a reporter

    "},{"location":"reference/api/#pdm.project.core.Project.get_repository","title":"get_repository(cls=None, ignore_compatibility=True)","text":"

    Get the repository object

    "},{"location":"reference/api/#pdm.project.core.Project.project_config","title":"project_config()","text":"

    Read-and-writable configuration dict for project settings

    "},{"location":"reference/api/#pdm.project.core.Project.resolve_interpreter","title":"resolve_interpreter()","text":"

    Get the Python interpreter path.

    "},{"location":"reference/api/#pdm.project.core.Project.use_pyproject_dependencies","title":"use_pyproject_dependencies(group, dev=False)","text":"

    Get the dependencies array and setter in the pyproject.toml Return a tuple of two elements, the first is the dependencies array, and the second value is a callable to set the dependencies array back.

    "},{"location":"reference/api/#pdm.project.core.Project.write_lockfile","title":"write_lockfile(toml_data, show_message=True, write=True, **_kwds)","text":"

    Write the lock file to disk.

    "},{"location":"reference/api/#signals","title":"Signals","text":"

    New in version 1.12.0

    The signal definition for PDM.

    Example
    from pdm.signals import post_init, post_install\n\ndef on_post_init(project):\n    project.core.ui.echo(\"Project initialized\")\n# Connect to the signal\npost_init.connect(on_post_init)\n# Or use as a decorator\n@post_install.connect\ndef on_post_install(project, candidates, dry_run):\n    project.core.ui.echo(\"Project install succeeded\")\n
    "},{"location":"reference/api/#pdm.signals.post_build","title":"post_build: NamedSignal = pdm_signals.signal('post_build') module-attribute","text":"

    Called after a project is built.

    Parameters:

    Name Type Description Default project Project

    The project object

    required artifacts Sequence[str]

    The locations of built artifacts

    required config_settings dict[str, str] | None

    Additional config settings passed via args

    required"},{"location":"reference/api/#pdm.signals.post_init","title":"post_init: NamedSignal = pdm_signals.signal('post_init') module-attribute","text":"

    Called after a project is initialized.

    Parameters:

    Name Type Description Default project Project

    The project object

    required"},{"location":"reference/api/#pdm.signals.post_install","title":"post_install: NamedSignal = pdm_signals.signal('post_install') module-attribute","text":"

    Called after a project is installed.

    Parameters:

    Name Type Description Default project Project

    The project object

    required candidates dict[str, Candidate]

    The candidates installed

    required dry_run bool

    If true, won't perform any actions

    required"},{"location":"reference/api/#pdm.signals.post_lock","title":"post_lock: NamedSignal = pdm_signals.signal('post_lock') module-attribute","text":"

    Called after a project is locked.

    Parameters:

    Name Type Description Default project Project

    The project object

    required resolution dict[str, Candidate]

    The resolved candidates

    required dry_run bool

    If true, won't perform any actions

    required"},{"location":"reference/api/#pdm.signals.post_publish","title":"post_publish: NamedSignal = pdm_signals.signal('post_publish') module-attribute","text":"

    Called after a project is published.

    Parameters:

    Name Type Description Default project Project

    The project object

    required"},{"location":"reference/api/#pdm.signals.post_run","title":"post_run: NamedSignal = pdm_signals.signal('post_run') module-attribute","text":"

    Called after any run.

    Parameters:

    Name Type Description Default project Project

    The project object

    required script str

    the script name

    required args Sequence[str]

    the command line provided arguments

    required"},{"location":"reference/api/#pdm.signals.post_script","title":"post_script: NamedSignal = pdm_signals.signal('post_script') module-attribute","text":"

    Called after any script.

    Parameters:

    Name Type Description Default project Project

    The project object

    required script str

    the script name

    required args Sequence[str]

    the command line provided arguments

    required"},{"location":"reference/api/#pdm.signals.post_use","title":"post_use: NamedSignal = pdm_signals.signal('post_use') module-attribute","text":"

    Called after use switched to a new Python version.

    Parameters:

    Name Type Description Default project Project

    The project object

    required python PythonInfo

    Information about the new Python interpreter

    required"},{"location":"reference/api/#pdm.signals.pre_build","title":"pre_build: NamedSignal = pdm_signals.signal('pre_build') module-attribute","text":"

    Called before a project is built.

    Parameters:

    Name Type Description Default project Project

    The project object

    required dest str

    The destination location

    required config_settings dict[str, str] | None

    Additional config settings passed via args

    required"},{"location":"reference/api/#pdm.signals.pre_install","title":"pre_install: NamedSignal = pdm_signals.signal('pre_install') module-attribute","text":"

    Called before a project is installed.

    Parameters:

    Name Type Description Default project Project

    The project object

    required candidates dict[str, Candidate]

    The candidates to install

    required dry_run bool

    If true, won't perform any actions

    required"},{"location":"reference/api/#pdm.signals.pre_invoke","title":"pre_invoke: NamedSignal = pdm_signals.signal('pre_invoke') module-attribute","text":"

    Called before any command is invoked.

    Parameters:

    Name Type Description Default project Project

    The project object

    required command str | None

    the command name

    required options Namespace

    the parsed arguments

    required"},{"location":"reference/api/#pdm.signals.pre_lock","title":"pre_lock: NamedSignal = pdm_signals.signal('pre_lock') module-attribute","text":"

    Called before a project is locked.

    Parameters:

    Name Type Description Default project Project

    The project object

    required requirements list[Requirement]

    The requirements to lock

    required dry_run bool

    If true, won't perform any actions

    required"},{"location":"reference/api/#pdm.signals.pre_publish","title":"pre_publish: NamedSignal = pdm_signals.signal('pre_publish') module-attribute","text":"

    Called before a project is published.

    Parameters:

    Name Type Description Default project Project

    The project object

    required"},{"location":"reference/api/#pdm.signals.pre_run","title":"pre_run: NamedSignal = pdm_signals.signal('pre_run') module-attribute","text":"

    Called before any run.

    Parameters:

    Name Type Description Default project Project

    The project object

    required script str

    the script name

    required args Sequence[str]

    the command line provided arguments

    required"},{"location":"reference/api/#pdm.signals.pre_script","title":"pre_script: NamedSignal = pdm_signals.signal('pre_script') module-attribute","text":"

    Called before any script.

    Parameters:

    Name Type Description Default project Project

    The project object

    required script str

    the script name

    required args Sequence[str]

    the command line provided arguments

    required"},{"location":"reference/build/","title":"Build Configuration","text":"

    pdm uses the PEP 517 to build the package. It acts as a build frontend that calls the build backend to build the package.

    A build backend is what drives the build system to build source distributions and wheels from arbitrary source trees.

    If you run pdm init, PDM will let you choose the build backend to use. Unlike other package managers, PDM does not force you to use a specific build backend. You can choose the one you like. Here is a list of build backends and corresponding configurations initially supported by PDM:

    pdm-backendsetuptoolsflithatchling

    pyproject.toml configuration:

    [build-system]\nrequires = [\"pdm-backend\"]\nbuild-backend = \"pdm.backend\"\n

    Read the docs

    pyproject.toml configuration:

    [build-system]\nrequires = [\"setuptools\", \"wheel\"]\nbuild-backend = \"setuptools.build_meta\"\n

    Read the docs

    pyproject.toml configuration:

    [build-system]\nrequires = [\"flit_core >=3.2,<4\"]\nbuild-backend = \"flit_core.buildapi\"\n

    Read the docs

    pyproject.toml configuration:

    [build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n

    Read the docs

    Apart from the above mentioned backends, you can also use any other backend that supports PEP 621, however, poetry-core is not supported because it does not support reading PEP 621 metadata.

    Info

    If you are using a custom build backend that is not in the above list, PDM will handle the relative paths as PDM-style(${PROJECT_ROOT} variable).

    "},{"location":"reference/cli/","title":"CLI Reference","text":""},{"location":"reference/cli/#pdm","title":"pdm","text":"

    Options:

    • -h, --help: Show this help message and exit.
    • -V, --version: Show the version and exit
    • -c, --config: Specify another config file path [env var: PDM_CONFIG_FILE]
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -I, --ignore-python: Ignore the Python path saved in.pdm-python. [env var: PDM_IGNORE_SAVED_PYTHON]
    • --pep582 SHELL: Print the command line to be eval'd by the shell

    Commands:

    "},{"location":"reference/cli/#add","title":"add","text":"

    Add package(s) to pyproject.toml and install them

    Package Arguments:

    • -e, --editable: Specify editable packages
    • packages: Specify packages

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
    • --no-lock: Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]
    • --save-compatible: Save compatible version specifiers
    • --save-wildcard: Save wildcard version specifiers
    • --save-exact: Save exact version specifiers
    • --save-minimum: Save minimum version specifiers
    • --update-reuse: Reuse pinned versions already present in lock file if possible
    • --update-eager: Try to update the packages and their dependencies recursively
    • --update-all: Update all dependencies and sub-dependencies
    • --pre, --prerelease: Allow prereleases to be pinned
    • -u, --unconstrained: Ignore the version constraint of packages
    • --dry-run: Show the difference only and don't perform any action
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • -d, --dev: Add packages into dev dependencies
    • -G, --group: Specify the target dependency group to add into
    • --no-sync: Only writepyproject.toml and do not sync the working set (default: True)

    Install Options:

    • --no-editable: Install non-editable versions for all packages
    • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
    • --fail-fast, -x: Abort on first installation error
    • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
    "},{"location":"reference/cli/#build","title":"build","text":"

    Build artifacts for distribution

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • --no-sdist: Don't build source tarballs (default: True)
    • --no-wheel: Don't build wheels (default: True)
    • -d, --dest: Target directory to put artifacts (default: dist)
    • --no-clean: Do not clean the target directory (default: True)
    • --config-setting, -C: Pass options to the backend. options with a value must be specified after \"=\": --config-setting=--opt(=value) or -C--opt(=value)
    "},{"location":"reference/cli/#cache","title":"cache","text":"

    Control the caches of PDM

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output

    Commands:

    "},{"location":"reference/cli/#clear","title":"clear","text":"

    Clean all the files under cache directory

    Positional Arguments:

    • type: Clear the given type of caches

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    "},{"location":"reference/cli/#remove","title":"remove","text":"

    Remove files matching the given pattern

    Positional Arguments:

    • pattern: The pattern to remove

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    "},{"location":"reference/cli/#list","title":"list","text":"

    List the built wheels stored in the cache

    Positional Arguments:

    • pattern: The pattern to list (default: *)

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    "},{"location":"reference/cli/#info","title":"info","text":"

    Show the info and current size of caches

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    "},{"location":"reference/cli/#completion","title":"completion","text":"

    Generate completion scripts for the given shell

    Positional Arguments:

    • shell: The shell to generate the scripts for. If not given, PDM will properly guess from SHELL env var.

    Options:

    • -h, --help: Show this help message and exit.
    "},{"location":"reference/cli/#config","title":"config","text":"

    Display the current configuration

    Positional Arguments:

    • key: Config key
    • value: Config value

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -l, --local: Set config in the project's local configuration file
    • -d, --delete: Unset a configuration key
    • -e, --edit: Edit the configuration file in the default editor(defined by EDITOR env var)
    "},{"location":"reference/cli/#export","title":"export","text":"

    Export the locked packages set to other formats

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
    • -f, --format: Specify the export file format (default: requirements)
    • --without-hashes: Don't include artifact hashes (default: True)
    • -o, --output: Write output to the given file, or print to stdout if not given
    • --pyproject: Read the list of packages frompyproject.toml
    • --expandvars: Expand environment variables in requirements

    Dependencies Selection:

    • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
    • --no-default: Don't include dependencies from the default group (default: True)
    • -d, --dev: Select dev dependencies
    • --prod, --production: Unselect dev dependencies (default: True)
    "},{"location":"reference/cli/#fix","title":"fix","text":"

    Fix the project problems according to the latest version of PDM

    Positional Arguments:

    • problem: Fix the specific problem, or all if not given

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --dry-run: Only show the problems
    "},{"location":"reference/cli/#import","title":"import","text":"

    Import project metadata from other formats

    Positional Arguments:

    • filename: The file name

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -d, --dev: import packages into dev dependencies
    • -G, --group: Specify the target dependency group to import into
    • -f, --format: Specify the file format explicitly
    "},{"location":"reference/cli/#info_1","title":"info","text":"

    Show the project information

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • --python: Show the interpreter path
    • --where: Show the project root path
    • --packages: Show the local packages root
    • --env: Show PEP 508 environment markers
    • --json: Dump the information in JSON
    "},{"location":"reference/cli/#init","title":"init","text":"

    Initialize a pyproject.toml for PDM

    Positional Arguments:

    • template: Specify the project template, which can be a local path or a Git URL
    • generator_args: Arguments passed to the generator

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • --copier: Use Copier to generate project [not installed] (default: builtin)
    • --cookiecutter: Use Cookiecutter to generate project [not installed] (default: builtin)
    • -r, --overwrite: Overwrite existing files

    Builtin Generator Options:

    • -n, --non-interactive: Don't ask questions but use default values
    • --python: Specify the Python version/path to use
    • --backend: Specify the build backend
    • --lib: Create a library project
    "},{"location":"reference/cli/#install","title":"install","text":"

    Install dependencies from lock file

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --dry-run: Show the difference only and don't perform any action
    • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
    • --no-lock: Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • --check: Check if the lock file is up to date and fail otherwise
    • --plugins: Install the plugins specified inpyproject.toml

    Install Options:

    • --no-editable: Install non-editable versions for all packages
    • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
    • --fail-fast, -x: Abort on first installation error
    • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.

    Dependencies Selection:

    • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
    • --no-default: Don't include dependencies from the default group (default: True)
    • -d, --dev: Select dev dependencies
    • --prod, --production: Unselect dev dependencies (default: True)
    "},{"location":"reference/cli/#list_1","title":"list","text":"

    List packages installed in the current working set

    Positional Arguments:

    • patterns: Filter packages by patterns. e.g. pdm list requests- flask-. In --tree mode, only show the subtree of the matched packages.

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • --freeze: Show the installed dependencies in pip's requirements.txt format
    • --tree, --graph: Display a tree of dependencies
    • -r, --reverse: Reverse the dependency tree
    • --resolve: Resolve all requirements to output licenses (instead of just showing those currently installed)
    • --fields: Select information to output as a comma separated string. All fields: groups,homepage,licenses,location,name,version. (default: name,version,location)
    • --sort: Sort the output using a given field name. If nothing is set, no sort is applied. Multiple fields can be combined with ','.
    • --csv: Output dependencies in CSV document format
    • --json: Output dependencies in JSON document format
    • --markdown: Output dependencies and legal notices in markdown document format - best effort basis
    • --include: Dependency groups to include in the output. By default all are included
    • --exclude: Exclude dependency groups from the output
    "},{"location":"reference/cli/#lock","title":"lock","text":"

    Resolve and lock dependencies

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
    • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • --refresh: Don't update pinned versions, only refresh the lock file
    • --check: Check if the lock file is up to date and quit

    Lock Strategy:

    • --strategy, -S STRATEGY: Specify lock strategy (cross_platform, static_urls, direct_minimal_versions). Add 'no_' prefix to disable. Can be supplied multiple times or split by comma.
    • --no-cross-platform: [DEPRECATED] Only lock packages for the current platform
    • --static-urls: [DEPRECATED] Store static file URLs in the lockfile
    • --no-static-urls: [DEPRECATED] Do not store static file URLs in the lockfile

    Dependencies Selection:

    • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
    • --no-default: Don't include dependencies from the default group (default: True)
    • -d, --dev: Select dev dependencies
    • --prod, --production: Unselect dev dependencies (default: True)
    "},{"location":"reference/cli/#publish","title":"publish","text":"

    Build and publish the project to PyPI

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • -r, --repository: The repository name or url to publish the package to [env var: PDM_PUBLISH_REPO]
    • -u, --username: The username to access the repository [env var: PDM_PUBLISH_USERNAME]
    • -P, --password: The password to access the repository [env var: PDM_PUBLISH_PASSWORD]
    • -S, --sign: Upload the package with PGP signature
    • -i, --identity: GPG identity used to sign files.
    • -c, --comment: The comment to include with the distribution file.
    • --no-build: Don't build the package before publishing (default: True)
    • --no-very-ssl: Disable SSL verification
    • --ca-certs: The path to a PEM-encoded Certificate Authority bundle to use for publish server validation [env var: PDM_PUBLISH_CA_CERTS]
    "},{"location":"reference/cli/#remove_1","title":"remove","text":"

    Remove packages from pyproject.toml

    Positional Arguments:

    • packages: Specify the packages to remove

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --dry-run: Show the difference only and don't perform any action
    • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
    • --no-lock: Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • -d, --dev: Remove packages from dev dependencies
    • -G, --group: Specify the target dependency group to remove from
    • --no-sync: Only writepyproject.toml and do not uninstall packages (default: True)

    Install Options:

    • --no-editable: Install non-editable versions for all packages
    • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
    • --fail-fast, -x: Abort on first installation error
    • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.
    "},{"location":"reference/cli/#run","title":"run","text":"

    Run commands or scripts with local packages loaded

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • -l, --list: Show all available scripts defined inpyproject.toml
    • -j, --json: Output all scripts infos in JSON

    Execution Parameters:

    • -s, --site-packages: Load site-packages from the selected interpreter
    • script: The command to run
    • args: Arguments that will be passed to the command
    "},{"location":"reference/cli/#search","title":"search","text":"

    Search for PyPI packages

    Positional Arguments:

    • query: Query string to search

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    "},{"location":"reference/cli/#self","title":"self","text":"

    Manage the PDM program itself (previously known as plugin)

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output

    Commands:

    "},{"location":"reference/cli/#list_2","title":"list","text":"

    List all packages installed with PDM

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • --plugins: List plugins only
    "},{"location":"reference/cli/#add_1","title":"add","text":"

    Install packages to the PDM's environment

    Positional Arguments:

    • packages: Specify one or many package names, each package can have a version specifier

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • --pip-args: Arguments that will be passed to pip install
    "},{"location":"reference/cli/#remove_2","title":"remove","text":"

    Remove packages from PDM's environment

    Positional Arguments:

    • packages: Specify one or many package names

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • --pip-args: Arguments that will be passed to pip uninstall
    • -y, --yes: Answer yes on the question
    "},{"location":"reference/cli/#update","title":"update","text":"

    Update PDM itself

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • --head: Update to the latest commit on the main branch
    • --pre: Update to the latest prerelease version
    • --pip-args: Additional arguments that will be passed to pip install
    "},{"location":"reference/cli/#plugin","title":"plugin","text":"

    Manage the PDM program itself (previously known as plugin)

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output

    Commands:

    "},{"location":"reference/cli/#list_3","title":"list","text":"

    List all packages installed with PDM

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • --plugins: List plugins only
    "},{"location":"reference/cli/#add_2","title":"add","text":"

    Install packages to the PDM's environment

    Positional Arguments:

    • packages: Specify one or many package names, each package can have a version specifier

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • --pip-args: Arguments that will be passed to pip install
    "},{"location":"reference/cli/#remove_3","title":"remove","text":"

    Remove packages from PDM's environment

    Positional Arguments:

    • packages: Specify one or many package names

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • --pip-args: Arguments that will be passed to pip uninstall
    • -y, --yes: Answer yes on the question
    "},{"location":"reference/cli/#update_1","title":"update","text":"

    Update PDM itself

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • --head: Update to the latest commit on the main branch
    • --pre: Update to the latest prerelease version
    • --pip-args: Additional arguments that will be passed to pip install
    "},{"location":"reference/cli/#show","title":"show","text":"

    Show the package information

    Positional Arguments:

    • package: Specify the package name, or show this package if not given

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • --name: Show name
    • --version: Show version
    • --summary: Show summary
    • --license: Show license
    • --platform: Show platform
    • --keywords: Show keywords
    "},{"location":"reference/cli/#sync","title":"sync","text":"

    Synchronize the current working set with lock file

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --dry-run: Show the difference only and don't perform any action
    • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • --clean: Clean packages not in the lockfile
    • --only-keep: Only keep the selected packages
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • -r, --reinstall: Force reinstall existing dependencies

    Install Options:

    • --no-editable: Install non-editable versions for all packages
    • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
    • --fail-fast, -x: Abort on first installation error
    • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.

    Dependencies Selection:

    • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
    • --no-default: Don't include dependencies from the default group (default: True)
    • -d, --dev: Select dev dependencies
    • --prod, --production: Unselect dev dependencies (default: True)
    "},{"location":"reference/cli/#update_2","title":"update","text":"

    Update package(s) in pyproject.toml

    Positional Arguments:

    • packages: If packages are given, only update them

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -L, --lockfile: Specify another lockfile path. Default:pdm.lock. [env var: PDM_LOCKFILE]
    • --no-lock: Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]
    • --save-compatible: Save compatible version specifiers
    • --save-wildcard: Save wildcard version specifiers
    • --save-exact: Save exact version specifiers
    • --save-minimum: Save minimum version specifiers
    • --update-reuse: Reuse pinned versions already present in lock file if possible
    • --update-eager: Try to update the packages and their dependencies recursively
    • --update-all: Update all dependencies and sub-dependencies
    • --pre, --prerelease: Allow prereleases to be pinned
    • -u, --unconstrained: Ignore the version constraint of packages
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • --venv NAME: Run the command in the virtual environment with the given key. [env var: PDM_IN_VENV]
    • -t, --top: Only update those listed inpyproject.toml
    • --dry-run, --outdated: Show the difference only without modifying the lockfile content
    • --no-sync: Only update lock file but do not sync packages (default: True)

    Install Options:

    • --no-editable: Install non-editable versions for all packages
    • --no-self: Don't install the project itself. [env var: PDM_NO_SELF]
    • --fail-fast, -x: Abort on first installation error
    • --no-isolation: Disable isolation when building a source distribution that follows PEP 517, as in: build dependencies specified by PEP 518 must be already installed if this option is used.

    Dependencies Selection:

    • -G, --group GROUP: Select group of optional-dependencies separated by comma or dev-dependencies (with -d). Can be supplied multiple times, use:all to include all groups under the same species.
    • --no-default: Don't include dependencies from the default group (default: True)
    • -d, --dev: Select dev dependencies
    • --prod, --production: Unselect dev dependencies
    "},{"location":"reference/cli/#use","title":"use","text":"

    Use the given python version or path as base interpreter

    Positional Arguments:

    • python: Specify the Python version or path

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -g, --global: Use the global project, supply the project root with -p option
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • -k, --skip: Skip some tasks and/or hooks by their comma-separated names. Can be supplied multiple times. Use:all to skip all hooks. Use:pre and:post to skip all pre or post hooks.
    • -f, --first: Select the first matched interpreter
    • -i, --ignore-remembered: Ignore the remembered selection
    • --venv: Use the interpreter in the virtual environment with the given name
    "},{"location":"reference/cli/#venv","title":"venv","text":"

    Virtualenv management

    Options:

    • -h, --help: Show this help message and exit.
    • -p, --project: Specify another path as the project root, which changes the base ofpyproject.toml and __pypackages__ [env var: PDM_PROJECT]
    • --path: Show the path to the given virtualenv
    • --python: Show the python interpreter path for the given virtualenv

    Commands:

    "},{"location":"reference/cli/#create","title":"create","text":"

    Create a virtualenv

    Positional Arguments:

    • python: Specify which python should be used to create the virtualenv
    • venv_args: Additional arguments that will be passed to the backend

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -w, --with: Specify the backend to create the virtualenv
    • -f, --force: Recreate if the virtualenv already exists
    • -n, --name: Specify the name of the virtualenv
    • --with-pip: Install pip with the virtualenv
    "},{"location":"reference/cli/#list_4","title":"list","text":"

    List all virtualenvs associated with this project

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    "},{"location":"reference/cli/#remove_4","title":"remove","text":"

    Remove the virtualenv with the given name

    Positional Arguments:

    • env: The key of the virtualenv

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -y, --yes: Answer yes on the following question
    "},{"location":"reference/cli/#activate","title":"activate","text":"

    Print the command to activate the virtualenv with the given name

    Positional Arguments:

    • env: The key of the virtualenv

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    "},{"location":"reference/cli/#purge","title":"purge","text":"

    Purge selected/all created Virtualenvs

    Options:

    • -h, --help: Show this help message and exit.
    • -v, --verbose: Use -v for detailed output and -vv for more detailed
    • -q, --quiet: Suppress output
    • -f, --force: Force purging without prompting for confirmation
    • -i, --interactive: Interactively purge selected Virtualenvs
    "},{"location":"reference/configuration/","title":"Configurations","text":""},{"location":"reference/configuration/#color-theme","title":"Color Theme","text":"

    The default theme used by PDM is as follows:

    Key Default Style primary cyan success green warning yellow error red info blue req bold green

    You can change the theme colors with pdm config command. For example, to change the primary color to magenta:

    pdm config theme.primary magenta\n

    Or use a hex color code:

    pdm config theme.success '#51c7bd'\n
    "},{"location":"reference/configuration/#available-configurations","title":"Available Configurations","text":"

    The following configuration items can be retrieved and modified by pdm config command.

    Config Item Description Default Value Available in Project Env var build_isolation Isolate the build environment from the project environment Yes Yes PDM_BUILD_ISOLATION cache_dir The root directory of cached files The default cache location on OS No check_update Check if there is any newer version available True No PDM_CHECK_UPDATE global_project.fallback Use the global project implicitly if no local project is found False No global_project.fallback_verbose If True show message when global project is used implicitly True No global_project.path The path to the global project <default config location on OS>/global-project No global_project.user_site Whether to install to user site False No install.cache Enable caching of wheel installations False Yes install.cache_method Specify how to create links to the caches(symlink or pth) symlink Yes install.parallel Whether to perform installation and uninstallation in parallel True Yes PDM_PARALLEL_INSTALL python.use_pyenv Use the pyenv interpreter True Yes python.use_venv Use virtual environments when available True Yes PDM_USE_VENV python.providers List of python provider names for findpython All providers supported by findpython Yes pypi.url The URL of PyPI mirror https://pypi.org/simple Yes PDM_PYPI_URL pypi.username The username to access PyPI Yes PDM_PYPI_USERNAME pypi.password The password to access PyPI Yes PDM_PYPI_PASSWORD pypi.ignore_stored_index Ignore the configured indexes False Yes PDM_IGNORE_STORED_INDEX pypi.ca_certs Path to a PEM-encoded CA cert bundle (used for server cert verification) The CA certificates from certifi Yes pypi.client_cert Path to a PEM-encoded client cert and optional key No pypi.client_key Path to a PEM-encoded client cert private key, if not in pypi.client_cert No pypi.verify_ssl Verify SSL certificate when query PyPI True Yes pypi.json_api Consult PyPI's JSON API for package metadata False Yes PDM_PYPI_JSON_API pypi.<name>.url The URL of custom package source https://pypi.org/simple Yes pypi.<name>.username The username to access custom source Yes pypi.<name>.password The password to access custom source Yes pypi.<name>.type index or find_links index Yes pypi.<name>.verify_ssl Verify SSL certificate when query custom source True Yes strategy.save Specify how to save versions when a package is added minimum(can be: exact, wildcard, minimum, compatible) Yes strategy.update The default strategy for updating packages reuse(can be : eager) Yes strategy.resolve_max_rounds Specify the max rounds of resolution process 10000 Yes PDM_RESOLVE_MAX_ROUNDS venv.location Parent directory for virtualenvs <default data location on OS>/venvs No venv.backend Default backend to create virtualenv virtualenv Yes PDM_VENV_BACKEND venv.prompt Formatted string to be displayed in the prompt when virtualenv is active {project_name}-{python_version} Yes PDM_VENV_PROMPT venv.in_project Create virtualenv in .venv under project root True Yes PDM_VENV_IN_PROJECT venv.with_pip Install pip when creating a new venv False Yes PDM_VENV_WITH_PIP repository.<name>.url The URL of custom package source https://pypi.org/simple Yes repository.<name>.username The username to access custom repository Yes repository.<name>.password The password to access custom repository Yes repository.<name>.ca_certs Path to a PEM-encoded CA cert bundle (used for server cert verification) The CA certificates from certifi Yes repository.<name>.verify_ssl Verify SSL certificate when uploading to repository True Yes

    If the corresponding env var is set, the value will take precedence over what is saved in the config file.

    "},{"location":"reference/pep621/","title":"PEP 621 Metadata","text":"

    The project metadata are stored in the pyproject.toml. The specifications are defined by PEP 621, PEP 631 and PEP 639. Read the detailed specifications in the PEPs.

    In the following part of this document, metadata should be written under [project] table if not given explicitly.

    "},{"location":"reference/pep621/#multiline-description","title":"Multiline description","text":"

    You can split a long description onto multiple lines, thanks to TOML support for multiline strings. Just remember to escape new lines, so the final description appears on one line only in your package metadata. Indentation will be removed as well when escaping new lines:

    description = \"\"\"\\\n    Lorem ipsum dolor sit amet, consectetur adipiscing elit, \\\n    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \\\n    Ut enim ad minim veniam, quis nostrud exercitation ullamco \\\n    laboris nisi ut aliquip ex ea commodo consequat.\\\n\"\"\"\n

    See TOML's specification on strings.

    "},{"location":"reference/pep621/#package-version","title":"Package version","text":"StaticDynamic
    [project]\nversion = \"1.0.0\"\n
    [project]\n...\ndynamic = [\"version\"]\n\n[tool.pdm]\nversion = { source = \"file\", path = \"mypackage/__version__.py\" }\n

    The version will be read from the mypackage/__version__.py file searching for the pattern: __version__ = \"{version}\".

    Read more information about other configurations in dynamic project version from the pdm-backend documentation.

    "},{"location":"reference/pep621/#python-version","title":"Python version","text":"

    The required version of Python is specified as the string requires-python:

    requires-python = \">=3.9\"\nclassifiers = [\n    \"Programming Language :: Python :: 3\",\n    \"Programming Language :: Python :: 3.9\",\n    \"Programming Language :: Python :: 3.10\",\n    \"Programming Language :: Python :: 3.11\",\n    ...\n]\n

    Note: As per PEP 621, PDM is not permitted to dynamically update the classifiers section like some other non-compliant tools. Thus, you should also include the appropriate trove classifiers as shown above if you plan on publishing your package on PyPI.

    "},{"location":"reference/pep621/#license","title":"License","text":"

    The license is specified as the string license:

    license = {text = \"BSD-2-Clause\"}\nclassifiers = [\n    \"License :: OSI Approved :: BSD License\",\n    ...\n]\n

    Note: As per PEP 621, PDM is not permitted to dynamically update the classifiers section like some other non-compliant tools. Thus, you should also include the appropriate trove classifiers as shown above if you plan on publishing your package on PyPI.

    "},{"location":"reference/pep621/#dependency-specification","title":"Dependency specification","text":"

    The project.dependencies is an array of dependency specification strings following the PEP 440 and PEP 508.

    Examples:

    [project]\n...\ndependencies = [\n# Named requirement\n\"requests\",\n# Named requirement with version specifier\n\"flask >= 1.1.0\",\n# Requirement with environment marker\n\"pywin32; sys_platform == 'win32'\",\n# URL requirement\n\"pip @ git+https://github.com/pypa/pip.git@20.3.1\"\n]\n
    "},{"location":"reference/pep621/#optional-dependencies","title":"Optional dependencies","text":"

    You can have some requirements optional, which is similar to setuptools' extras_require parameter.

    [project.optional-dependencies]\nsocks = [ 'PySocks >= 1.5.6, != 1.5.7, < 2' ]\ntests = [\n'ddt >= 1.2.2, < 2',\n'pytest < 6',\n'mock >= 1.0.1, < 4; python_version < \"3.4\"',\n]\n

    To install a group of optional dependencies:

    pdm install -G socks\n

    -G option can be given multiple times to include more than one group.

    "},{"location":"reference/pep621/#context-variables-expansion","title":"Context variables expansion","text":"

    Depending on which build backend you are using, PDM will expand some variables in the dependency strings.

    "},{"location":"reference/pep621/#environment-variables","title":"Environment variables","text":"pdm-backendhatchling
    [project]\ndependencies = [\"flask @ https://${USERNAME}:${PASSWORD}/artifacts.io/Flask-1.1.2.tar.gz\"]\n
    [project]\ndependencies = [\"flask @ https://{env:USERNAME}:{env:PASSWORD}/artifacts.io/Flask-1.1.2.tar.gz\"]\n

    Find more usages here

    Don't worry about credential leakage, the environment variables will be expanded when needed and kept untouched in the lock file.

    "},{"location":"reference/pep621/#relative-paths","title":"Relative paths","text":"

    When you add a package from a relative path, PDM will automatically save it as a relative path for pdm-backend and hatchling.

    For example, if you run pdm add ./my-package, it will result in the following line in pyproject.toml.

    pdm-backendhatchling
    [project]\ndependencies = [\"my-package @ file:///${PROJECT_ROOT}/my-package\"]\n
    [project]\ndependencies = [\"my-package @ {root:uri}/my-package\"]\n

    By default, hatchling doesn't support direct references in the dependency string, you need to turn it on in pyproject.toml:

    [tool.hatch.metadata]\nallow-direct-references = true\n

    The relative path will be expanded based on the project root when installing or locking.

    "},{"location":"reference/pep621/#console-scripts","title":"Console scripts","text":"

    The following content:

    [project.scripts]\nmycli = \"mycli.__main__:main\"\n

    will be translated to setuptools style:

    entry_points = {\n    'console_scripts': [\n        'mycli=mycli.__main__:main'\n    ]\n}\n

    Also, [project.gui-scripts] will be translated to gui_scripts entry points group in setuptools style.

    "},{"location":"reference/pep621/#entry-points","title":"Entry points","text":"

    Other types of entry points are given by [project.entry-points.<type>] section, with the same format of [project.scripts]:

    [project.entry-points.pytest11]\nmyplugin = \"mypackage.plugin:pytest_plugin\"\n

    If the entry point name contains dots or other special characters, wrap it in quotes:

    [project.entry-points.\"flake8.extension\"]\nmyplugin = \"mypackage.plugin:flake8_plugin\"\n
    "},{"location":"usage/advanced/","title":"Advanced Usage","text":""},{"location":"usage/advanced/#automatic-testing","title":"Automatic Testing","text":""},{"location":"usage/advanced/#use-tox-as-the-runner","title":"Use Tox as the runner","text":"

    Tox is a great tool for testing against multiple Python versions or dependency sets. You can configure a tox.ini like the following to integrate your testing with PDM:

    [tox]\nenv_list = py{36,37,38},lint\n\n[testenv]\nsetenv =\nPDM_IGNORE_SAVED_PYTHON=\"1\"\ndeps = pdm\ncommands =\npdm install --dev\npytest tests\n\n[testenv:lint]\ndeps = pdm\ncommands =\npdm install -G lint\nflake8 src/\n

    To use the virtualenv created by Tox, you should make sure you have set pdm config python.use_venv true. PDM then will install dependencies from pdm lock into the virtualenv. In the dedicated venv you can directly run tools by pytest tests/ instead of pdm run pytest tests/.

    You should also make sure you don't run pdm add/pdm remove/pdm update/pdm lock in the test commands, otherwise the pdm lock file will be modified unexpectedly. Additional dependencies can be supplied with the deps config. Besides, isolated_build and passenv config should be set as the above example to make PDM work properly.

    To get rid of these constraints, there is a Tox plugin tox-pdm which can ease the usage. You can install it by

    pip install tox-pdm\n

    Or,

    pdm add --dev tox-pdm\n

    And you can make the tox.ini much tidier as following, :

    [tox]\nenv_list = py{36,37,38},lint\n\n[testenv]\ngroups = dev\ncommands =\npytest tests\n\n[testenv:lint]\ngroups = lint\ncommands =\nflake8 src/\n

    See the project's README for a detailed guidance.

    "},{"location":"usage/advanced/#use-nox-as-the-runner","title":"Use Nox as the runner","text":"

    Nox is another great tool for automated testing. Unlike tox, Nox uses a standard Python file for configuration.

    It is much easier to use PDM in Nox, here is an example of noxfile.py:

    import os\nimport nox\n\nos.environ.update({\"PDM_IGNORE_SAVED_PYTHON\": \"1\"})\n@nox.session\ndef tests(session):\n    session.run_always('pdm', 'install', '-G', 'test', external=True)\n    session.run('pytest')\n\n@nox.session\ndef lint(session):\n    session.run_always('pdm', 'install', '-G', 'lint', external=True)\n    session.run('flake8', '--import-order-style', 'google')\n

    Note that PDM_IGNORE_SAVED_PYTHON should be set so that PDM can pick up the Python in the virtualenv correctly. Also make sure pdm is available in the PATH. Before running nox, you should also ensure configuration item python.use_venv is true to enable venv reusing.

    "},{"location":"usage/advanced/#about-pep-582-__pypackages__-directory","title":"About PEP 582 __pypackages__ directory","text":"

    By default, if you run tools by pdm run, __pypackages__ will be seen by the program and all subprocesses created by it. This means virtual environments created by those tools are also aware of the packages inside __pypackages__, which result in unexpected behavior in some cases. For nox, you can avoid this by adding a line in noxfile.py:

    os.environ.pop(\"PYTHONPATH\", None)\n

    For tox, PYTHONPATH will not be passed to the test sessions so this isn't going to be a problem. Moreover, it is recommended to make nox and tox live in their own pipx environments so you don't need to install for every project. In this case, PEP 582 packages will not be a problem either.

    "},{"location":"usage/advanced/#use-pdm-in-continuous-integration","title":"Use PDM in Continuous Integration","text":"

    Only one thing to keep in mind -- PDM can't be installed on Python < 3.7, so if your project is to be tested on those Python versions, you have to make sure PDM is installed on the correct Python version, which can be different from the target Python version the particular job/task is run on.

    Fortunately, if you are using GitHub Action, there is pdm-project/setup-pdm to make this process easier. Here is an example workflow of GitHub Actions, while you can adapt it for other CI platforms.

    Testing:\nruns-on: ${{ matrix.os }}\nstrategy:\nmatrix:\npython-version: [3.7, 3.8, 3.9, '3.10', '3.11']\nos: [ubuntu-latest, macOS-latest, windows-latest]\n\nsteps:\n- uses: actions/checkout@v3\n- name: Set up PDM\nuses: pdm-project/setup-pdm@v3\nwith:\npython-version: ${{ matrix.python-version }}\n\n- name: Install dependencies\nrun: |\npdm sync -d -G testing\n- name: Run Tests\nrun: |\npdm run -v pytest tests\n

    TIPS

    For GitHub Action users, there is a known compatibility issue on Ubuntu virtual environment. If PDM parallel install is failed on that machine you should either set parallel_install to false or set env LD_PRELOAD=/lib/x86_64-linux-gnu/libgcc_s.so.1. It is already handled by the pdm-project/setup-pdm action.

    Note

    If your CI scripts run without a proper user set, you might get permission errors when PDM tries to create its cache directory. To work around this, you can set the HOME environment variable yourself, to a writable directory, for example:

    export HOME=/tmp/home\n
    "},{"location":"usage/advanced/#use-pdm-in-a-multi-stage-dockerfile","title":"Use PDM in a multi-stage Dockerfile","text":"

    It is possible to use PDM in a multi-stage Dockerfile to first install the project and dependencies into __pypackages__ and then copy this folder into the final stage, adding it to PYTHONPATH.

    # build stage\nFROM python:3.8 AS builder\n\n# install PDM\nRUN pip install -U pip setuptools wheel\nRUN pip install pdm\n\n# copy files\nCOPY pyproject.toml pdm.lock README.md /project/\nCOPY src/ /project/src\n\n# install dependencies and project into the local packages directory\nWORKDIR /project\nRUN mkdir __pypackages__ && pdm sync --prod --no-editable\n\n\n# run stage\nFROM python:3.8\n\n# retrieve packages from build stage\nENV PYTHONPATH=/project/pkgs\nCOPY --from=builder /project/__pypackages__/3.8/lib /project/pkgs\n\n# retrieve executables\nCOPY --from=builder /project/__pypackages__/3.8/bin/* /bin/\n\n# set command/entrypoint, adapt to fit your needs\nCMD [\"python\", \"-m\", \"project\"]\n
    "},{"location":"usage/advanced/#use-pdm-to-manage-a-monorepo","title":"Use PDM to manage a monorepo","text":"

    With PDM, you can have multiple sub-packages within a single project, each with its own pyproject.toml file. And you can create only one pdm.lock file to lock all dependencies. The sub-packages can have each other as their dependencies. To achieve this, follow these steps:

    project/pyproject.toml:

    [tool.pdm.dev-dependencies]\ndev = [\n\"-e file:///${PROJECT_ROOT}/packages/foo-core\",\n\"-e file:///${PROJECT_ROOT}/packages/foo-cli\",\n\"-e file:///${PROJECT_ROOT}/packages/foo-app\",\n]\n

    packages/foo-cli/pyproject.toml:

    [project]\ndependencies = [\"foo-core\"]\n

    packages/foo-app/pyproject.toml:

    [project]\ndependencies = [\"foo-core\"]\n

    Now, run pdm install in the project root, and you will get a pdm.lock with all dependencies locked. All sub-packages will be installed in editable mode.

    Look at the \ud83d\ude80 Example repository for more details.

    "},{"location":"usage/advanced/#hooks-for-pre-commit","title":"Hooks for pre-commit","text":"

    pre-commit is a powerful framework for managing git hooks in a centralized fashion. PDM already uses pre-commit hooks for its internal QA checks. PDM exposes also several hooks that can be run locally or in CI pipelines.

    "},{"location":"usage/advanced/#export-requirementstxt-or-setuppy","title":"Export requirements.txt or setup.py","text":"

    This hook wraps the command pdm export along with any valid argument. It can be used as a hook (e.g., for CI) to ensure that you are going to check in the codebase a requirements.txt or a setup.py file, which reflects the actual content of pdm lock.

    # export python requirements\n- repo: https://github.com/pdm-project/pdm\nrev: 2.x.y # a PDM release exposing the hook\nhooks:\n- id: pdm-export\n# command arguments, e.g.:\nargs: ['-o', 'requirements.txt', '--without-hashes']\nfiles: ^pdm.lock$\n
    "},{"location":"usage/advanced/#check-pdmlock-is-up-to-date-with-pyprojecttoml","title":"Check pdm.lock is up to date with pyproject.toml","text":"

    This hook wraps the command pdm lock --check along with any valid argument. It can be used as a hook (e.g., for CI) to ensure that whenever pyproject.toml has a dependency added/changed/removed, that pdm.lock is also up to date.

    - repo: https://github.com/pdm-project/pdm\nrev: 2.x.y # a PDM release exposing the hook\nhooks:\n- id: pdm-lock-check\n
    "},{"location":"usage/config/","title":"Configure the Project","text":"

    PDM's config command works just like git config, except that --list isn't needed to show configurations.

    Show the current configurations:

    pdm config\n

    Get one single configuration:

    pdm config pypi.url\n

    Change a configuration value and store in home configuration:

    pdm config pypi.url \"https://test.pypi.org/simple\"\n

    By default, the configuration are changed globally, if you want to make the config seen by this project only, add a --local flag:

    pdm config --local pypi.url \"https://test.pypi.org/simple\"\n

    Any local configurations will be stored in pdm.toml under the project root directory.

    "},{"location":"usage/config/#configuration-files","title":"Configuration files","text":"

    The configuration files are searched in the following order:

    1. <PROJECT_ROOT>/pdm.toml - The project configuration
    2. <CONFIG_ROOT>/config.toml - The home configuration
    3. <SITE_CONFIG_ROOT>/config.toml - The site configuration

    where <CONFIG_ROOT> is:

    • $XDG_CONFIG_HOME/pdm (~/.config/pdm in most cases) on Linux as defined by XDG Base Directory Specification
    • ~/Library/Application Support/pdm on macOS as defined by Apple File System Basics
    • %USERPROFILE%\\AppData\\Local\\pdm on Windows as defined in Known folders

    and <SITE_CONFIG_ROOT> is:

    • $XDG_CONFIG_DIRS/pdm (/etc/xdg/pdm in most cases) on Linux as defined by XDG Base Directory Specification
    • /Library/Application Support/pdm on macOS as defined by Apple File System Basics
    • C:\\ProgramData\\pdm\\pdm on Windows as defined in Known folders

    If -g/--global option is used, the first item will be replaced by <CONFIG_ROOT>/global-project/pdm.toml.

    You can find all available configuration items in Configuration Page.

    "},{"location":"usage/config/#configure-the-python-finder","title":"Configure the Python finder","text":"

    By default, PDM will try to find Python interpreters in the following sources:

    • venv: The PDM virtualenv location
    • path: The PATH environment variable
    • pyenv: The pyenv install root
    • rye: The rye toolchain install root
    • asdf: The asdf python install root
    • winreg: The Windows registry

    You can unselect some of them or change the order by setting python.providers config key:

    pdm config python.providers rye   # Rye source only\npdm config python.providers pyenv,asdf  # pyenv and asdf\n
    "},{"location":"usage/config/#allow-prereleases-in-resolution-result","title":"Allow prereleases in resolution result","text":"

    By default, pdm's dependency resolver will ignore prereleases unless there are no stable versions for the given version range of a dependency. This behavior can be changed by setting allow_prereleases to true in [tool.pdm] table:

    [tool.pdm]\nallow_prereleases = true\n
    "},{"location":"usage/config/#configure-the-package-indexes","title":"Configure the package indexes","text":"

    You can tell PDM where to to find the packages by either specifying sources in the pyproject.toml or via pypi.* configurations.

    Add sources in pyproject.toml:

    [[tool.pdm.source]]\nname = \"private\"\nurl = \"https://private.pypi.org/simple\"\nverify_ssl = true\n

    Change the default index via pdm config:

    pdm config pypi.url \"https://test.pypi.org/simple\"\n

    Add extra indexes via pdm config:

    pdm config pypi.extra.url \"https://extra.pypi.org/simple\"\n

    The available configuration options are:

    • url: The URL of the index
    • verify_ssl: (Optional)Whether to verify SSL certificates, default to true
    • username: (Optional)The username for the index
    • password: (Optional)The password for the index
    • type: (Optional) index or find_links, default to index
    About the source types

    By default, all sources are PEP 503 style \"indexes\" like pip's --index-url and --extra-index-url, however, you can set the type to find_links which contains files or links to be looked for directly. See this answer for the difference between the two types.

    These configurations are read in the following order to build the final source list:

    • pypi.url, if pypi doesn't appear in the name field of any source in pyproject.toml
    • Sources in pyproject.toml
    • pypi.<name>.url in PDM config.

    You can set pypi.ignore_stored_index to true to disable all indexes from the PDM config and only use those specified in pyproject.toml.

    Disable the default PyPI index

    If you want to omit the default PyPI index, just set the source name to pypi and that source will replace it.

    [[tool.pdm.source]]\nurl = \"https://private.pypi.org/simple\"\nverify_ssl = true\nname = \"pypi\"\n
    Indexes in pyproject.toml or config

    When you want to share the indexes with other people who are going to use the project, you should add them in pyproject.toml. For example, some packages only exist in a private index and can't be installed if someone doesn't configure the index. Otherwise, store them in the local config which won't be seen by others.

    "},{"location":"usage/config/#respect-the-order-of-the-sources","title":"Respect the order of the sources","text":"

    By default, all sources are considered equal, packages from them are sorted by the version and wheel tags, the most matching one with the highest version is selected.

    In some cases you may want to return packages from the preferred source, and search for others if they are missing from the former source. PDM supports this by reading the configuration respect-source-order:

    [tool.pdm.resolution]\nrespect-source-order = true\n
    "},{"location":"usage/config/#specify-index-for-individual-packages","title":"Specify index for individual packages","text":"

    You can bind packages to specific sources with include_packages and exclude_packages config under tool.pdm.source table.

    [[tool.pdm.source]]\nname = \"private\"\nurl = \"https://private.pypi.org/simple\"\ninclude_packages = [\"foo\", \"foo-*\"]\nexclude_packages = [\"bar-*\"]\n

    With the above configuration, any package matching foo or foo-* will only be searched from the private index, and any package matching bar-* will be searched from all indexes except private.

    Both include_packages and exclude_packages are optional and accept a list of glob patterns, and include_packages takes effect exclusively when the pattern matches.

    "},{"location":"usage/config/#store-credentials-with-the-index","title":"Store credentials with the index","text":"

    You can specify credentials in the URL with ${ENV_VAR} variable expansion and these variables will be read from the environment variables:

    [[tool.pdm.source]]\nname = \"private\"\nurl = \"https://${PRIVATE_PYPI_USERNAME}:${PRIVATE_PYPI_PASSWORD}@private.pypi.org/simple\"\n
    "},{"location":"usage/config/#configure-https-certificates","title":"Configure HTTPS certificates","text":"

    You can use a custom CA bundle or client certificate for HTTPS requests. It can be configured for both indexes(for package download) and repositories(for upload):

    pdm config pypi.ca_certs /path/to/ca_bundle.pem\npdm config repository.pypi.ca_certs /path/to/ca_bundle.pem\n

    Besides, it is possible to use the system trust store, instead of the bundled certifi certificates for verifying HTTPS certificates. This approach will typically support corporate proxy certificates without additional configuration.

    To use truststore, you need Python 3.10 or newer and install truststore into the same environment as PDM:

    $ pdm self add truststore\n
    "},{"location":"usage/config/#index-configuration-merging","title":"Index configuration merging","text":"

    Index configurations are merged with the name field of [[tool.pdm.source]] table or pypi.<name> key in the config file. This enables you to store the url and credentials separately, to avoid secrets being exposed in the source control. For example, if you have the following configuration:

    [[tool.pdm.source]]\nname = \"private\"\nurl = \"https://private.pypi.org/simple\"\n

    You can store the credentials in the config file:

    pdm config pypi.private.username \"foo\"\npdm config pypi.private.password \"bar\"\n

    PDM can retrieve the configurations for private index from both places.

    If the index requires a username and password, but they can't be found from the environment variables nor config file, PDM will prompt you to enter them. Or, if keyring is installed, it will be used as the credential store. PDM can use the keyring from either the installed package or the CLI.

    "},{"location":"usage/config/#central-installation-caches","title":"Central installation caches","text":"

    If a package is required by many projects on the system, each project has to keep its own copy. This can be a waste of disk space, especially for data science and machine learning projects.

    PDM supports caching installations of the same wheel by installing it in a centralized package repository and linking to that installation in different projects. To enable it, run:

    pdm config install.cache on\n

    It can be enabled on a per-project basis by adding the --local option to the command.

    The caches are located in $(pdm config cache_dir)/packages. You can view the cache usage with pdm cache info. Note that the cached installs are managed automatically -- they will be deleted if they are not linked to any projects. Manually deleting the caches from disk may break some projects on the system.

    Note

    Only the installation of named requirements resolved from PyPI can be cached.

    "},{"location":"usage/config/#configure-the-repositories-for-upload","title":"Configure the repositories for upload","text":"

    When using the pdm publish command, it reads the repository secrets from the global config file(<CONFIG_ROOT>/config.toml). The content of the config is as follows:

    [repository.pypi]\nusername = \"frostming\"\npassword = \"<secret>\"\n\n[repository.company]\nurl = \"https://pypi.company.org/legacy/\"\nusername = \"frostming\"\npassword = \"<secret>\"\nca_certs = \"/path/to/custom-cacerts.pem\"\n

    Alternatively, these credentials can be provided with env vars:

    export PDM_PUBLISH_REPO=...\nexport PDM_PUBLISH_USERNAME=...\nexport PDM_PUBLISH_PASSWORD=...\nexport PDM_PUBLISH_CA_CERTS=...\n

    A PEM-encoded Certificate Authority bundle (ca_certs) can be used for local / custom PyPI repositories where the server certificate is not signed by the standard certifi CA bundle.

    Note

    Repositories are different from indexes in the previous section. Repositories are for publishing while indexes are for locking and resolving. They don't share the configuration.

    Tip

    You don't need to configure the url for pypi and testpypi repositories, they are filled by default values. The username, password, and certificate authority bundle can be passed in from the command line for pdm publish via --username, --password, and --ca-certs, respectively.

    To change the repository config from the command line, use the pdm config command:

    pdm config repository.pypi.username \"__token__\"\npdm config repository.pypi.password \"my-pypi-token\"\n\npdm config repository.company.url \"https://pypi.company.org/legacy/\"\npdm config repository.company.ca_certs \"/path/to/custom-cacerts.pem\"\n
    "},{"location":"usage/config/#password-management-with-keyring","title":"Password management with keyring","text":"

    When keyring is available and supported, the passwords will be stored to and retrieved from the keyring instead of writing to the config file. This supports both indexes and upload repositories. The service name will be pdm-pypi-<name> for an index and pdm-repository-<name> for a repository.

    You can enable keyring by either installing keyring into the same environment as PDM or installing globally. To add keyring to the PDM environment:

    pdm self add keyring\n

    Alternatively, if you have installed a copy of keyring globally, make sure the CLI is exposed in the PATH env var to make it discoverable by PDM:

    export PATH=$PATH:path/to/keyring/bin\n
    "},{"location":"usage/config/#override-the-resolved-package-versions","title":"Override the resolved package versions","text":"

    New in version 1.12.0

    Sometimes you can't get a dependency resolution due to incorrect version ranges set by upstream libraries that you can't fix. In this case you can use PDM's overrides feature to force a specific version of a package to be installed.

    Given the following configuration in pyproject.toml:

    [tool.pdm.resolution.overrides]\nasgiref = \"3.2.10\"  # exact version\nurllib3 = \">=1.26.2\"  # version range\npytz = \"https://mypypi.org/packages/pytz-2020.9-py3-none-any.whl\"  # absolute URL\n

    Each entry of that table is a package name with the wanted version. In this example, PDM will resolve the above packages into the given versions no matter whether there is any other resolution available.

    Warning

    By using [tool.pdm.resolution.overrides] setting, you are at your own risk of any incompatibilities from that resolution. It can only be used if there is no valid resolution for your requirements and you know the specific version works. Most of the time, you can just add any transient constraints to the dependencies array.

    "},{"location":"usage/config/#passing-constant-arguments-to-every-pdm-invocation","title":"Passing constant arguments to every pdm invocation","text":"

    New in version 2.7.0

    You can add extra options passed to individual pdm commands by tool.pdm.options configuration:

    [tool.pdm.options]\nadd = [\"--no-isolation\", \"--no-self\"]\ninstall = [\"--no-self\"]\nlock = [\"--no-cross-platform\"]\n

    These options will be added right after the command name. For instance, based on the configuration above, pdm add requests is equivalent to pdm add --no-isolation --no-self requests.

    "},{"location":"usage/config/#ignore-package-warnings","title":"Ignore package warnings","text":"

    New in version 2.10.0

    You may see some warnings when resolving dependencies like this:

    PackageWarning: Skipping scipy@1.10.0 because it requires Python\n<3.12,>=3.8 but the project claims to work with Python>=3.9.\nNarrow down the `requires-python` range to include this version. For example, \">=3.9,<3.12\" should work.\n  warnings.warn(record.message, PackageWarning, stacklevel=1)\nUse `-q/--quiet` to suppress these warnings, or ignore them per-package with `ignore_package_warnings` config in [tool.pdm] table.\n

    This is because the supported range of Python versions of the package doesn't cover the requires-python value specified in the pyproject.toml. You can ignore these warnings in a per-package basis by adding the following config:

    [tool.pdm]\nignore_package_warnings = [\"scipy\", \"tensorflow-*\"]\n

    Where each item is a case-insensitive glob pattern to match the package name.

    "},{"location":"usage/dependency/","title":"Manage Dependencies","text":"

    PDM provides a bunch of handful commands to help manage your project and dependencies. The following examples are run on Ubuntu 18.04, a few changes must be done if you are using Windows.

    "},{"location":"usage/dependency/#add-dependencies","title":"Add dependencies","text":"

    pdm add can be followed by one or several dependencies, and the dependency specification is described in PEP 508.

    Examples:

    pdm add requests   # add requests\npdm add requests==2.25.1   # add requests with version constraint\npdm add requests[socks]   # add requests with extra dependency\npdm add \"flask>=1.0\" flask-sqlalchemy   # add multiple dependencies with different specifiers\n

    PDM also allows extra dependency groups by providing -G/--group <name> option, and those dependencies will go to [project.optional-dependencies.<name>] table in the project file, respectively.

    You can reference other optional groups in optional-dependencies, even before the package is uploaded:

    [project]\nname = \"foo\"\nversion = \"0.1.0\"\n\n[project.optional-dependencies]\nsocks = [\"pysocks\"]\njwt = [\"pyjwt\"]\nall = [\"foo[socks,jwt]\"]\n

    After that, dependencies and sub-dependencies will be resolved properly and installed for you, you can view pdm.lock to see the resolved result of all dependencies.

    "},{"location":"usage/dependency/#local-dependencies","title":"Local dependencies","text":"

    Local packages can be added with their paths. The path can be a file or a directory:

    pdm add ./sub-package\npdm add ./first-1.0.0-py2.py3-none-any.whl\n

    The paths MUST start with a ., otherwise it will be recognized as a normal named requirement. The local dependencies will be written to the pyproject.toml file with the URL format:

    [project]\ndependencies = [\n\"sub-package @ file:///${PROJECT_ROOT}/sub-package\",\n\"first @ file:///${PROJECT_ROOT}/first-1.0.0-py2.py3-none-any.whl\",\n]\n
    Using other build backends

    If you are using hatchling instead of the pdm backend, the URLs would be as follows:

    sub-package @ {root:uri}/sub-package\nfirst @ {root:uri}/first-1.0.0-py2.py3-none-any.whl\n
    Other backends doesn't support encoding relative paths in the URL and will write the absolute path instead.

    "},{"location":"usage/dependency/#url-dependencies","title":"URL dependencies","text":"

    PDM also supports downloading and installing packages directly from a web address.

    Examples:

    # Install gzipped package from a plain URL\npdm add \"https://github.com/numpy/numpy/releases/download/v1.20.0/numpy-1.20.0.tar.gz\"\n# Install wheel from a plain URL\npdm add \"https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.5.0/en_core_web_trf-3.5.0-py3-none-any.whl\"\n
    "},{"location":"usage/dependency/#vcs-dependencies","title":"VCS dependencies","text":"

    You can also install from a git repository url or other version control systems. The following are supported:

    • Git: git
    • Mercurial: hg
    • Subversion: svn
    • Bazaar: bzr

    The URL should be like: {vcs}+{url}@{rev}

    Examples:

    # Install pip repo on tag `22.0`\npdm add \"git+https://github.com/pypa/pip.git@22.0\"\n# Provide credentials in the URL\npdm add \"git+https://username:password@github.com/username/private-repo.git@master\"\n# Give a name to the dependency\npdm add \"pip @ git+https://github.com/pypa/pip.git@22.0\"\n# Or use the #egg fragment\npdm add \"git+https://github.com/pypa/pip.git@22.0#egg=pip\"\n# Install from a subdirectory\npdm add \"git+https://github.com/owner/repo.git@master#egg=pkg&subdirectory=subpackage\"\n
    "},{"location":"usage/dependency/#hide-credentials-in-the-url","title":"Hide credentials in the URL","text":"

    You can hide the credentials in the URL by using the ${ENV_VAR} variable syntax:

    [project]\ndependencies = [\n\"mypackage @ git+http://${VCS_USER}:${VCS_PASSWD}@test.git.com/test/mypackage.git@master\"\n]\n

    These variables will be read from the environment variables when installing the project.

    "},{"location":"usage/dependency/#add-development-only-dependencies","title":"Add development only dependencies","text":"

    New in 1.5.0

    PDM also supports defining groups of dependencies that are useful for development, e.g. some for testing and others for linting. We usually don't want these dependencies appear in the distribution's metadata so using optional-dependencies is probably not a good idea. We can define them as development dependencies:

    pdm add -dG test pytest\n

    This will result in a pyproject.toml as following:

    [tool.pdm.dev-dependencies]\ntest = [\"pytest\"]\n

    You can have several groups of development only dependencies. Unlike optional-dependencies, they won't appear in the package distribution metadata such as PKG-INFO or METADATA. The package index won't be aware of these dependencies. The schema is similar to that of optional-dependencies, except that it is in tool.pdm table.

    [tool.pdm.dev-dependencies]\nlint = [\n\"flake8\",\n\"black\"\n]\ntest = [\"pytest\", \"pytest-cov\"]\ndoc = [\"mkdocs\"]\n
    For backward-compatibility, if only -d or --dev is specified, dependencies will go to dev group under [tool.pdm.dev-dependencies] by default.

    Note

    The same group name MUST NOT appear in both [tool.pdm.dev-dependencies] and [project.optional-dependencies].

    "},{"location":"usage/dependency/#editable-dependencies","title":"Editable dependencies","text":"

    Local directories and VCS dependencies can be installed in editable mode. If you are familiar with pip, it is just like pip install -e <package>. Editable packages are allowed only in development dependencies:

    Note

    Editable installs are only allowed in the dev dependency group. Other groups, including the default, will fail with a [PdmUsageError].

    # A relative path to the directory\npdm add -e ./sub-package --dev\n# A file URL to a local directory\npdm add -e file:///path/to/sub-package --dev\n# A VCS URL\npdm add -e git+https://github.com/pallets/click.git@main#egg=click --dev\n
    "},{"location":"usage/dependency/#save-version-specifiers","title":"Save version specifiers","text":"

    If the package is given without a version specifier like pdm add requests. PDM provides three different behaviors of what version specifier is saved for the dependency, which is given by --save-<strategy>(Assume 2.21.0 is the latest version that can be found for the dependency):

    • minimum: Save the minimum version specifier: >=2.21.0 (default).
    • compatible: Save the compatible version specifier: >=2.21.0,<3.0.0.
    • exact: Save the exact version specifier: ==2.21.0.
    • wildcard: Don't constrain version and leave the specifier to be wildcard: *.
    "},{"location":"usage/dependency/#add-prereleases","title":"Add prereleases","text":"

    One can give --pre/--prerelease option to pdm add so that prereleases are allowed to be pinned for the given packages.

    "},{"location":"usage/dependency/#update-existing-dependencies","title":"Update existing dependencies","text":"

    To update all dependencies in the lock file:

    pdm update\n

    To update the specified package(s):

    pdm update requests\n

    To update multiple groups of dependencies:

    pdm update -G security -G http\n

    Or using comma-separated list:

    pdm update -G \"security,http\"\n

    To update a given package in the specified group:

    pdm update -G security cryptography\n

    If the group is not given, PDM will search for the requirement in the default dependencies set and raises an error if none is found.

    To update packages in development dependencies:

    # Update all default + dev-dependencies\npdm update -d\n# Update a package in the specified group of dev-dependencies\npdm update -dG test pytest\n
    "},{"location":"usage/dependency/#about-update-strategy","title":"About update strategy","text":"

    Similarly, PDM also provides 3 different behaviors of updating dependencies and sub-dependencies\uff0c which is given by --update-<strategy> option:

    • reuse: Keep all locked dependencies except for those given in the command line (default).
    • eager: Try to lock a newer version of the packages in command line and their recursive sub-dependencies and keep other dependencies as they are.
    • all: Update all dependencies and sub-dependencies.
    "},{"location":"usage/dependency/#update-packages-to-the-versions-that-break-the-version-specifiers","title":"Update packages to the versions that break the version specifiers","text":"

    One can give -u/--unconstrained to tell PDM to ignore the version specifiers in the pyproject.toml. This works similarly to the yarn upgrade -L/--latest command. Besides, pdm update also supports the --pre/--prerelease option.

    "},{"location":"usage/dependency/#remove-existing-dependencies","title":"Remove existing dependencies","text":"

    To remove existing dependencies from project file and the library directory:

    # Remove requests from the default dependencies\npdm remove requests\n# Remove h11 from the 'web' group of optional-dependencies\npdm remove -G web h11\n# Remove pytest-cov from the `test` group of dev-dependencies\npdm remove -dG test pytest-cov\n
    "},{"location":"usage/dependency/#install-the-packages-pinned-in-lock-file","title":"Install the packages pinned in lock file","text":"

    There are a few similar commands to do this job with slight differences:

    • pdm sync installs packages from the lock file.
    • pdm update will update the lock file, then sync.
    • pdm install will check the project file for changes, update the lock file if needed, then sync.

    sync also has a few options to manage installed packages:

    • --clean: will remove packages no longer in the lockfile
    • --only-keep: only selected packages (using options like -G or --prod) will be kept.
    "},{"location":"usage/dependency/#specify-the-lockfile-to-use","title":"Specify the lockfile to use","text":"

    You can specify another lockfile than the default pdm lock by using the -L/--lockfile <filepath> option or the PDM_LOCKFILE environment variable.

    "},{"location":"usage/dependency/#select-a-subset-of-dependency-groups-to-be-installed-or-locked","title":"Select a subset of dependency groups to be installed or locked","text":"

    Say we have a project with following dependencies:

    [project]  # This is production dependencies\ndependencies = [\"requests\"]\n\n[project.optional-dependencies]  # This is optional dependencies\nextra1 = [\"flask\"]\nextra2 = [\"django\"]\n\n[tool.pdm.dev-dependencies]  # This is dev dependencies\ndev1 = [\"pytest\"]\ndev2 = [\"mkdocs\"]\n
    Command What it does Comments pdm install install all groups locked in the lockfile pdm install -G extra1 install prod deps, dev deps, and \"extra1\" optional group pdm install -G dev1 install prod deps and only \"dev1\" dev group pdm install -G:all install prod deps, dev deps and \"extra1\", \"extra2\" optional groups pdm install -G extra1 -G dev1 install prod deps, \"extra1\" optional group and only \"dev1\" dev group pdm install --prod install prod only pdm install --prod -G extra1 install prod deps and \"extra1\" optional pdm install --prod -G dev1 Fail, --prod can't be given with dev dependencies Leave the --prod option

    All development dependencies are included as long as --prod is not passed and -G doesn't specify any dev groups.

    Besides, if you don't want the root project to be installed, add --no-self option, and --no-editable can be used when you want all packages to be installed in non-editable versions.

    You may also use the pdm lock command with these options to lock only the specified groups, which will be recorded in the [metadata] table of the lock file. If no --group/--prod/--dev/--no-default option is specified, pdm sync and pdm update will operate using the groups in the lockfile. However, if any groups that are not included in the lockfile are given as arguments to the commands, PDM will raise an error.

    This feature is especially valuable when managing multiple lockfiles, where each may have different versions of the same package pinned. To switch between lockfiles, you can use the --lockfile/-L option.

    For a realistic example, your project depends on a release version of werkzeug and you may want to work with a local in-development copy of it when developing. You can add the following to your pyproject.toml:

    [project]\nrequires-python = \">=3.7\"\ndependencies = [\"werkzeug\"]\n\n[tool.pdm.dev-dependencies]\ndev = [\"werkzeug @ file:///${PROJECT_ROOT}/dev/werkzeug\"]\n

    Then, run pdm lock with different options to generate lockfiles for different purposes:

    # Lock default + dev, write to pdm.lock\n# with the local copy of werkzeug pinned.\npdm lock\n# Lock default, write to pdm.prod.lock\n# with the release version of werkzeug pinned.\npdm lock --prod -L pdm.prod.lock\n

    Check the metadata.groups field in the lockfile to see which groups are included.

    "},{"location":"usage/dependency/#lock-strategies","title":"Lock strategies","text":"

    Currently, we support three flags to control the locking behavior: cross_platform, static_urls and direct_minimal_versions, with the meanings as follows. You can pass one or more flags to pdm lock by --strategy/-S option, either by giving a comma-separated list or by passing the option multiple times. Both of these commands function in the same way:

    pdm lock -S cross_platform,static_urls\npdm lock -S cross_platform -S static_urls\n

    The flags will be encoded in the lockfile and get read when you run pdm lock next time. But you can disable flags by prefixing the flag name with no_:

    pdm lock -S no_cross_platform\n

    This command makes the lockfile not cross-platform.

    "},{"location":"usage/dependency/#cross-platform","title":"Cross platform","text":"

    New in version 2.6.0

    By default, the generated lockfile is cross-platform, which means the current platform isn't taken into account when resolving the dependencies. The result lockfile will contain wheels and dependencies for all possible platforms and Python versions. However, sometimes this will result in a wrong lockfile when a release doesn't contain all wheels. To avoid this, you can tell PDM to create a lockfile that works for this platform only, trimming the wheels not relevant to the current platform. This can be done by passing the --strategy no_cross_platform option to pdm lock:

    pdm lock --strategy no_cross_platform\n
    "},{"location":"usage/dependency/#static-urls","title":"Static URLs","text":"

    New in version 2.8.0

    By default, PDM only stores the filenames of the packages in the lockfile, which benefits the reusability across different package indexes. However, if you want to store the static URLs of the packages in the lockfile, you can pass the --strategy static_urls option to pdm lock:

    pdm lock --strategy static_urls\n

    The settings will be saved and remembered for the same lockfile. You can also pass --strategy no_static_urls to disable it.

    "},{"location":"usage/dependency/#direct-minimal-versions","title":"Direct minimal versions","text":"

    New in version 2.10.0

    When it is enabled by passing --strategy direct_minimal_versions, dependencies specified in the pyproject.toml will be resolved to the minimal versions available, rather than the latest versions. This is useful when you want to test the compatibility of your project within a range of dependency versions.

    For example, if you specified flask>=2.0 in the pyproject.toml, flask will be resolved to version 2.0.0 if there is no other compatibility issue.

    Note

    Version constraints in package dependencies are not future-proof. If you resolve the dependencies to the minimal versions, there will likely be backwards-compatibility issues. For example, flask==2.0.0 requires werkzeug>=2.0, but in fact, it can not work with Werkzeug 3.0.0, which is released 2 years after it.

    "},{"location":"usage/dependency/#show-what-packages-are-installed","title":"Show what packages are installed","text":"

    Similar to pip list, you can list all packages installed in the packages directory:

    pdm list\n
    "},{"location":"usage/dependency/#include-and-exclude-groups","title":"Include and exclude groups","text":"

    By default, all packages installed in the working set will be listed. You can specify which groups to be listed by --include/--exclude options, and include has a higher priority than exclude.

    pdm list --include dev\npdm list --exclude test\n

    There is a special group :sub, when included, all transitive dependencies will also be shown. It is included by default.

    You can also pass --resolve to pdm list, which will show the packages resolved in pdm.lock, rather than installed in the working set.

    "},{"location":"usage/dependency/#change-the-output-fields-and-format","title":"Change the output fields and format","text":"

    By default, name, version and location will be shown in the list output, you can view more fields or specify the order of fields by --fields option:

    pdm list --fields name,license,version\n

    For all supported fields, please refer to the CLI reference.

    Also, you can specify the output format other than the default table output. The supported formats and options are --csv, --json, --markdown and --freeze.

    "},{"location":"usage/dependency/#show-the-dependency-tree","title":"Show the dependency tree","text":"

    Or show a dependency tree by:

    $ pdm list --tree\ntempenv 0.0.0\n\u2514\u2500\u2500 click 7.0 [ required: <7.0.0,>=6.7 ]\nblack 19.10b0\n\u251c\u2500\u2500 appdirs 1.4.3 [ required: Any ]\n\u251c\u2500\u2500 attrs 19.3.0 [ required: >=18.1.0 ]\n\u251c\u2500\u2500 click 7.0 [ required: >=6.5 ]\n\u251c\u2500\u2500 pathspec 0.7.0 [ required: <1,>=0.6 ]\n\u251c\u2500\u2500 regex 2020.2.20 [ required: Any ]\n\u251c\u2500\u2500 toml 0.10.0 [ required: >=0.9.4 ]\n\u2514\u2500\u2500 typed-ast 1.4.1 [ required: >=1.4.0 ]\nbump2version 1.0.0\n

    Note that --fields option doesn't work with --tree.

    "},{"location":"usage/dependency/#filter-packages-by-patterns","title":"Filter packages by patterns","text":"

    You can also limit the packages to show by passing the patterns to pdm list:

    pdm list flask-* requests-*\n
    Be careful with the shell expansion

    In most shells, the wildcard * will be expanded if there are matching files under the current directory. To avoid getting unexpected results, you can quote the patterns: pdm list 'flask-*' 'requests-*'.

    In --tree mode, only the subtree of the matched packages will be displayed. This can be used to achieve the same purpose as pnpm why, which is to show why a specific package is required.

    $ pdm list --tree --reverse certifi\ncertifi 2023.7.22\n\u2514\u2500\u2500 requests 2.31.0 [ requires: >=2017.4.17 ]\n\u2514\u2500\u2500 cachecontrol[filecache] 0.13.1 [ requires: >=2.16.0 ]\n
    "},{"location":"usage/dependency/#allow-prerelease-versions-to-be-installed","title":"Allow prerelease versions to be installed","text":"

    Include the following setting in pyproject.toml to enable:

    [tool.pdm]\nallow_prereleases = true\n
    "},{"location":"usage/dependency/#set-acceptable-format-for-locking-or-installing","title":"Set acceptable format for locking or installing","text":"

    If you want to control the format(binary/sdist) of the packages, you can set the env vars PDM_NO_BINARY and PDM_ONLY_BINARY.

    Each env var is a comma-separated list of package name. You can set it to :all: to apply to all packages. For example:

    # No binary for werkzeug will be locked nor used for installation\nPDM_NO_BINARY=werkzeug pdm add flask\n# Only binaries will be locked in the lock file\nPDM_ONLY_BINARY=:all: pdm lock\n# No binaries will be used for installation\nPDM_NO_BINARY=:all: pdm install\n# Prefer binary distributions and even if sdist with higher version is available\nPDM_PREFER_BINARY=flask pdm install\n
    "},{"location":"usage/dependency/#solve-the-locking-failure","title":"Solve the locking failure","text":"

    If PDM is not able to find a resolution to satisfy the requirements, it will raise an error. For example,

    pdm django==3.1.4 \"asgiref<3\"\n...\n\ud83d\udd12 Lock failed\nUnable to find a resolution for asgiref because of the following conflicts:\n  asgiref<3 (from project)\nasgiref<4,>=3.2.10 (from <Candidate django 3.1.4 from https://pypi.org/simple/django/>)\nTo fix this, you could loosen the dependency version constraints in pyproject.toml. If that is not possible, you could also override the resolved version in `[tool.pdm.resolution.overrides]` table.\n

    You can either change to a lower version of django or remove the upper bound of asgiref. But if it is not eligible for your project, you can try overriding the resolved package versions in pyproject.toml.

    "},{"location":"usage/dependency/#manage-global-project","title":"Manage global project","text":"

    Sometimes users may want to keep track of the dependencies of global Python interpreter as well. It is easy to do so with PDM, via -g/--global option which is supported by most subcommands.

    If the option is passed, <CONFIG_ROOT>/global-project will be used as the project directory, which is almost the same as normal project except that pyproject.toml will be created automatically for you and it doesn't support build features. The idea is taken from Haskell's stack.

    However, unlike stack, by default, PDM won't use global project automatically if a local project is not found. Users should pass -g/--global explicitly to activate it, since it is not very pleasing if packages go to a wrong place. But PDM also leave the decision to users, just set the config global_project.fallback to true.

    By default, when pdm uses global project implicitly the following message is printed: Project is not found, fallback to the global project. To disable this message set the config global_project.fallback_verbose to false.

    If you want global project to track another project file other than <CONFIG_ROOT>/global-project, you can provide the project path via -p/--project <path> option. Especially if you pass --global --project ., PDM will install the dependencies of the current project into the global Python.

    Warning

    Be careful with remove and sync --clean/--pure commands when global project is used, because it may remove packages installed in your system Python.

    "},{"location":"usage/dependency/#export-locked-packages-to-alternative-formats","title":"Export locked packages to alternative formats","text":"

    You can also export pdm lock to other formats, to ease the CI flow or image building process. Currently, only requirements.txt format is supported:

    pdm export -o requirements.txt\n

    Note

    You can also run pdm export with a .pre-commit hook.

    "},{"location":"usage/hooks/","title":"Lifecycle and Hooks","text":"

    As any Python deliverable, your project will go through the different phases of a Python project lifecycle and PDM provides commands to perform the expected tasks for those phases.

    It also provides hooks attached to these steps allowing for:

    • plugins to listen to the signals of the same name.
    • developers to define custom scripts with the same name.

    Besides, pre_invoke signal is emitted before ANY command is invoked, allowing plugins to modify the project or options beforehand.

    The built-in commands are currently split into 3 groups:

    • the initialization phase
    • the dependencies management.
    • the publication phase.

    You will most probably need to perform some recurrent tasks between the installation and publication phases (housekeeping, linting, testing, ...) this is why PDM lets you define your own tasks/phases using user scripts.

    To provides full flexibility, PDM allows to skip some hooks and tasks on demand.

    "},{"location":"usage/hooks/#initialization","title":"Initialization","text":"

    The initialization phase should occur only once in a project lifetime by running the pdm init command to initialize an existing project (prompt to fill the pyproject.toml file).

    They trigger the following hooks:

    • post_init
    flowchart LR\n  subgraph pdm-init [pdm init]\n    direction LR\n    post-init{{Emit post_init}}\n    init --> post-init\n  end
    "},{"location":"usage/hooks/#dependencies-management","title":"Dependencies management","text":"

    The dependencies management is required for the developer to be able to work and perform the following:

    • lock: compute a lock file from the pyproject.toml requirements.
    • sync: synchronize (add/remove/update) PEP582 packages from the lock file and install the current project as editable.
    • add: add a dependency
    • remove: remove a dependency

    All those steps are directly available with the following commands:

    • pdm lock: execute the lock task
    • pdm sync: execute the sync task
    • pdm install: execute the sync task, preceded from lock if required
    • pdm add: add a dependency requirement, re-lock and then sync
    • pdm remove: remove a dependency requirement, re-lock and then sync
    • pdm update: re-lock dependencies from their latest versions and then sync

    They trigger the following hooks:

    • pre_install
    • post_install
    • pre_lock
    • post_lock
    flowchart LR\n  subgraph pdm-install [pdm install]\n    direction LR\n\n    subgraph pdm-lock [pdm lock]\n      direction TB\n      pre-lock{{Emit pre_lock}}\n      post-lock{{Emit post_lock}}\n      pre-lock --> lock --> post-lock\n    end\n\n    subgraph pdm-sync [pdm sync]\n      direction TB\n      pre-install{{Emit pre_install}}\n      post-install{{Emit post_install}}\n      pre-install --> sync --> post-install\n    end\n\n    pdm-lock --> pdm-sync\n  end
    "},{"location":"usage/hooks/#switching-python-version","title":"Switching Python version","text":"

    This is a special case in dependency management: you can switch the current Python version using pdm use and it will emit the post_use signal with the new Python interpreter.

    flowchart LR\n  subgraph pdm-use [pdm use]\n    direction LR\n    post-use{{Emit post_use}}\n    use --> post-use\n  end
    "},{"location":"usage/hooks/#publication","title":"Publication","text":"

    As soon as you are ready to publish your package/library, you will require the publication tasks:

    • build: build/compile assets requiring it and package everything into a Python package (sdist, wheel)
    • upload: upload/publish the package to a remote PyPI index

    All those steps are available with the following commands:

    • pdm build
    • pdm publish

    They trigger the following hooks:

    • pre_publish
    • post_publish
    • pre_build
    • post_build
    flowchart LR\n  subgraph pdm-publish [pdm publish]\n    direction LR\n    pre-publish{{Emit pre_publish}}\n    post-publish{{Emit post_publish}}\n\n    subgraph pdm-build [pdm build]\n      pre-build{{Emit pre_build}}\n      post-build{{Emit post_build}}\n      pre-build --> build --> post-build\n    end\n\n    %% subgraph pdm-upload [pdm upload]\n    %%   pre-upload{{Emit pre_upload}}\n    %%   post-upload{{Emit post_upload}}\n    %%   pre-upload --> upload --> post-upload\n    %% end\n\n    pre-publish --> pdm-build --> upload --> post-publish\n  end

    Execution will stop at first failure, hooks included.

    "},{"location":"usage/hooks/#user-scripts","title":"User scripts","text":"

    User scripts are detailed in their own section but you should know that:

    • each user script can define a pre_* and post_* script, including composite scripts.
    • each run execution will trigger the pre_run and post_run hooks
    • each script execution will trigger the pre_script and post_script hooks

    Given the following scripts definition:

    [tool.pdm.scripts]\npre_script = \"\"\npost_script = \"\"\npre_test = \"\"\npost_test = \"\"\ntest = \"\"\npre_composite = \"\"\npost_composite = \"\"\ncomposite = {composite = [\"test\"]}\n

    a pdm run test will have the following lifecycle:

    flowchart LR\n  subgraph pdm-run-test [pdm run test]\n    direction LR\n    pre-run{{Emit pre_run}}\n    post-run{{Emit post_run}}\n    subgraph run-test [test task]\n      direction TB\n      pre-script{{Emit pre_script}}\n      post-script{{Emit post_script}}\n      pre-test[Execute pre_test]\n      post-test[Execute post_test]\n      test[Execute test]\n\n      pre-script --> pre-test --> test --> post-test --> post-script\n    end\n\n    pre-run --> run-test --> post-run\n  end

    while pdm run composite will have the following:

    flowchart LR\n  subgraph pdm-run-composite [pdm run composite]\n    direction LR\n    pre-run{{Emit pre_run}}\n    post-run{{Emit post_run}}\n\n    subgraph run-composite [composite task]\n      direction TB\n      pre-script-composite{{Emit pre_script}}\n      post-script-composite{{Emit post_script}}\n      pre-composite[Execute pre_composite]\n      post-composite[Execute post_composite]\n\n      subgraph run-test [test task]\n        direction TB\n        pre-script-test{{Emit pre_script}}\n        post-script-test{{Emit post_script}}\n        pre-test[Execute pre_test]\n        post-test[Execute post_test]\n\n        pre-script-test --> pre-test --> test --> post-test --> post-script-test\n      end\n\n      pre-script-composite --> pre-composite --> run-test --> post-composite --> post-script-composite\n    end\n\n     pre-run --> run-composite --> post-run\n  end
    "},{"location":"usage/hooks/#skipping","title":"Skipping","text":"

    It is possible to control which task and hook runs for any built-in command as well as custom user scripts using the --skip option.

    It accepts a comma-separated list of hooks/task names to skip as well as the predefined :all, :pre and :post shortcuts respectively skipping all hooks, all pre_* hooks and all post_* hooks. You can also provide the skip list in PDM_SKIP_HOOKS environment variable but it will be overridden as soon as the --skip parameter is provided.

    Given the previous script block, running pdm run --skip=:pre,post_test composite will result in the following reduced lifecycle:

    flowchart LR\n  subgraph pdm-run-composite [pdm run composite]\n    direction LR\n    post-run{{Emit post_run}}\n\n    subgraph run-composite [composite task]\n      direction TB\n      post-script-composite{{Emit post_script}}\n      post-composite[Execute post_composite]\n\n      subgraph run-test [test task]\n        direction TB\n        post-script-test{{Emit post_script}}\n\n        test --> post-script-test\n      end\n\n      run-test --> post-composite --> post-script-composite\n    end\n\n     run-composite --> post-run\n  end
    "},{"location":"usage/pep582/","title":"Working with PEP 582","text":"

    PEP 582 has been rejected

    This is a rejected PEP. However, due to the fact that this feature is the reason for PDM's birth, PDM will retain the support. We recommend using virtual environments instead.

    With PEP 582, dependencies will be installed into __pypackages__ directory under the project root. With PEP 582 enabled globally, you can also use the project interpreter to run scripts directly.

    When the project interpreter is a normal Python, this mode is enabled.

    Besides, on a project you work with for the first time on your machine, if it contains an empty __pypackages__ directory, PEP 582 is enabled automatically, and virtualenv won't be created.

    "},{"location":"usage/pep582/#enable-pep-582-globally","title":"Enable PEP 582 globally","text":"

    To make the Python interpreters aware of PEP 582 packages, one need to add the pdm/pep582/sitecustomize.py to the Python library search path.

    WindowsMac and Linux

    One just needs to execute pdm --pep582, then environment variable will be changed automatically. Don't forget to restart the terminal session to take effect.

    The command to change the environment variables can be printed by pdm --pep582 [<SHELL>]. If <SHELL> isn't given, PDM will pick one based on some guesses. You can run eval \"$(pdm --pep582)\" to execute the command.

    You may want to write a line in your .bash_profile(or similar profiles) to make it effective when logging in. For example, in bash you can do this:

    pdm --pep582 >> ~/.bash_profile\n

    Once again, Don't forget to restart the terminal session to take effect.

    How is it done?

    Thanks to the site packages loading on Python startup. It is possible to patch the sys.path by executing the sitecustomize.py shipped with PDM. The interpreter can search the directories for the nearest __pypackage__ folder and append it to the sys.path variable.

    "},{"location":"usage/pep582/#configure-ide-to-support-pep-582","title":"Configure IDE to support PEP 582","text":"

    Now there are no built-in support or plugins for PEP 582 in most IDEs, you have to configure your tools manually.

    "},{"location":"usage/pep582/#pycharm","title":"PyCharm","text":"

    Mark __pypackages__/<major.minor>/lib as Sources Root. Then, select as Python interpreter a Python installation with the same <major.minor> version.

    Additionally, if you want to use tools from the environment (e.g. pytest), you have to add the __pypackages__/<major.minor>/bin directory to the PATH variable in the corresponding run/debug configuration.

    "},{"location":"usage/pep582/#vscode","title":"VSCode","text":"

    Add the following two entries to the top-level dict in .vscode/settings.json:

    {\n\"python.autoComplete.extraPaths\": [\"__pypackages__/<major.minor>/lib\"],\n\"python.analysis.extraPaths\": [\"__pypackages__/<major.minor>/lib\"]\n}\n

    This file can be auto-generated with plugin pdm-vscode.

    Enable PEP582 globally, and make sure VSCode runs using the same user and shell you enabled PEP582 for.

    Cannot enable PEP582 globally?

    If for some reason you cannot enable PEP582 globally, you can still configure each \"launch\" in each project: set the PYTHONPATH environment variable in your launch configuration, in .vscode/launch.json. For example, to debug your pytest run:

    {\n\"version\": \"0.2.0\",\n\"configurations\": [\n{\n\"name\": \"pytest\",\n\"type\": \"python\",\n\"request\": \"launch\",\n\"module\": \"pytest\",\n\"args\": [\"tests\"],\n\"justMyCode\": false,\n\"env\": {\"PYTHONPATH\": \"__pypackages__/<major.minor>/lib\"}\n}\n]\n}\n

    If your package resides in a src directory, add it to PYTHONPATH as well:

    \"env\": {\"PYTHONPATH\": \"src:__pypackages__/<major.minor>/lib\"}\n
    Using Pylance/Pyright?

    If you have configured \"python.analysis.diagnosticMode\": \"workspace\", and you see a ton of errors/warnings as a result. you may need to create pyrightconfig.json in the workspace directory, and fill in the following fields:

    {\n\"exclude\": [\"__pypackages__\"]\n}\n

    Then restart the language server or VS Code and you're good to go. In the future (microsoft/pylance-release#1150), maybe the problem will be solved.

    Using Jupyter Notebook?

    If you wish to use pdm to install jupyter notebook and use it in vscode in conjunction with the python extension:

    1. Use pdm add notebook or so to install notebook
    2. Add a .env file inside of your project directory with contents like the following:
    PYTHONPATH=/your-workspace-path/__pypackages__/<major>.<minor>/lib\n

    If the above still doesn't work, it's most likely because the environment variable is not properly loaded when the Notebook starts. There are two workarounds.

    1. Run code . in Terminal. It will open a new VSCode window in the current directory with the path set correctly. Use the Jupyter Notebook in the new window
    2. If you prefer not to open a new window, run the following at the beginning of your Jupyter Notebook to explicitly set the path:
    import sys\nsys.path.append('/your-workspace-path/__pypackages__/<major>.<minor>/lib')\n

    Reference Issue

    PDM Task Provider

    In addition, there is a VSCode Task Provider extension available for download.

    This makes it possible for VSCode to automatically detect pdm scripts so they can be run natively as VSCode Tasks.

    "},{"location":"usage/pep582/#neovim","title":"Neovim","text":"

    If using neovim-lsp with pyright and want your __pypackages__ directory to be added to the path, you can add this to your project's pyproject.toml.

    [tool.pyright]\nextraPaths = [\"__pypackages__/<major.minor>/lib/\"]\n
    "},{"location":"usage/pep582/#emacs","title":"Emacs","text":"

    You have a few options, but basically you'll want to tell an LSP client to add __pypackages__ to the paths it looks at. Here are a few options that are available:

    "},{"location":"usage/pep582/#using-pyprojecttoml-and-pyright","title":"Using pyproject.toml and pyright","text":"

    Add this to your project's pyproject.toml:

    [tool.pyright]\nextraPaths = [\"__pypackages__/<major.minor>/lib/\"]\n
    "},{"location":"usage/pep582/#eglot-pyright","title":"eglot + pyright","text":"

    Using pyright and eglot (included in Emacs 29), add the following to your config:

    (defun get-pdm-packages-path ()\n\"For the current PDM project, find the path to the packages.\"\n(let ((packages-path (string-trim (shell-command-to-string \"pdm info --packages\"))))\n(concat packages-path \"/lib\")))\n\n(defun my/eglot-workspace-config (server)\n\"For the current PDM project, dynamically generate a python lsp config.\"\n`(:python\\.analysis (:extraPaths ,(vector (get-pdm-packages-path)))))\n\n(setq-default eglot-workspace-configuration #'my/eglot-workspace-config)\n

    You'll want pyright installed either globally, or in your project (probably as a dev dependency). You can add this with, for example:

    pdm add --dev --group devel pyright\n
    "},{"location":"usage/pep582/#lsp-mode-lsp-python-ms","title":"LSP-Mode + lsp-python-ms","text":"

    Below is a sample code snippet showing how to make PDM work with lsp-python-ms in Emacs. Contributed by @linw1995.

      ;; TODO: Cache result\n(defun linw1995/pdm-get-python-executable (&optional dir)\n(let ((pdm-get-python-cmd \"pdm info --python\"))\n(string-trim\n(shell-command-to-string\n(if dir\n(concat \"cd \"\ndir\n\" && \"\npdm-get-python-cmd)\npdm-get-python-cmd)))))\n\n(defun linw1995/pdm-get-packages-path (&optional dir)\n(let ((pdm-get-packages-cmd \"pdm info --packages\"))\n(concat (string-trim\n(shell-command-to-string\n(if dir\n(concat \"cd \"\ndir\n\" && \"\npdm-get-packages-cmd)\npdm-get-packages-cmd)))\n\"/lib\")))\n\n(use-package lsp-python-ms\n:ensure t\n:init (setq lsp-python-ms-auto-install-server t)\n:hook (python-mode\n. (lambda ()\n(setq lsp-python-ms-python-executable (linw1995/pdm-get-python-executable))\n(setq lsp-python-ms-extra-paths (vector (linw1995/pdm-get-packages-path)))\n(require 'lsp-python-ms)\n(lsp))))  ; or lsp-deferred\n
    "},{"location":"usage/project/","title":"New Project","text":"

    To start with, create a new project with pdm init:

    mkdir my-project && cd my-project\npdm init\n

    You will need to answer a few questions, to help PDM to create a pyproject.toml file for you. For more usages of pdm init, please read Create your project from a template.

    "},{"location":"usage/project/#choose-a-python-interpreter","title":"Choose a Python interpreter","text":"

    At first, you need to choose a Python interpreter from a list of Python versions installed on your machine. The interpreter path will be stored in .pdm-python and used by subsequent commands. You can also change it later with pdm use.

    Alternatively, you can specify the Python interpreter path via PDM_PYTHON environment variable. When it is set, the path saved in .pdm-python will be ignored.

    "},{"location":"usage/project/#virtualenv-or-not","title":"Virtualenv or not","text":"

    After you select the Python interpreter, PDM will ask you whether you want to create a virtual environment for the project. If you choose yes, PDM will create a virtual environment in the project root directory, and use it as the Python interpreter for the project.

    If the selected Python interpreter is in a virtual environment, PDM will use it as the project environment and install dependencies into it. Otherwise, __pypackages__ will be created in the project root and dependencies will be installed into it.

    For the difference between these two approaches, please refer to the corresponding sections in the docs:

    • Virtualenv
    • __pypackages__(PEP 582)
    "},{"location":"usage/project/#library-or-application","title":"Library or Application","text":"

    A library and an application differ in many ways. In short, a library is a package that is intended to be installed and used by other projects. In most cases it also needs to be uploaded to PyPI. An application, on the other hand, is one that is directly facing end users and may need to be deployed into some production environments.

    In PDM, if you choose to create a library, PDM will add a name, version field to the pyproject.toml file, as well as a [build-system] table for the build backend, which is only useful if your project needs to be built and distributed. So you need to manually add these fields to pyproject.toml if you want to change the project from an application to a library. Also, a library project will be installed into the environment when you run pdm install or pdm sync, unless --no-self is specified.

    "},{"location":"usage/project/#set-requires-python-value","title":"Set requires-python value","text":"

    You need to set an appropriate requires-python value for your project. This is an important property that affects how dependencies are resolved. Basically, each package's requires-python must cover the project's requires-python range. For example, consider the following setup:

    • Project: requires-python = \">=3.9\"
    • Package foo: requires-python = \">=3.7,<3.11\"

    Resolving the dependencies will cause a ResolutionImpossible:

    Unable to find a resolution because the following dependencies don't work\non all Python versions defined by the project's `requires-python`\n

    Because the dependency's requires-python is >=3.7,<3.11, it doesn't cover the project's requires-python range of >=3.9. In other words, the project promises to work on Python 3.11 and above, but the dependency doesn't support it. Since PDM creates a cross-platform lockfile that should work on all Python versions within the requires-python range, it can't find a valid resolution. To fix this, you need add a maximum version to requires-python, like >=3.9,<3.11.

    The value of requires-python is a version specifier as defined in PEP 440. Here are some examples:

    requires-python Meaning >=3.7 Python 3.7 and above >=3.7,<3.11 Python 3.7, 3.8 and 3.10 >=3.6,!=3.8.*,!=3.9.* Python 3.6 and above, except 3.8 and 3.9"},{"location":"usage/project/#working-with-python-37","title":"Working with Python < 3.7","text":"

    Although PDM run on Python 3.7 and above, you can still have lower Python versions for your working project. But remember, if your project is a library, which needs to be built, published or installed, you make sure the PEP 517 build backend being used supports the lowest Python version you need. For instance, the default backend pdm-backend only works on Python 3.7+, so if you run pdm build on a project with Python 3.6, you will get an error. Most modern build backends have dropped the support for Python 3.6 and lower, so it is highly recommended to upgrade the Python version to 3.7+. Here are the supported Python range for some commonly used build backends, we only list those that support PEP 621 since otherwise PDM can't work with them.

    Backend Supported Python Support PEP 621 pdm-backend >=3.7 Yes setuptools>=60 >=3.7 Experimental hatchling >=3.7 Yes flit-core>=3.4 >=3.6 Yes flit-core>=3.2,<3.4 >=3.4 Yes

    Note that if your project is an application (i.e. without the name metadata), the above limitation of backends does not apply. Therefore, if you don't need a build backend you can use any Python version >=2.7.

    "},{"location":"usage/project/#import-the-project-from-other-package-managers","title":"Import the project from other package managers","text":"

    If you are already using other package manager tools like Pipenv or Poetry, it is easy to migrate to PDM. PDM provides import command so that you don't have to initialize the project manually, it now supports:

    1. Pipenv's Pipfile
    2. Poetry's section in pyproject.toml
    3. Flit's section in pyproject.toml
    4. requirements.txt format used by pip
    5. setuptools setup.py(It requires setuptools to be installed in the project environment. You can do this by configuring venv.with_pip to true for venv and pdm add setuptools for __pypackages__)

    Also, when you are executing pdm init or pdm install, PDM can auto-detect possible files to import if your PDM project has not been initialized yet.

    Info

    Converting a setup.py will execute the file with the project interpreter. Make sure setuptools is installed with the interpreter and the setup.py is trusted.

    "},{"location":"usage/project/#working-with-version-control","title":"Working with version control","text":"

    You must commit the pyproject.toml file. You should commit the pdm.lock and pdm.toml file. Do not commit the .pdm-python file.

    The pyproject.toml file must be committed as it contains the project's build metadata and dependencies needed for PDM. It is also commonly used by other python tools for configuration. Read more about the pyproject.toml file at Pip documentation.

    You should be committing the pdm.lock file, by doing so you ensure that all installers are using the same versions of dependencies. To learn how to update dependencies see update existing dependencies.

    pdm.toml contains some project-wide configuration and it may be useful to commit it for sharing.

    .pdm-python stores the Python path used by the current project and doesn't need to be shared.

    "},{"location":"usage/project/#show-the-current-python-environment","title":"Show the current Python environment","text":"
    $ pdm info\nPDM version:\n  2.0.0\nPython Interpreter:\n  /opt/homebrew/opt/python@3.9/bin/python3.9 (3.9)\nProject Root:\n  /Users/fming/wkspace/github/test-pdm\nProject Packages:\n  /Users/fming/wkspace/github/test-pdm/__pypackages__/3.9\n\n# Show environment info\n$ pdm info --env\n{\n\"implementation_name\": \"cpython\",\n  \"implementation_version\": \"3.8.0\",\n  \"os_name\": \"nt\",\n  \"platform_machine\": \"AMD64\",\n  \"platform_release\": \"10\",\n  \"platform_system\": \"Windows\",\n  \"platform_version\": \"10.0.18362\",\n  \"python_full_version\": \"3.8.0\",\n  \"platform_python_implementation\": \"CPython\",\n  \"python_version\": \"3.8\",\n  \"sys_platform\": \"win32\"\n}\n

    This command is useful for checking which mode is being used by the project:

    • If Project Packages is None, virtualenv mode is enabled.
    • Otherwise, PEP 582 mode is enabled.

    Now, you have set up a new PDM project and get a pyproject.toml file. Refer to metadata section about how to write pyproject.toml properly.

    "},{"location":"usage/publish/","title":"Build and Publish","text":"

    If you are developing a library, after adding dependencies to your project, and finishing the coding, it's time to build and publish your package. It is as simple as one command:

    pdm publish\n

    This will automatically build a wheel and a source distribution(sdist), and upload them to the PyPI index.

    To specify another repository other than PyPI, use the --repository option, the parameter can be either the upload URL or the name of the repository stored in the config file.

    pdm publish --repository testpypi\npdm publish --repository https://test.pypi.org/legacy/\n
    "},{"location":"usage/publish/#publish-with-trusted-publishers","title":"Publish with trusted publishers","text":"

    You can configure trusted publishers for PyPI so that you don't need to expose the PyPI tokens in the release workflow. To do this, follow the guide to add a publisher and write the GitHub Actions workflow as below:

    jobs:\npypi-publish:\nname: upload release to PyPI\nruns-on: ubuntu-latest\npermissions:\n# IMPORTANT: this permission is mandatory for trusted publishing\nid-token: write\nsteps:\n- uses: actions/checkout@v3\n\n- uses: pdm-project/setup-pdm@v3\n\n- name: Publish package distributions to PyPI\nrun: pdm publish\n
    "},{"location":"usage/publish/#build-and-publish-separately","title":"Build and publish separately","text":"

    You can also build the package and upload it in two steps, to allow you to inspect the built artifacts before uploading.

    pdm build\n

    There are many options to control the build process, depending on the backend used. Refer to the build configuration section for more details.

    The artifacts will be created at dist/ and able to upload to PyPI.

    pdm publish --no-build\n
    "},{"location":"usage/scripts/","title":"PDM Scripts","text":"

    Like npm run, with PDM, you can run arbitrary scripts or commands with local packages loaded.

    "},{"location":"usage/scripts/#arbitrary-scripts","title":"Arbitrary Scripts","text":"
    pdm run flask run -p 54321\n

    It will run flask run -p 54321 in the environment that is aware of packages in your project environment.

    "},{"location":"usage/scripts/#user-scripts","title":"User Scripts","text":"

    PDM also supports custom script shortcuts in the optional [tool.pdm.scripts] section of pyproject.toml.

    You can then run pdm run <script_name> to invoke the script in the context of your PDM project. For example:

    [tool.pdm.scripts]\nstart = \"flask run -p 54321\"\n

    And then in your terminal:

    $ pdm run start\nFlask server started at http://127.0.0.1:54321\n

    Any following arguments will be appended to the command:

    $ pdm run start -h 0.0.0.0\nFlask server started at http://0.0.0.0:54321\n

    Yarn-like script shortcuts

    There is a builtin shortcut making all scripts available as root commands as long as the script does not conflict with any builtin or plugin-contributed command. Said otherwise, if you have a start script, you can run both pdm run start and pdm start. But if you have an install script, only pdm run install will run it, pdm install will still run the builtin install command.

    PDM supports 4 types of scripts:

    "},{"location":"usage/scripts/#cmd","title":"cmd","text":"

    Plain text scripts are regarded as normal command, or you can explicitly specify it:

    [tool.pdm.scripts]\nstart = {cmd = \"flask run -p 54321\"}\n

    In some cases, such as when wanting to add comments between parameters, it might be more convenient to specify the command as an array instead of a string:

    [tool.pdm.scripts]\nstart = {cmd = [\n\"flask\",\n\"run\",\n# Important comment here about always using port 54321\n\"-p\", \"54321\"\n]}\n
    "},{"location":"usage/scripts/#shell","title":"shell","text":"

    Shell scripts can be used to run more shell-specific tasks, such as pipeline and output redirecting. This is basically run via subprocess.Popen() with shell=True:

    [tool.pdm.scripts]\nfilter_error = {shell = \"cat error.log|grep CRITICAL > critical.log\"}\n
    "},{"location":"usage/scripts/#call","title":"call","text":"

    The script can be also defined as calling a python function in the form <module_name>:<func_name>:

    [tool.pdm.scripts]\nfoobar = {call = \"foo_package.bar_module:main\"}\n

    The function can be supplied with literal arguments:

    [tool.pdm.scripts]\nfoobar = {call = \"foo_package.bar_module:main('dev')\"}\n
    "},{"location":"usage/scripts/#composite","title":"composite","text":"

    This script kind execute other defined scripts:

    [tool.pdm.scripts]\nlint = \"flake8\"\ntest = \"pytest\"\nall = {composite = [\"lint\", \"test\"]}\n

    Running pdm run all will run lint first and then test if lint succeeded.

    You can also provide arguments to the called scripts:

    [tool.pdm.scripts]\nlint = \"flake8\"\ntest = \"pytest\"\nall = {composite = [\"lint mypackage/\", \"test -v tests/\"]}\n

    Note

    Argument passed on the command line are given to each called task.

    "},{"location":"usage/scripts/#script-options","title":"Script Options","text":""},{"location":"usage/scripts/#env","title":"env","text":"

    All environment variables set in the current shell can be seen by pdm run and will be expanded when executed. Besides, you can also define some fixed environment variables in your pyproject.toml:

    [tool.pdm.scripts]\nstart.cmd = \"flask run -p 54321\"\nstart.env = {FOO = \"bar\", FLASK_ENV = \"development\"}\n

    Note how we use TOML's syntax to define a composite dictionary.

    Note

    Environment variables specified on a composite task level will override those defined by called tasks.

    "},{"location":"usage/scripts/#env_file","title":"env_file","text":"

    You can also store all environment variables in a dotenv file and let PDM read it:

    [tool.pdm.scripts]\nstart.cmd = \"flask run -p 54321\"\nstart.env_file = \".env\"\n

    The variables within the dotenv file will not override any existing environment variables. If you want the dotenv file to override existing environment variables use the following:

    [tool.pdm.scripts]\nstart.cmd = \"flask run -p 54321\"\nstart.env_file.override = \".env\"\n

    Note

    A dotenv file specified on a composite task level will override those defined by called tasks.

    "},{"location":"usage/scripts/#site_packages","title":"site_packages","text":"

    To make sure the running environment is properly isolated from the outer Python interpreter, site-packages from the selected interpreter WON'T be loaded into sys.path, unless any of the following conditions holds:

    1. The executable is from PATH but not inside the __pypackages__ folder.
    2. -s/--site-packages flag is following pdm run.
    3. site_packages = true is in either the script table or the global setting key _.

    Note that site-packages will always be loaded if running with PEP 582 enabled(without the pdm run prefix).

    "},{"location":"usage/scripts/#shared-options","title":"Shared Options","text":"

    If you want the options to be shared by all tasks run by pdm run, you can write them under a special key _ in [tool.pdm.scripts] table:

    [tool.pdm.scripts]\n_.env_file = \".env\"\nstart = \"flask run -p 54321\"\nmigrate_db = \"flask db upgrade\"\n

    Besides, inside the tasks, PDM_PROJECT_ROOT environment variable will be set to the project root.

    "},{"location":"usage/scripts/#arguments-placeholder","title":"Arguments placeholder","text":"

    By default, all user provided extra arguments are simply appended to the command (or to all the commands for composite tasks).

    If you want more control over the user provided extra arguments, you can use the {args} placeholder. It is available for all script types and will be interpolated properly for each:

    [tool.pdm.scripts]\ncmd = \"echo '--before {args} --after'\"\nshell = {shell = \"echo '--before {args} --after'\"}\ncomposite = {composite = [\"cmd --something\", \"shell {args}\"]}\n

    will produce the following interpolations (those are not real scripts, just here to illustrate the interpolation):

    $ pdm run cmd --user --provided\n--before --user --provided --after\n$ pdm run cmd\n--before --after\n$ pdm run shell --user --provided\n--before --user --provided --after\n$ pdm run shell\n--before --after\n$ pdm run composite --user --provided\ncmd --something\nshell --before --user --provided --after\n$ pdm run composite\ncmd --something\nshell --before --after\n

    You may optionally provide default values that will be used if no user arguments are provided:

    [tool.pdm.scripts]\ntest = \"echo '--before {args:--default --value} --after'\"\n

    will produce the following:

    $ pdm run test --user --provided\n--before --user --provided --after\n$ pdm run test\n--before --default --value --after\n

    Note

    As soon a placeholder is detected, arguments are not appended anymore. This is important for composite scripts because if a placeholder is detected on one of the subtasks, none for the subtasks will have the arguments appended, you need to explicitly pass the placeholder to every nested command requiring it.

    Note

    call scripts don't support the {args} placeholder as they have access to sys.argv directly to handle such complexe cases and more.

    "},{"location":"usage/scripts/#show-the-list-of-scripts","title":"Show the List of Scripts","text":"

    Use pdm run --list/-l to show the list of available script shortcuts:

    $ pdm run --list\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 Name        \u2502 Type  \u2502 Description               \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 test_cmd    \u2502 cmd   \u2502 flask db upgrade          \u2502\n\u2502 test_script \u2502 call  \u2502 call a python function    \u2502\n\u2502 test_shell  \u2502 shell \u2502 shell command             \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n

    You can add an help option with the description of the script, and it will be displayed in the Description column in the above output.

    Note

    Tasks with a name starting with an underscore (_) are considered internal (helpers...) and are not shown in the listing.

    "},{"location":"usage/scripts/#pre-post-scripts","title":"Pre & Post Scripts","text":"

    Like npm, PDM also supports tasks composition by pre and post scripts, pre script will be run before the given task and post script will be run after.

    [tool.pdm.scripts]\npre_compress = \"{{ Run BEFORE the `compress` script }}\"\ncompress = \"tar czvf compressed.tar.gz data/\"\npost_compress = \"{{ Run AFTER the `compress` script }}\"\n

    In this example, pdm run compress will run all these 3 scripts sequentially.

    The pipeline fails fast

    In a pipeline of pre - self - post scripts, a failure will cancel the subsequent execution.

    "},{"location":"usage/scripts/#hook-scripts","title":"Hook Scripts","text":"

    Under certain situations PDM will look for some special hook scripts for execution:

    • post_init: Run after pdm init
    • pre_install: Run before installing packages
    • post_install: Run after packages are installed
    • pre_lock: Run before dependency resolution
    • post_lock: Run after dependency resolution
    • pre_build: Run before building distributions
    • post_build: Run after distributions are built
    • pre_publish: Run before publishing distributions
    • post_publish: Run after distributions are published
    • pre_script: Run before any script
    • post_script: Run after any script
    • pre_run: Run once before run script invocation
    • post_run: Run once after run script invocation

    Note

    Pre & post scripts can't receive any arguments.

    Avoid name conflicts

    If there exists an install scripts under [tool.pdm.scripts] table, pre_install scripts can be triggered by both pdm install and pdm run install. So it is recommended to not use the preserved names.

    Note

    Composite tasks can also have pre and post scripts. Called tasks will run their own pre and post scripts.

    "},{"location":"usage/scripts/#skipping-scripts","title":"Skipping scripts","text":"

    Because, sometimes it is desirable to run a script but without its hooks or pre and post scripts, there is a --skip=:all which will disable all hooks, pre and post. There is also --skip=:pre and --skip=:post allowing to respectively skip all pre_* hooks and all post_* hooks.

    It is also possible to need a pre script but not the post one, or to need all tasks from a composite tasks except one. For those use cases, there is a finer grained --skip parameter accepting a list of tasks or hooks name to exclude.

    pdm run --skip pre_task1,task2 my-composite\n

    This command will run the my-composite task and skip the pre_task1 hook as well as the task2 and its hooks.

    You can also provide you skip list in PDM_SKIP_HOOKS environment variable but it will be overridden as soon as the --skip parameter is provided.

    There is more details on hooks and pre/post scripts behavior on the dedicated hooks page.

    "},{"location":"usage/template/","title":"Create Project From a Template","text":"

    Similar to yarn create and npm create, PDM also supports initializing or creating a project from a template. The template is given as a positional argument of pdm init, in one of the following forms:

    • pdm init flask - Initialize the project from the template https://github.com/pdm-project/template-flask
    • pdm init https://github.com/frostming/pdm-template-flask - Initialize the project from a Git URL. Both HTTPS and SSH URL are acceptable.
    • pdm init django@v2 - To check out the specific branch or tag. Full Git URL also supports it.
    • pdm init /path/to/template - Initialize the project from a template directory on local filesystem.

    And pdm init will use the default template built in.

    The project will be initialized at the current directory, existing files with the same name will be overwritten. You can also use the -p <path> option to create a project at a new path.

    "},{"location":"usage/template/#contribute-a-template","title":"Contribute a template","text":"

    According to the first form of the template argument, pdm init <name> will refer to the template repository located at https://github.com/pdm-project/template-<name>. To contribute a template, you can create a template repository and establish a request to transfer the ownership to pdm-project organization(it can be found at the bottom of the repository settings page). The administrators of the organization will review the request and complete the subsequent steps. You will be added as the repository maintainer if the transfer is accepted.

    "},{"location":"usage/template/#requirements-for-a-template","title":"Requirements for a template","text":"

    A template repository must be a pyproject-based project, which contains a pyproject.toml file with PEP-621 compliant metadata. No other special config files are required.

    "},{"location":"usage/template/#project-name-replacement","title":"Project name replacement","text":"

    On initialization, the project name in the template will be replaced by the name of the new project. This is done by a recursive full-text search and replace. The import name, which is derived from the project name by replacing all non-alphanumeric characters with underscores and lowercasing, will also be replaced in the same way.

    For example, if the project name is foo-project in the template and you want to initialize a new project named bar-project, the following replacements will be made:

    • foo-project -> bar-project in all .md files and .rst files
    • foo_project -> bar_project in all .py files
    • foo_project -> bar_project in the directory name
    • foo_project.py -> bar_project.py in the file name

    Therefore, we don't support name replacement if the import name isn't derived from the project name.

    "},{"location":"usage/template/#use-other-project-generators","title":"Use other project generators","text":"

    If you are seeking for a more powerful project generator, you can use cookiecutter via --cookiecutter option and copier via --copier option.

    You need to install cookiecutter and copier respectively to use them. You can do this by running pdm self add <package>. To use them:

    pdm init --cookiecutter gh:cjolowicz/cookiecutter-hypermodern-python\n# or\npdm init --copier gh:pawamoy/copier-pdm --UNSAFE\n
    "},{"location":"usage/venv/","title":"Working with Virtual Environments","text":"

    When you run pdm init command, PDM will ask for the Python interpreter to use in the project, which is the base interpreter to install dependencies and run tasks.

    Compared to PEP 582, virtual environments are considered more mature and have better support in the Python ecosystem as well as IDEs. Therefore, virtualenv is the default mode if not configured otherwise.

    Virtual environments will be used if the project interpreter (the interpreter stored in .pdm-python, which can be checked by pdm info) is from a virtualenv.

    "},{"location":"usage/venv/#virtualenv-auto-creation","title":"Virtualenv auto-creation","text":"

    By default, PDM prefers to use the virtualenv layout as other package managers do. When you run pdm install the first time on a new PDM-managed project, whose Python interpreter is not decided yet, PDM will create a virtualenv in <project_root>/.venv, and install dependencies into it. In the interactive session of pdm init, PDM will also ask to create a virtualenv for you.

    You can choose the backend used by PDM to create a virtualenv. Currently it supports three backends:

    • virtualenv(default)
    • venv
    • conda

    You can change it by pdm config venv.backend [virtualenv|venv|conda].

    "},{"location":"usage/venv/#create-a-virtualenv-yourself","title":"Create a virtualenv yourself","text":"

    You can create more than one virtualenvs with whatever Python version you want.

    # Create a virtualenv based on 3.8 interpreter\n$ pdm venv create 3.8\n# Assign a different name other than the version string\n$ pdm venv create --name for-test 3.8\n# Use venv as the backend to create, support 3 backends: virtualenv(default), venv, conda\n$ pdm venv create --with venv 3.9\n
    "},{"location":"usage/venv/#the-location-of-virtualenvs","title":"The location of virtualenvs","text":"

    If no --name is given, PDM will create the venv in <project_root>/.venv. Otherwise, virtualenvs go to the location specified by the venv.location configuration. They are named as <project_name>-<path_hash>-<name_or_python_version> to avoid name collision. You can disable the in-project virtualenv creation by pdm config venv.in_project false. And all virtualenvs will be created under venv.location.

    "},{"location":"usage/venv/#reuse-the-virtualenv-you-created-elsewhere","title":"Reuse the virtualenv you created elsewhere","text":"

    You can tell PDM to use a virtualenv you created in preceding steps, with pdm use:

    pdm use -f /path/to/venv\n
    "},{"location":"usage/venv/#virtualenv-auto-detection","title":"Virtualenv auto-detection","text":"

    When no interpreter is stored in the project config or PDM_IGNORE_SAVED_PYTHON env var is set, PDM will try to detect possible virtualenvs to use:

    • venv, env, .venv directories in the project root
    • The currently activated virtualenv, unless PDM_IGNORE_ACTIVE_VENV is set
    "},{"location":"usage/venv/#list-all-virtualenvs-created-with-this-project","title":"List all virtualenvs created with this project","text":"
    $ pdm venv list\nVirtualenvs created with this project:\n\n-  3.8.6: C:\\Users\\Frost Ming\\AppData\\Local\\pdm\\pdm\\venvs\\test-project-8Sgn_62n-3.8.6\n-  for-test: C:\\Users\\Frost Ming\\AppData\\Local\\pdm\\pdm\\venvs\\test-project-8Sgn_62n-for-test\n-  3.9.1: C:\\Users\\Frost Ming\\AppData\\Local\\pdm\\pdm\\venvs\\test-project-8Sgn_62n-3.9.1\n
    "},{"location":"usage/venv/#show-the-path-or-python-interpreter-of-a-virtualenv","title":"Show the path or python interpreter of a virtualenv","text":"
    $ pdm venv --path for-test\n$ pdm venv --python for-test\n
    "},{"location":"usage/venv/#remove-a-virtualenv","title":"Remove a virtualenv","text":"
    $ pdm venv remove for-test\nVirtualenvs created with this project:\nWill remove: C:\\Users\\Frost Ming\\AppData\\Local\\pdm\\pdm\\venvs\\test-project-8Sgn_62n-for-test, continue? [y/N]:y\nRemoved C:\\Users\\Frost Ming\\AppData\\Local\\pdm\\pdm\\venvs\\test-project-8Sgn_62n-for-test\n
    "},{"location":"usage/venv/#activate-a-virtualenv","title":"Activate a virtualenv","text":"

    Instead of spawning a subshell like what pipenv and poetry do, pdm venv doesn't create the shell for you but print the activate command to the console. In this way you won't leave the current shell. You can then feed the output to eval to activate the virtualenv:

    bash/csh/zshFishPowershell
    $ eval $(pdm venv activate for-test)\n(test-project-for-test) $  # Virtualenv entered\n
    $ eval (pdm venv activate for-test)\n
    PS1> Invoke-Expression (pdm venv activate for-test)\n

    Additionally, if the project interpreter is a venv Python, you can omit the name argument following activate.

    Note

    venv activate does not switch the Python interpreter used by the project. It only changes the shell by injecting the virtualenv paths to environment variables. For the forementioned purpose, use the pdm use command.

    For more CLI usage, see the pdm venv documentation.

    Looking for pdm shell?

    PDM doesn't provide a shell command because many fancy shell functions may not work perfectly in a subshell, which brings a maintenance burden to support all the corner cases. However, you can still gain the ability via the following ways:

    • Use pdm run $SHELL, this will spawn a subshell with the environment variables set properly. The subshell can be quit with exit or Ctrl+D.
    • Add a shell function to activate the virtualenv, here is an example of BASH function that also works on ZSH:
    pdm() {\nlocal command=$1\n\nif [[ \"$command\" == \"shell\" ]]; then\neval $(pdm venv activate)\nelse\ncommand pdm $@\nfi\n}\n

    Copy and paste this function to your ~/.bashrc file and restart your shell. Now you can run pdm shell to activate the virtualenv. The virtualenv can be deactivated with deactivate command as usual.

    "},{"location":"usage/venv/#prompt-customization","title":"Prompt customization","text":"

    By default when you activate a virtualenv, the prompt will show: {project_name}-{python_version}.

    For example if your project is named test-project:

    $ eval $(pdm venv activate for-test)\n(test-project-3.10) $  # {project_name} == test-project and {python_version} == 3.10\n

    The format can be customized before virtualenv creation with the venv.prompt configuration or PDM_VENV_PROMPT environment variable (before a pdm init or pdm venv create). Available variables are:

    • project_name: name of your project
    • python_version: version of Python (used by the virtualenv)
    $ PDM_VENV_PROMPT='{project_name}-py{python_version}' pdm venv create --name test-prompt\n$ eval $(pdm venv activate test-prompt)\n(test-project-py3.10) $\n
    "},{"location":"usage/venv/#run-a-command-in-a-virtual-environment-without-activating-it","title":"Run a command in a virtual environment without activating it","text":"
    # Run a script\n$ pdm run --venv test test\n# Install packages\n$ pdm sync --venv test\n# List the packages installed\n$ pdm list --venv test\n

    There are other commands supporting --venv flag or PDM_IN_VENV environment variable, see the CLI reference. You should create the virtualenv with pdm venv create --name <name> before using this feature.

    "},{"location":"usage/venv/#switch-to-a-virtualenv-as-the-project-environment","title":"Switch to a virtualenv as the project environment","text":"

    By default, if you use pdm use and select a non-venv Python, the project will be switched to PEP 582 mode. We also allow you to switch to a named virtual environment via the --venv flag:

    # Switch to a virtualenv named test\n$ pdm use --venv test\n# Switch to the in-project venv located at $PROJECT_ROOT/.venv\n$ pdm use --venv in-project\n
    "},{"location":"usage/venv/#disable-virtualenv-mode","title":"Disable virtualenv mode","text":"

    You can disable the auto-creation and auto-detection for virtualenv by pdm config python.use_venv false. If venv is disabled, PEP 582 mode will always be used even if the selected interpreter is from a virtualenv.

    "},{"location":"usage/venv/#including-pip-in-your-virtual-environment","title":"Including pip in your virtual environment","text":"

    By default PDM will not include pip in virtual environments. This increases isolation by ensuring that only your dependencies are installed in the virtual environment.

    To install pip once (if for example you want to install arbitrary dependencies in CI) you can run:

    # Install pip in the virtual environment\n$ pdm run python -m ensurepip\n# Install arbitrary dependencies\n# These dependencies are not checked for conflicts against lockfile dependencies!\n$ pdm run python -m pip install coverage\n

    Or you can create the virtual environment with --with-pip:

    $ pdm venv create --with-pip 3.9\n

    See the ensurepip docs for more details on ensurepip.

    If you want to permanently configure PDM to include pip in virtual environments you can use the venv.with_pip configuration.

    "}]} \ No newline at end of file diff --git a/2.10/sitemap.xml b/2.10/sitemap.xml deleted file mode 100644 index 0f8724efd9..0000000000 --- a/2.10/sitemap.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/2.10/sitemap.xml.gz b/2.10/sitemap.xml.gz deleted file mode 100644 index 0ec75456d0..0000000000 Binary files a/2.10/sitemap.xml.gz and /dev/null differ diff --git a/2.10/usage/advanced/index.html b/2.10/usage/advanced/index.html deleted file mode 100644 index 92e8065ca1..0000000000 --- a/2.10/usage/advanced/index.html +++ /dev/null @@ -1,1406 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Advanced Usage - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - - - - - -
    -
    - - - - - - - -

    Advanced Usage#

    -

    Automatic Testing#

    -

    Use Tox as the runner#

    -

    Tox is a great tool for testing against multiple Python versions or dependency sets. -You can configure a tox.ini like the following to integrate your testing with PDM:

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    [tox]
    -env_list = py{36,37,38},lint
    -
    -[testenv]
    -setenv =
    -    PDM_IGNORE_SAVED_PYTHON="1"
    -deps = pdm
    -commands =
    -    pdm install --dev
    -    pytest tests
    -
    -[testenv:lint]
    -deps = pdm
    -commands =
    -    pdm install -G lint
    -    flake8 src/
    -
    -

    To use the virtualenv created by Tox, you should make sure you have set pdm config python.use_venv true. PDM then will install -dependencies from pdm lock into the virtualenv. In the dedicated venv you can directly run tools by pytest tests/ instead -of pdm run pytest tests/.

    -

    You should also make sure you don't run pdm add/pdm remove/pdm update/pdm lock in the test commands, otherwise the pdm lock -file will be modified unexpectedly. Additional dependencies can be supplied with the deps config. Besides, isolated_build and passenv -config should be set as the above example to make PDM work properly.

    -

    To get rid of these constraints, there is a Tox plugin tox-pdm which can ease the usage. You can install it by

    -
    1
    pip install tox-pdm
    -
    -

    Or,

    -
    1
    pdm add --dev tox-pdm
    -
    -

    And you can make the tox.ini much tidier as following, :

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    [tox]
    -env_list = py{36,37,38},lint
    -
    -[testenv]
    -groups = dev
    -commands =
    -    pytest tests
    -
    -[testenv:lint]
    -groups = lint
    -commands =
    -    flake8 src/
    -
    -

    See the project's README for a detailed guidance.

    -

    Use Nox as the runner#

    -

    Nox is another great tool for automated testing. Unlike tox, Nox uses a standard Python file for configuration.

    -

    It is much easier to use PDM in Nox, here is an example of noxfile.py:

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    import os
    -import nox
    -
    -os.environ.update({"PDM_IGNORE_SAVED_PYTHON": "1"})
    -
    -@nox.session
    -def tests(session):
    -    session.run_always('pdm', 'install', '-G', 'test', external=True)
    -    session.run('pytest')
    -
    -@nox.session
    -def lint(session):
    -    session.run_always('pdm', 'install', '-G', 'lint', external=True)
    -    session.run('flake8', '--import-order-style', 'google')
    -
    -

    Note that PDM_IGNORE_SAVED_PYTHON should be set so that PDM can pick up the Python in the virtualenv correctly. Also make sure pdm is available in the PATH. -Before running nox, you should also ensure configuration item python.use_venv is true to enable venv reusing.

    -

    About PEP 582 __pypackages__ directory#

    -

    By default, if you run tools by pdm run, __pypackages__ will be seen by the program and all subprocesses created by it. This means virtual environments created by those tools are also aware of the packages inside __pypackages__, which result in unexpected behavior in some cases. -For nox, you can avoid this by adding a line in noxfile.py:

    -
    1
    os.environ.pop("PYTHONPATH", None)
    -
    -

    For tox, PYTHONPATH will not be passed to the test sessions so this isn't going to be a problem. Moreover, it is recommended to make nox and tox live in their own pipx environments so you don't need to install for every project. In this case, PEP 582 packages will not be a problem either.

    -

    Use PDM in Continuous Integration#

    -

    Only one thing to keep in mind -- PDM can't be installed on Python < 3.7, so if your project is to be tested on those Python versions, -you have to make sure PDM is installed on the correct Python version, which can be different from the target Python version the particular job/task is run on.

    -

    Fortunately, if you are using GitHub Action, there is pdm-project/setup-pdm to make this process easier. -Here is an example workflow of GitHub Actions, while you can adapt it for other CI platforms.

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    Testing:
    -  runs-on: ${{ matrix.os }}
    -  strategy:
    -    matrix:
    -      python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
    -      os: [ubuntu-latest, macOS-latest, windows-latest]
    -
    -  steps:
    -    - uses: actions/checkout@v3
    -    - name: Set up PDM
    -      uses: pdm-project/setup-pdm@v3
    -      with:
    -        python-version: ${{ matrix.python-version }}
    -
    -    - name: Install dependencies
    -      run: |
    -        pdm sync -d -G testing
    -    - name: Run Tests
    -      run: |
    -        pdm run -v pytest tests
    -
    -
    -

    TIPS

    -

    For GitHub Action users, there is a known compatibility issue on Ubuntu virtual environment. -If PDM parallel install is failed on that machine you should either set parallel_install to false or set env LD_PRELOAD=/lib/x86_64-linux-gnu/libgcc_s.so.1. -It is already handled by the pdm-project/setup-pdm action.

    -
    -
    -

    Note

    -

    If your CI scripts run without a proper user set, you might get permission errors when PDM tries to create its cache directory. -To work around this, you can set the HOME environment variable yourself, to a writable directory, for example:

    -
    1
    export HOME=/tmp/home
    -
    -
    -

    Use PDM in a multi-stage Dockerfile#

    -

    It is possible to use PDM in a multi-stage Dockerfile to first install the project and dependencies into __pypackages__ -and then copy this folder into the final stage, adding it to PYTHONPATH.

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    # build stage
    -FROM python:3.8 AS builder
    -
    -# install PDM
    -RUN pip install -U pip setuptools wheel
    -RUN pip install pdm
    -
    -# copy files
    -COPY pyproject.toml pdm.lock README.md /project/
    -COPY src/ /project/src
    -
    -# install dependencies and project into the local packages directory
    -WORKDIR /project
    -RUN mkdir __pypackages__ && pdm sync --prod --no-editable
    -
    -
    -# run stage
    -FROM python:3.8
    -
    -# retrieve packages from build stage
    -ENV PYTHONPATH=/project/pkgs
    -COPY --from=builder /project/__pypackages__/3.8/lib /project/pkgs
    -
    -# retrieve executables
    -COPY --from=builder /project/__pypackages__/3.8/bin/* /bin/
    -
    -# set command/entrypoint, adapt to fit your needs
    -CMD ["python", "-m", "project"]
    -
    -

    Use PDM to manage a monorepo#

    -

    With PDM, you can have multiple sub-packages within a single project, each with its own pyproject.toml file. And you can create only one pdm.lock file to lock all dependencies. The sub-packages can have each other as their dependencies. To achieve this, follow these steps:

    -

    project/pyproject.toml:

    -
    1
    -2
    -3
    -4
    -5
    -6
    [tool.pdm.dev-dependencies]
    -dev = [
    -    "-e file:///${PROJECT_ROOT}/packages/foo-core",
    -    "-e file:///${PROJECT_ROOT}/packages/foo-cli",
    -    "-e file:///${PROJECT_ROOT}/packages/foo-app",
    -]
    -
    -

    packages/foo-cli/pyproject.toml:

    -
    1
    -2
    [project]
    -dependencies = ["foo-core"]
    -
    -

    packages/foo-app/pyproject.toml:

    -
    1
    -2
    [project]
    -dependencies = ["foo-core"]
    -
    -

    Now, run pdm install in the project root, and you will get a pdm.lock with all dependencies locked. All sub-packages will be installed in editable mode.

    -

    Look at the 🚀 Example repository for more details.

    -

    Hooks for pre-commit#

    -

    pre-commit is a powerful framework for managing git hooks in a centralized fashion. PDM already uses pre-commit hooks for its internal QA checks. PDM exposes also several hooks that can be run locally or in CI pipelines.

    -

    Export requirements.txt or setup.py#

    -

    This hook wraps the command pdm export along with any valid argument. It can be used as a hook (e.g., for CI) to ensure that you are going to check in the codebase a requirements.txt or a setup.py file, which reflects the actual content of pdm lock.

    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    # export python requirements
    -- repo: https://github.com/pdm-project/pdm
    -  rev: 2.x.y # a PDM release exposing the hook
    -  hooks:
    -    - id: pdm-export
    -      # command arguments, e.g.:
    -      args: ['-o', 'requirements.txt', '--without-hashes']
    -      files: ^pdm.lock$
    -
    -

    Check pdm.lock is up to date with pyproject.toml#

    -

    This hook wraps the command pdm lock --check along with any valid argument. It can be used as a hook (e.g., for CI) to ensure that whenever pyproject.toml has a dependency added/changed/removed, that pdm.lock is also up to date.

    -
    1
    -2
    -3
    -4
    - repo: https://github.com/pdm-project/pdm
    -  rev: 2.x.y # a PDM release exposing the hook
    -  hooks:
    -    - id: pdm-lock-check
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/cli_reference/index.html b/2.10/usage/cli_reference/index.html deleted file mode 100644 index 52b8d70bdd..0000000000 --- a/2.10/usage/cli_reference/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Redirecting... - - - - - - -Redirecting... - - diff --git a/2.10/usage/config/index.html b/2.10/usage/config/index.html deleted file mode 100644 index b65367b3c2..0000000000 --- a/2.10/usage/config/index.html +++ /dev/null @@ -1,1466 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Configure the Project - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - - - - - -
    -
    - - - - - - - -

    Configure the Project#

    -

    PDM's config command works just like git config, except that --list isn't needed to -show configurations.

    -

    Show the current configurations:

    -
    1
    pdm config
    -
    -

    Get one single configuration:

    -
    1
    pdm config pypi.url
    -
    -

    Change a configuration value and store in home configuration:

    -
    1
    pdm config pypi.url "https://test.pypi.org/simple"
    -
    -

    By default, the configuration are changed globally, if you want to make the config seen by this project only, add a --local flag:

    -
    1
    pdm config --local pypi.url "https://test.pypi.org/simple"
    -
    -

    Any local configurations will be stored in pdm.toml under the project root directory.

    -

    Configuration files#

    -

    The configuration files are searched in the following order:

    -
      -
    1. <PROJECT_ROOT>/pdm.toml - The project configuration
    2. -
    3. <CONFIG_ROOT>/config.toml - The home configuration
    4. -
    5. <SITE_CONFIG_ROOT>/config.toml - The site configuration
    6. -
    -

    where <CONFIG_ROOT> is:

    - -

    and <SITE_CONFIG_ROOT> is:

    - -

    If -g/--global option is used, the first item will be replaced by <CONFIG_ROOT>/global-project/pdm.toml.

    -

    You can find all available configuration items in Configuration Page.

    -

    Configure the Python finder#

    -

    By default, PDM will try to find Python interpreters in the following sources:

    -
      -
    • venv: The PDM virtualenv location
    • -
    • path: The PATH environment variable
    • -
    • pyenv: The pyenv install root
    • -
    • rye: The rye toolchain install root
    • -
    • asdf: The asdf python install root
    • -
    • winreg: The Windows registry
    • -
    -

    You can unselect some of them or change the order by setting python.providers config key:

    -
    1
    -2
    pdm config python.providers rye   # Rye source only
    -pdm config python.providers pyenv,asdf  # pyenv and asdf
    -
    -

    Allow prereleases in resolution result#

    -

    By default, pdm's dependency resolver will ignore prereleases unless there are no stable versions for the given version range of a dependency. This behavior can be changed by setting allow_prereleases to true in [tool.pdm] table:

    -
    1
    -2
    [tool.pdm]
    -allow_prereleases = true
    -
    -

    Configure the package indexes#

    -

    You can tell PDM where to to find the packages by either specifying sources in the pyproject.toml or via pypi.* configurations.

    -

    Add sources in pyproject.toml:

    -
    1
    -2
    -3
    -4
    [[tool.pdm.source]]
    -name = "private"
    -url = "https://private.pypi.org/simple"
    -verify_ssl = true
    -
    -

    Change the default index via pdm config:

    -
    1
    pdm config pypi.url "https://test.pypi.org/simple"
    -
    -

    Add extra indexes via pdm config:

    -
    1
    pdm config pypi.extra.url "https://extra.pypi.org/simple"
    -
    -

    The available configuration options are:

    -
      -
    • url: The URL of the index
    • -
    • verify_ssl: (Optional)Whether to verify SSL certificates, default to true
    • -
    • username: (Optional)The username for the index
    • -
    • password: (Optional)The password for the index
    • -
    • type: (Optional) index or find_links, default to index
    • -
    -
    -About the source types -

    By default, all sources are PEP 503 style "indexes" like pip's --index-url and --extra-index-url, however, you can set the type to find_links which contains files or links to be looked for directly. See this answer for the difference between the two types.

    -
    -

    These configurations are read in the following order to build the final source list:

    -
      -
    • pypi.url, if pypi doesn't appear in the name field of any source in pyproject.toml
    • -
    • Sources in pyproject.toml
    • -
    • pypi.<name>.url in PDM config.
    • -
    -

    You can set pypi.ignore_stored_index to true to disable all indexes from the PDM config and only use those specified in pyproject.toml.

    -
    -

    Disable the default PyPI index

    -

    If you want to omit the default PyPI index, just set the source name to pypi and that source will replace it.

    -
    1
    -2
    -3
    -4
    [[tool.pdm.source]]
    -url = "https://private.pypi.org/simple"
    -verify_ssl = true
    -name = "pypi"
    -
    -
    -
    -Indexes in pyproject.toml or config -

    When you want to share the indexes with other people who are going to use the project, you should add them in pyproject.toml. For example, some packages only exist in a private index and can't be installed if someone doesn't configure the index. -Otherwise, store them in the local config which won't be seen by others.

    -
    -

    Respect the order of the sources#

    -

    By default, all sources are considered equal, packages from them are sorted by the version and wheel tags, the most matching one with the highest version is selected.

    -

    In some cases you may want to return packages from the preferred source, and search for others if they are missing from the former source. PDM supports this by reading the configuration respect-source-order:

    -
    1
    -2
    [tool.pdm.resolution]
    -respect-source-order = true
    -
    -

    Specify index for individual packages#

    -

    You can bind packages to specific sources with include_packages and exclude_packages config under tool.pdm.source table.

    -
    1
    -2
    -3
    -4
    -5
    [[tool.pdm.source]]
    -name = "private"
    -url = "https://private.pypi.org/simple"
    -include_packages = ["foo", "foo-*"]
    -exclude_packages = ["bar-*"]
    -
    -

    With the above configuration, any package matching foo or foo-* will only be searched from the private index, and any package matching bar-* will be searched from all indexes except private.

    -

    Both include_packages and exclude_packages are optional and accept a list of glob patterns, and include_packages takes effect exclusively when the pattern matches.

    -

    Store credentials with the index#

    -

    You can specify credentials in the URL with ${ENV_VAR} variable expansion and these variables will be read from the environment variables:

    -
    1
    -2
    -3
    [[tool.pdm.source]]
    -name = "private"
    -url = "https://${PRIVATE_PYPI_USERNAME}:${PRIVATE_PYPI_PASSWORD}@private.pypi.org/simple"
    -
    -

    Configure HTTPS certificates#

    -

    You can use a custom CA bundle or client certificate for HTTPS requests. It can be configured for both indexes(for package download) and repositories(for upload):

    -
    1
    -2
    pdm config pypi.ca_certs /path/to/ca_bundle.pem
    -pdm config repository.pypi.ca_certs /path/to/ca_bundle.pem
    -
    -

    Besides, it is possible to use the system trust store, instead of the bundled certifi certificates for verifying HTTPS certificates. This approach will typically support corporate proxy certificates without additional configuration.

    -

    To use truststore, you need Python 3.10 or newer and install truststore into the same environment as PDM:

    -
    1
    $ pdm self add truststore
    -
    -

    Index configuration merging#

    -

    Index configurations are merged with the name field of [[tool.pdm.source]] table or pypi.<name> key in the config file. -This enables you to store the url and credentials separately, to avoid secrets being exposed in the source control. -For example, if you have the following configuration:

    -
    1
    -2
    -3
    [[tool.pdm.source]]
    -name = "private"
    -url = "https://private.pypi.org/simple"
    -
    -

    You can store the credentials in the config file:

    -
    1
    -2
    pdm config pypi.private.username "foo"
    -pdm config pypi.private.password "bar"
    -
    -

    PDM can retrieve the configurations for private index from both places.

    -

    If the index requires a username and password, but they can't be found from the environment variables nor config file, PDM will prompt you to enter them. Or, if keyring is installed, it will be used as the credential store. PDM can use the keyring from either the installed package or the CLI.

    -

    Central installation caches#

    -

    If a package is required by many projects on the system, each project has to keep its own copy. This can be a waste of disk space, especially for data science and machine learning projects.

    -

    PDM supports caching installations of the same wheel by installing it in a centralized package repository and linking to that installation in different projects. To enable it, run:

    -
    1
    pdm config install.cache on
    -
    -

    It can be enabled on a per-project basis by adding the --local option to the command.

    -

    The caches are located in $(pdm config cache_dir)/packages. You can view the cache usage with pdm cache info. Note that the cached installs are managed automatically -- they will be deleted if they are not linked to any projects. Manually deleting the caches from disk may break some projects on the system.

    -
    -

    Note

    -

    Only the installation of named requirements resolved from PyPI can be cached.

    -
    -

    Configure the repositories for upload#

    -

    When using the pdm publish command, it reads the repository secrets from the global config file(<CONFIG_ROOT>/config.toml). The content of the config is as follows:

    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    [repository.pypi]
    -username = "frostming"
    -password = "<secret>"
    -
    -[repository.company]
    -url = "https://pypi.company.org/legacy/"
    -username = "frostming"
    -password = "<secret>"
    -ca_certs = "/path/to/custom-cacerts.pem"
    -
    -

    Alternatively, these credentials can be provided with env vars:

    -
    1
    -2
    -3
    -4
    export PDM_PUBLISH_REPO=...
    -export PDM_PUBLISH_USERNAME=...
    -export PDM_PUBLISH_PASSWORD=...
    -export PDM_PUBLISH_CA_CERTS=...
    -
    -

    A PEM-encoded Certificate Authority bundle (ca_certs) can be used for local / custom PyPI repositories where the server certificate is not signed by the standard certifi CA bundle.

    -
    -

    Note

    -

    Repositories are different from indexes in the previous section. Repositories are for publishing while indexes are for locking -and resolving. They don't share the configuration.

    -
    -
    -

    Tip

    -

    You don't need to configure the url for pypi and testpypi repositories, they are filled by default values. -The username, password, and certificate authority bundle can be passed in from the command line for pdm publish via --username, --password, and --ca-certs, respectively.

    -
    -

    To change the repository config from the command line, use the pdm config command:

    -
    1
    -2
    -3
    -4
    -5
    pdm config repository.pypi.username "__token__"
    -pdm config repository.pypi.password "my-pypi-token"
    -
    -pdm config repository.company.url "https://pypi.company.org/legacy/"
    -pdm config repository.company.ca_certs "/path/to/custom-cacerts.pem"
    -
    -

    Password management with keyring#

    -

    When keyring is available and supported, the passwords will be stored to and retrieved from the keyring instead of writing to the config file. This supports both indexes and upload repositories. The service name will be pdm-pypi-<name> for an index and pdm-repository-<name> for a repository.

    -

    You can enable keyring by either installing keyring into the same environment as PDM or installing globally. To add keyring to the PDM environment:

    -
    1
    pdm self add keyring
    -
    -

    Alternatively, if you have installed a copy of keyring globally, make sure the CLI is exposed in the PATH env var to make it discoverable by PDM:

    -
    1
    export PATH=$PATH:path/to/keyring/bin
    -
    -

    Override the resolved package versions#

    -

    New in version 1.12.0

    -

    Sometimes you can't get a dependency resolution due to incorrect version ranges set by upstream libraries that you can't fix. -In this case you can use PDM's overrides feature to force a specific version of a package to be installed.

    -

    Given the following configuration in pyproject.toml:

    -
    1
    -2
    -3
    -4
    [tool.pdm.resolution.overrides]
    -asgiref = "3.2.10"  # exact version
    -urllib3 = ">=1.26.2"  # version range
    -pytz = "https://mypypi.org/packages/pytz-2020.9-py3-none-any.whl"  # absolute URL
    -
    -

    Each entry of that table is a package name with the wanted version. -In this example, PDM will resolve the above packages into the given versions no matter whether there is any other resolution available.

    -
    -

    Warning

    -

    By using [tool.pdm.resolution.overrides] setting, you are at your own risk of any incompatibilities from that resolution. It can only be used if there is no valid resolution for your requirements and you know the specific version works. -Most of the time, you can just add any transient constraints to the dependencies array.

    -
    -

    Passing constant arguments to every pdm invocation#

    -

    New in version 2.7.0

    -

    You can add extra options passed to individual pdm commands by tool.pdm.options configuration:

    -
    1
    -2
    -3
    -4
    [tool.pdm.options]
    -add = ["--no-isolation", "--no-self"]
    -install = ["--no-self"]
    -lock = ["--no-cross-platform"]
    -
    -

    These options will be added right after the command name. For instance, based on the configuration above, -pdm add requests is equivalent to pdm add --no-isolation --no-self requests.

    -

    Ignore package warnings#

    -

    New in version 2.10.0

    -

    You may see some warnings when resolving dependencies like this:

    -
    1
    -2
    -3
    -4
    -5
    PackageWarning: Skipping scipy@1.10.0 because it requires Python
    -<3.12,>=3.8 but the project claims to work with Python>=3.9.
    -Narrow down the `requires-python` range to include this version. For example, ">=3.9,<3.12" should work.
    -  warnings.warn(record.message, PackageWarning, stacklevel=1)
    -Use `-q/--quiet` to suppress these warnings, or ignore them per-package with `ignore_package_warnings` config in [tool.pdm] table.
    -
    -

    This is because the supported range of Python versions of the package doesn't cover the requires-python value specified in the pyproject.toml. -You can ignore these warnings in a per-package basis by adding the following config:

    -
    1
    -2
    [tool.pdm]
    -ignore_package_warnings = ["scipy", "tensorflow-*"]
    -
    -

    Where each item is a case-insensitive glob pattern to match the package name.

    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/configuration/index.html b/2.10/usage/configuration/index.html deleted file mode 100644 index e6fd890f77..0000000000 --- a/2.10/usage/configuration/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Redirecting... - - - - - - -Redirecting... - - diff --git a/2.10/usage/dependency/index.html b/2.10/usage/dependency/index.html deleted file mode 100644 index 0f10fe170e..0000000000 --- a/2.10/usage/dependency/index.html +++ /dev/null @@ -1,1934 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Manage Dependencies - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - - - - - -
    -
    - - - - - - - -

    Manage Dependencies#

    -

    PDM provides a bunch of handful commands to help manage your project and dependencies. -The following examples are run on Ubuntu 18.04, a few changes must be done if you are using Windows.

    -

    Add dependencies#

    -

    pdm add can be followed by one or several dependencies, and the dependency specification is described in PEP 508.

    -

    Examples:

    -
    1
    -2
    -3
    -4
    pdm add requests   # add requests
    -pdm add requests==2.25.1   # add requests with version constraint
    -pdm add requests[socks]   # add requests with extra dependency
    -pdm add "flask>=1.0" flask-sqlalchemy   # add multiple dependencies with different specifiers
    -
    -

    PDM also allows extra dependency groups by providing -G/--group <name> option, and those dependencies will go to -[project.optional-dependencies.<name>] table in the project file, respectively.

    -

    You can reference other optional groups in optional-dependencies, even before the package is uploaded:

    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    [project]
    -name = "foo"
    -version = "0.1.0"
    -
    -[project.optional-dependencies]
    -socks = ["pysocks"]
    -jwt = ["pyjwt"]
    -all = ["foo[socks,jwt]"]
    -
    -

    After that, dependencies and sub-dependencies will be resolved properly and installed for you, you can view pdm.lock to see the resolved result of all dependencies.

    -

    Local dependencies#

    -

    Local packages can be added with their paths. The path can be a file or a directory:

    -
    1
    -2
    pdm add ./sub-package
    -pdm add ./first-1.0.0-py2.py3-none-any.whl
    -
    -

    The paths MUST start with a ., otherwise it will be recognized as a normal named requirement. The local dependencies will be written to the pyproject.toml file with the URL format:

    -
    1
    -2
    -3
    -4
    -5
    [project]
    -dependencies = [
    -    "sub-package @ file:///${PROJECT_ROOT}/sub-package",
    -    "first @ file:///${PROJECT_ROOT}/first-1.0.0-py2.py3-none-any.whl",
    -]
    -
    -
    -Using other build backends -

    If you are using hatchling instead of the pdm backend, the URLs would be as follows:

    -

    1
    -2
    sub-package @ {root:uri}/sub-package
    -first @ {root:uri}/first-1.0.0-py2.py3-none-any.whl
    -
    -Other backends doesn't support encoding relative paths in the URL and will write the absolute path instead.

    -
    -

    URL dependencies#

    -

    PDM also supports downloading and installing packages directly from a web address.

    -

    Examples:

    -
    1
    -2
    -3
    -4
    # Install gzipped package from a plain URL
    -pdm add "https://github.com/numpy/numpy/releases/download/v1.20.0/numpy-1.20.0.tar.gz"
    -# Install wheel from a plain URL
    -pdm add "https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.5.0/en_core_web_trf-3.5.0-py3-none-any.whl"
    -
    -

    VCS dependencies#

    -

    You can also install from a git repository url or other version control systems. The following are supported:

    -
      -
    • Git: git
    • -
    • Mercurial: hg
    • -
    • Subversion: svn
    • -
    • Bazaar: bzr
    • -
    -

    The URL should be like: {vcs}+{url}@{rev}

    -

    Examples:

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    # Install pip repo on tag `22.0`
    -pdm add "git+https://github.com/pypa/pip.git@22.0"
    -# Provide credentials in the URL
    -pdm add "git+https://username:password@github.com/username/private-repo.git@master"
    -# Give a name to the dependency
    -pdm add "pip @ git+https://github.com/pypa/pip.git@22.0"
    -# Or use the #egg fragment
    -pdm add "git+https://github.com/pypa/pip.git@22.0#egg=pip"
    -# Install from a subdirectory
    -pdm add "git+https://github.com/owner/repo.git@master#egg=pkg&subdirectory=subpackage"
    -
    -

    Hide credentials in the URL#

    -

    You can hide the credentials in the URL by using the ${ENV_VAR} variable syntax:

    -
    1
    -2
    -3
    -4
    [project]
    -dependencies = [
    -  "mypackage @ git+http://${VCS_USER}:${VCS_PASSWD}@test.git.com/test/mypackage.git@master"
    -]
    -
    -

    These variables will be read from the environment variables when installing the project.

    -

    Add development only dependencies#

    -

    New in 1.5.0

    -

    PDM also supports defining groups of dependencies that are useful for development, -e.g. some for testing and others for linting. We usually don't want these dependencies appear in the distribution's metadata -so using optional-dependencies is probably not a good idea. We can define them as development dependencies:

    -
    1
    pdm add -dG test pytest
    -
    -

    This will result in a pyproject.toml as following:

    -
    1
    -2
    [tool.pdm.dev-dependencies]
    -test = ["pytest"]
    -
    -

    You can have several groups of development only dependencies. Unlike optional-dependencies, they won't appear in the package distribution metadata such as PKG-INFO or METADATA. -The package index won't be aware of these dependencies. The schema is similar to that of optional-dependencies, except that it is in tool.pdm table.

    -

    1
    -2
    -3
    -4
    -5
    -6
    -7
    [tool.pdm.dev-dependencies]
    -lint = [
    -    "flake8",
    -    "black"
    -]
    -test = ["pytest", "pytest-cov"]
    -doc = ["mkdocs"]
    -
    -For backward-compatibility, if only -d or --dev is specified, dependencies will go to dev group under [tool.pdm.dev-dependencies] by default.

    -
    -

    Note

    -

    The same group name MUST NOT appear in both [tool.pdm.dev-dependencies] and [project.optional-dependencies].

    -
    -

    Editable dependencies#

    -

    Local directories and VCS dependencies can be installed in editable mode. If you are familiar with pip, it is just like pip install -e <package>. Editable packages are allowed only in development dependencies:

    -
    -

    Note

    -

    Editable installs are only allowed in the dev dependency group. Other groups, including the default, will fail with a [PdmUsageError].

    -
    -
    1
    -2
    -3
    -4
    -5
    -6
    # A relative path to the directory
    -pdm add -e ./sub-package --dev
    -# A file URL to a local directory
    -pdm add -e file:///path/to/sub-package --dev
    -# A VCS URL
    -pdm add -e git+https://github.com/pallets/click.git@main#egg=click --dev
    -
    -

    Save version specifiers#

    -

    If the package is given without a version specifier like pdm add requests. PDM provides three different behaviors of what version -specifier is saved for the dependency, which is given by --save-<strategy>(Assume 2.21.0 is the latest version that can be found -for the dependency):

    -
      -
    • minimum: Save the minimum version specifier: >=2.21.0 (default).
    • -
    • compatible: Save the compatible version specifier: >=2.21.0,<3.0.0.
    • -
    • exact: Save the exact version specifier: ==2.21.0.
    • -
    • wildcard: Don't constrain version and leave the specifier to be wildcard: *.
    • -
    -

    Add prereleases#

    -

    One can give --pre/--prerelease option to pdm add so that prereleases are allowed to be pinned for the given packages.

    -

    Update existing dependencies#

    -

    To update all dependencies in the lock file:

    -
    1
    pdm update
    -
    -

    To update the specified package(s):

    -
    1
    pdm update requests
    -
    -

    To update multiple groups of dependencies:

    -
    1
    pdm update -G security -G http
    -
    -

    Or using comma-separated list:

    -
    1
    pdm update -G "security,http"
    -
    -

    To update a given package in the specified group:

    -
    1
    pdm update -G security cryptography
    -
    -

    If the group is not given, PDM will search for the requirement in the default dependencies set and raises an error if none is found.

    -

    To update packages in development dependencies:

    -
    1
    -2
    -3
    -4
    # Update all default + dev-dependencies
    -pdm update -d
    -# Update a package in the specified group of dev-dependencies
    -pdm update -dG test pytest
    -
    -

    About update strategy#

    -

    Similarly, PDM also provides 3 different behaviors of updating dependencies and sub-dependencies, -which is given by --update-<strategy> option:

    -
      -
    • reuse: Keep all locked dependencies except for those given in the command line (default).
    • -
    • eager: Try to lock a newer version of the packages in command line and their recursive sub-dependencies and keep other dependencies as they are.
    • -
    • all: Update all dependencies and sub-dependencies.
    • -
    -

    Update packages to the versions that break the version specifiers#

    -

    One can give -u/--unconstrained to tell PDM to ignore the version specifiers in the pyproject.toml. -This works similarly to the yarn upgrade -L/--latest command. Besides, pdm update also supports the ---pre/--prerelease option.

    -

    Remove existing dependencies#

    -

    To remove existing dependencies from project file and the library directory:

    -
    1
    -2
    -3
    -4
    -5
    -6
    # Remove requests from the default dependencies
    -pdm remove requests
    -# Remove h11 from the 'web' group of optional-dependencies
    -pdm remove -G web h11
    -# Remove pytest-cov from the `test` group of dev-dependencies
    -pdm remove -dG test pytest-cov
    -
    -

    Install the packages pinned in lock file#

    -

    There are a few similar commands to do this job with slight differences:

    -
      -
    • pdm sync installs packages from the lock file.
    • -
    • pdm update will update the lock file, then sync.
    • -
    • pdm install will check the project file for changes, update the lock file if needed, then sync.
    • -
    -

    sync also has a few options to manage installed packages:

    -
      -
    • --clean: will remove packages no longer in the lockfile
    • -
    • --only-keep: only selected packages (using options like -G or --prod) will be kept.
    • -
    -

    Specify the lockfile to use#

    -

    You can specify another lockfile than the default pdm lock by using the -L/--lockfile <filepath> option or the PDM_LOCKFILE environment variable.

    -

    Select a subset of dependency groups to be installed or locked#

    -

    Say we have a project with following dependencies:

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    [project]  # This is production dependencies
    -dependencies = ["requests"]
    -
    -[project.optional-dependencies]  # This is optional dependencies
    -extra1 = ["flask"]
    -extra2 = ["django"]
    -
    -[tool.pdm.dev-dependencies]  # This is dev dependencies
    -dev1 = ["pytest"]
    -dev2 = ["mkdocs"]
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    CommandWhat it doesComments
    pdm installinstall all groups locked in the lockfile
    pdm install -G extra1install prod deps, dev deps, and "extra1" optional group
    pdm install -G dev1install prod deps and only "dev1" dev group
    pdm install -G:allinstall prod deps, dev deps and "extra1", "extra2" optional groups
    pdm install -G extra1 -G dev1install prod deps, "extra1" optional group and only "dev1" dev group
    pdm install --prodinstall prod only
    pdm install --prod -G extra1install prod deps and "extra1" optional
    pdm install --prod -G dev1Fail, --prod can't be given with dev dependenciesLeave the --prod option
    -

    All development dependencies are included as long as --prod is not passed and -G doesn't specify any dev groups.

    -

    Besides, if you don't want the root project to be installed, add --no-self option, and --no-editable can be used when you want all packages to be installed in non-editable versions.

    -

    You may also use the pdm lock command with these options to lock only the specified groups, which will be recorded in the [metadata] table of the lock file. If no --group/--prod/--dev/--no-default option is specified, pdm sync and pdm update will operate using the groups in the lockfile. However, if any groups that are not included in the lockfile are given as arguments to the commands, PDM will raise an error.

    -

    This feature is especially valuable when managing multiple lockfiles, where each may have different versions of the same package pinned. To switch between lockfiles, you can use the --lockfile/-L option.

    -

    For a realistic example, your project depends on a release version of werkzeug and you may want to work with a local in-development copy of it when developing. You can add the following to your pyproject.toml:

    -
    1
    -2
    -3
    -4
    -5
    -6
    [project]
    -requires-python = ">=3.7"
    -dependencies = ["werkzeug"]
    -
    -[tool.pdm.dev-dependencies]
    -dev = ["werkzeug @ file:///${PROJECT_ROOT}/dev/werkzeug"]
    -
    -

    Then, run pdm lock with different options to generate lockfiles for different purposes:

    -
    1
    -2
    -3
    -4
    -5
    -6
    # Lock default + dev, write to pdm.lock
    -# with the local copy of werkzeug pinned.
    -pdm lock
    -# Lock default, write to pdm.prod.lock
    -# with the release version of werkzeug pinned.
    -pdm lock --prod -L pdm.prod.lock
    -
    -

    Check the metadata.groups field in the lockfile to see which groups are included.

    -

    Lock strategies#

    -

    Currently, we support three flags to control the locking behavior: cross_platform, static_urls and direct_minimal_versions, with the meanings as follows. -You can pass one or more flags to pdm lock by --strategy/-S option, either by giving a comma-separated list or by passing the option multiple times. -Both of these commands function in the same way:

    -
    1
    -2
    pdm lock -S cross_platform,static_urls
    -pdm lock -S cross_platform -S static_urls
    -
    -

    The flags will be encoded in the lockfile and get read when you run pdm lock next time. But you can disable flags by prefixing the flag name with no_:

    -
    1
    pdm lock -S no_cross_platform
    -
    -

    This command makes the lockfile not cross-platform.

    -

    Cross platform#

    -

    New in version 2.6.0

    -

    By default, the generated lockfile is cross-platform, which means the current platform isn't taken into account when resolving the dependencies. The result lockfile will contain wheels and dependencies for all possible platforms and Python versions. -However, sometimes this will result in a wrong lockfile when a release doesn't contain all wheels. To avoid this, you can tell PDM -to create a lockfile that works for this platform only, trimming the wheels not relevant to the current platform. This can be done by passing the --strategy no_cross_platform option to pdm lock:

    -
    1
    pdm lock --strategy no_cross_platform
    -
    -

    Static URLs#

    -

    New in version 2.8.0

    -

    By default, PDM only stores the filenames of the packages in the lockfile, which benefits the reusability across different package indexes. -However, if you want to store the static URLs of the packages in the lockfile, you can pass the --strategy static_urls option to pdm lock:

    -
    1
    pdm lock --strategy static_urls
    -
    -

    The settings will be saved and remembered for the same lockfile. You can also pass --strategy no_static_urls to disable it.

    -

    Direct minimal versions#

    -

    New in version 2.10.0

    -

    When it is enabled by passing --strategy direct_minimal_versions, dependencies specified in the pyproject.toml will be resolved to the minimal versions available, rather than the latest versions. This is useful when you want to test the compatibility of your project within a range of dependency versions.

    -

    For example, if you specified flask>=2.0 in the pyproject.toml, flask will be resolved to version 2.0.0 if there is no other compatibility issue.

    -
    -

    Note

    -

    Version constraints in package dependencies are not future-proof. If you resolve the dependencies to the minimal versions, there will likely be backwards-compatibility issues. -For example, flask==2.0.0 requires werkzeug>=2.0, but in fact, it can not work with Werkzeug 3.0.0, which is released 2 years after it.

    -
    -

    Show what packages are installed#

    -

    Similar to pip list, you can list all packages installed in the packages directory:

    -
    1
    pdm list
    -
    -

    Include and exclude groups#

    -

    By default, all packages installed in the working set will be listed. You can specify which groups to be listed -by --include/--exclude options, and include has a higher priority than exclude.

    -
    1
    -2
    pdm list --include dev
    -pdm list --exclude test
    -
    -

    There is a special group :sub, when included, all transitive dependencies will also be shown. It is included by default.

    -

    You can also pass --resolve to pdm list, which will show the packages resolved in pdm.lock, rather than installed in the working set.

    -

    Change the output fields and format#

    -

    By default, name, version and location will be shown in the list output, you can view more fields or specify the order of fields by --fields option:

    -
    1
    pdm list --fields name,license,version
    -
    -

    For all supported fields, please refer to the CLI reference.

    -

    Also, you can specify the output format other than the default table output. The supported formats and options are --csv, --json, --markdown and --freeze.

    -

    Show the dependency tree#

    -

    Or show a dependency tree by:

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    $ pdm list --tree
    -tempenv 0.0.0
    -└── click 7.0 [ required: <7.0.0,>=6.7 ]
    -black 19.10b0
    -├── appdirs 1.4.3 [ required: Any ]
    -├── attrs 19.3.0 [ required: >=18.1.0 ]
    -├── click 7.0 [ required: >=6.5 ]
    -├── pathspec 0.7.0 [ required: <1,>=0.6 ]
    -├── regex 2020.2.20 [ required: Any ]
    -├── toml 0.10.0 [ required: >=0.9.4 ]
    -└── typed-ast 1.4.1 [ required: >=1.4.0 ]
    -bump2version 1.0.0
    -
    -

    Note that --fields option doesn't work with --tree.

    -

    Filter packages by patterns#

    -

    You can also limit the packages to show by passing the patterns to pdm list:

    -
    1
    pdm list flask-* requests-*
    -
    -
    -Be careful with the shell expansion -

    In most shells, the wildcard * will be expanded if there are matching files under the current directory. -To avoid getting unexpected results, you can quote the patterns: pdm list 'flask-*' 'requests-*'.

    -
    -

    In --tree mode, only the subtree of the matched packages will be displayed. This can be used to achieve the same purpose as pnpm why, which is to show why a specific package is required.

    -
    1
    -2
    -3
    -4
    $ pdm list --tree --reverse certifi
    -certifi 2023.7.22
    -└── requests 2.31.0 [ requires: >=2017.4.17 ]
    -    └── cachecontrol[filecache] 0.13.1 [ requires: >=2.16.0 ]
    -
    -

    Allow prerelease versions to be installed#

    -

    Include the following setting in pyproject.toml to enable:

    -
    1
    -2
    [tool.pdm]
    -allow_prereleases = true
    -
    -

    Set acceptable format for locking or installing#

    -

    If you want to control the format(binary/sdist) of the packages, you can set the env vars PDM_NO_BINARY and PDM_ONLY_BINARY.

    -

    Each env var is a comma-separated list of package name. You can set it to :all: to apply to all packages. For example:

    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    # No binary for werkzeug will be locked nor used for installation
    -PDM_NO_BINARY=werkzeug pdm add flask
    -# Only binaries will be locked in the lock file
    -PDM_ONLY_BINARY=:all: pdm lock
    -# No binaries will be used for installation
    -PDM_NO_BINARY=:all: pdm install
    -# Prefer binary distributions and even if sdist with higher version is available
    -PDM_PREFER_BINARY=flask pdm install
    -
    -

    Solve the locking failure#

    -

    If PDM is not able to find a resolution to satisfy the requirements, it will raise an error. For example,

    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    pdm django==3.1.4 "asgiref<3"
    -...
    -🔒 Lock failed
    -Unable to find a resolution for asgiref because of the following conflicts:
    -  asgiref<3 (from project)
    -  asgiref<4,>=3.2.10 (from <Candidate django 3.1.4 from https://pypi.org/simple/django/>)
    -To fix this, you could loosen the dependency version constraints in pyproject.toml. If that is not possible, you could also override the resolved version in `[tool.pdm.resolution.overrides]` table.
    -
    -

    You can either change to a lower version of django or remove the upper bound of asgiref. But if it is not eligible for your project, you can try overriding the resolved package versions in pyproject.toml.

    -

    Manage global project#

    -

    Sometimes users may want to keep track of the dependencies of global Python interpreter as well. -It is easy to do so with PDM, via -g/--global option which is supported by most subcommands.

    -

    If the option is passed, <CONFIG_ROOT>/global-project will be used as the project directory, which is -almost the same as normal project except that pyproject.toml will be created automatically for you -and it doesn't support build features. The idea is taken from Haskell's stack.

    -

    However, unlike stack, by default, PDM won't use global project automatically if a local project is not found. -Users should pass -g/--global explicitly to activate it, since it is not very pleasing if packages go to a wrong place. -But PDM also leave the decision to users, just set the config global_project.fallback to true.

    -

    By default, when pdm uses global project implicitly the following message is printed: Project is not found, fallback to the global project. To disable this message set the config global_project.fallback_verbose to false.

    -

    If you want global project to track another project file other than <CONFIG_ROOT>/global-project, you can provide the -project path via -p/--project <path> option. Especially if you pass --global --project ., PDM will install the dependencies -of the current project into the global Python.

    -
    -

    Warning

    -

    Be careful with remove and sync --clean/--pure commands when global project is used, because it may remove packages installed in your system Python.

    -
    -

    Export locked packages to alternative formats#

    -

    You can also export pdm lock to other formats, to ease the CI flow or image building process. Currently, -only requirements.txt format is supported:

    -
    1
    pdm export -o requirements.txt
    -
    -
    -

    Note

    -

    You can also run pdm export with a .pre-commit hook.

    -
    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/hooks/index.html b/2.10/usage/hooks/index.html deleted file mode 100644 index 2d9c27a8ac..0000000000 --- a/2.10/usage/hooks/index.html +++ /dev/null @@ -1,1279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Lifecycle and Hooks - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    - - - - - - - -

    Lifecycle and Hooks#

    -

    As any Python deliverable, your project will go through the different phases -of a Python project lifecycle and PDM provides commands to perform the expected tasks for those phases.

    -

    It also provides hooks attached to these steps allowing for:

    -
      -
    • plugins to listen to the signals of the same name.
    • -
    • developers to define custom scripts with the same name.
    • -
    -

    Besides, pre_invoke signal is emitted before ANY command is invoked, allowing plugins to modify the project or options beforehand.

    -

    The built-in commands are currently split into 3 groups:

    - -

    You will most probably need to perform some recurrent tasks between the installation and publication phases (housekeeping, linting, testing, ...) -this is why PDM lets you define your own tasks/phases using user scripts.

    -

    To provides full flexibility, PDM allows to skip some hooks and tasks on demand.

    -

    Initialization#

    -

    The initialization phase should occur only once in a project lifetime by running the pdm init -command to initialize an existing project (prompt to fill the pyproject.toml file).

    -

    They trigger the following hooks:

    - -
    flowchart LR
    -  subgraph pdm-init [pdm init]
    -    direction LR
    -    post-init{{Emit post_init}}
    -    init --> post-init
    -  end
    -

    Dependencies management#

    -

    The dependencies management is required for the developer to be able to work and perform the following:

    -
      -
    • lock: compute a lock file from the pyproject.toml requirements.
    • -
    • sync: synchronize (add/remove/update) PEP582 packages from the lock file and install the current project as editable.
    • -
    • add: add a dependency
    • -
    • remove: remove a dependency
    • -
    -

    All those steps are directly available with the following commands:

    -
      -
    • pdm lock: execute the lock task
    • -
    • pdm sync: execute the sync task
    • -
    • pdm install: execute the sync task, preceded from lock if required
    • -
    • pdm add: add a dependency requirement, re-lock and then sync
    • -
    • pdm remove: remove a dependency requirement, re-lock and then sync
    • -
    • pdm update: re-lock dependencies from their latest versions and then sync
    • -
    -

    They trigger the following hooks:

    - -
    flowchart LR
    -  subgraph pdm-install [pdm install]
    -    direction LR
    -
    -    subgraph pdm-lock [pdm lock]
    -      direction TB
    -      pre-lock{{Emit pre_lock}}
    -      post-lock{{Emit post_lock}}
    -      pre-lock --> lock --> post-lock
    -    end
    -
    -    subgraph pdm-sync [pdm sync]
    -      direction TB
    -      pre-install{{Emit pre_install}}
    -      post-install{{Emit post_install}}
    -      pre-install --> sync --> post-install
    -    end
    -
    -    pdm-lock --> pdm-sync
    -  end
    -

    Switching Python version#

    -

    This is a special case in dependency management: -you can switch the current Python version using pdm use -and it will emit the post_use signal with the new Python interpreter.

    -
    flowchart LR
    -  subgraph pdm-use [pdm use]
    -    direction LR
    -    post-use{{Emit post_use}}
    -    use --> post-use
    -  end
    -

    Publication#

    -

    As soon as you are ready to publish your package/library, you will require the publication tasks:

    -
      -
    • build: build/compile assets requiring it and package everything into a Python package (sdist, wheel)
    • -
    • upload: upload/publish the package to a remote PyPI index
    • -
    -

    All those steps are available with the following commands:

    - -

    They trigger the following hooks:

    - -
    flowchart LR
    -  subgraph pdm-publish [pdm publish]
    -    direction LR
    -    pre-publish{{Emit pre_publish}}
    -    post-publish{{Emit post_publish}}
    -
    -    subgraph pdm-build [pdm build]
    -      pre-build{{Emit pre_build}}
    -      post-build{{Emit post_build}}
    -      pre-build --> build --> post-build
    -    end
    -
    -    %% subgraph pdm-upload [pdm upload]
    -    %%   pre-upload{{Emit pre_upload}}
    -    %%   post-upload{{Emit post_upload}}
    -    %%   pre-upload --> upload --> post-upload
    -    %% end
    -
    -    pre-publish --> pdm-build --> upload --> post-publish
    -  end
    -

    Execution will stop at first failure, hooks included.

    -

    User scripts#

    -

    User scripts are detailed in their own section but you should know that:

    -
      -
    • each user script can define a pre_* and post_* script, including composite scripts.
    • -
    • each run execution will trigger the pre_run and post_run hooks
    • -
    • each script execution will trigger the pre_script and post_script hooks
    • -
    -

    Given the following scripts definition:

    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    [tool.pdm.scripts]
    -pre_script = ""
    -post_script = ""
    -pre_test = ""
    -post_test = ""
    -test = ""
    -pre_composite = ""
    -post_composite = ""
    -composite = {composite = ["test"]}
    -
    -

    a pdm run test will have the following lifecycle:

    -
    flowchart LR
    -  subgraph pdm-run-test [pdm run test]
    -    direction LR
    -    pre-run{{Emit pre_run}}
    -    post-run{{Emit post_run}}
    -    subgraph run-test [test task]
    -      direction TB
    -      pre-script{{Emit pre_script}}
    -      post-script{{Emit post_script}}
    -      pre-test[Execute pre_test]
    -      post-test[Execute post_test]
    -      test[Execute test]
    -
    -      pre-script --> pre-test --> test --> post-test --> post-script
    -    end
    -
    -    pre-run --> run-test --> post-run
    -  end
    -

    while pdm run composite will have the following:

    -
    flowchart LR
    -  subgraph pdm-run-composite [pdm run composite]
    -    direction LR
    -    pre-run{{Emit pre_run}}
    -    post-run{{Emit post_run}}
    -
    -    subgraph run-composite [composite task]
    -      direction TB
    -      pre-script-composite{{Emit pre_script}}
    -      post-script-composite{{Emit post_script}}
    -      pre-composite[Execute pre_composite]
    -      post-composite[Execute post_composite]
    -
    -      subgraph run-test [test task]
    -        direction TB
    -        pre-script-test{{Emit pre_script}}
    -        post-script-test{{Emit post_script}}
    -        pre-test[Execute pre_test]
    -        post-test[Execute post_test]
    -
    -        pre-script-test --> pre-test --> test --> post-test --> post-script-test
    -      end
    -
    -      pre-script-composite --> pre-composite --> run-test --> post-composite --> post-script-composite
    -    end
    -
    -     pre-run --> run-composite --> post-run
    -  end
    -

    Skipping#

    -

    It is possible to control which task and hook runs for any built-in command as well as custom user scripts -using the --skip option.

    -

    It accepts a comma-separated list of hooks/task names to skip -as well as the predefined :all, :pre and :post shortcuts -respectively skipping all hooks, all pre_* hooks and all post_* hooks. -You can also provide the skip list in PDM_SKIP_HOOKS environment variable -but it will be overridden as soon as the --skip parameter is provided.

    -

    Given the previous script block, running pdm run --skip=:pre,post_test composite will result in the following reduced lifecycle:

    -
    flowchart LR
    -  subgraph pdm-run-composite [pdm run composite]
    -    direction LR
    -    post-run{{Emit post_run}}
    -
    -    subgraph run-composite [composite task]
    -      direction TB
    -      post-script-composite{{Emit post_script}}
    -      post-composite[Execute post_composite]
    -
    -      subgraph run-test [test task]
    -        direction TB
    -        post-script-test{{Emit post_script}}
    -
    -        test --> post-script-test
    -      end
    -
    -      run-test --> post-composite --> post-script-composite
    -    end
    -
    -     run-composite --> post-run
    -  end
    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/pep582/index.html b/2.10/usage/pep582/index.html deleted file mode 100644 index 9ae1a43348..0000000000 --- a/2.10/usage/pep582/index.html +++ /dev/null @@ -1,1349 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Working with PEP 582 - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    - - - - - - - -

    Working with PEP 582#

    -
    -

    PEP 582 has been rejected

    -

    This is a rejected PEP. However, due to the fact that this feature is the reason for PDM's birth, PDM will retain the support. -We recommend using virtual environments instead.

    -
    -

    With PEP 582, dependencies will be installed into __pypackages__ directory under the project root. With PEP 582 enabled globally, you can also use the project interpreter to run scripts directly.

    -

    When the project interpreter is a normal Python, this mode is enabled.

    -

    Besides, on a project you work with for the first time on your machine, if it contains an empty __pypackages__ directory, PEP 582 is enabled automatically, and virtualenv won't be created.

    -

    Enable PEP 582 globally#

    -

    To make the Python interpreters aware of PEP 582 packages, one need to add the pdm/pep582/sitecustomize.py -to the Python library search path.

    -
    -
    -
    -

    One just needs to execute pdm --pep582, then environment variable will be changed automatically. Don't forget -to restart the terminal session to take effect.

    -
    -
    -

    The command to change the environment variables can be printed by pdm --pep582 [<SHELL>]. If <SHELL> -isn't given, PDM will pick one based on some guesses. You can run eval "$(pdm --pep582)" to execute the command.

    -

    You may want to write a line in your .bash_profile(or similar profiles) to make it effective when logging in. -For example, in bash you can do this:

    -
    1
    pdm --pep582 >> ~/.bash_profile
    -
    -

    Once again, Don't forget to restart the terminal session to take effect.

    -
    -
    -
    -
    -How is it done? -

    Thanks to the site packages loading on Python startup. It is possible to patch the sys.path -by executing the sitecustomize.py shipped with PDM. The interpreter can search the directories -for the nearest __pypackage__ folder and append it to the sys.path variable.

    -
    -

    Configure IDE to support PEP 582#

    -

    Now there are no built-in support or plugins for PEP 582 in most IDEs, you have to configure your tools manually.

    -

    PyCharm#

    -

    Mark __pypackages__/<major.minor>/lib as Sources Root. -Then, select as Python interpreter a Python installation with the same <major.minor> version.

    -

    Additionally, if you want to use tools from the environment (e.g. pytest), you have to add the -__pypackages__/<major.minor>/bin directory to the PATH variable in the corresponding -run/debug configuration.

    -

    VSCode#

    -

    Add the following two entries to the top-level dict in .vscode/settings.json:

    -
    1
    -2
    -3
    -4
    {
    -  "python.autoComplete.extraPaths": ["__pypackages__/<major.minor>/lib"],
    -  "python.analysis.extraPaths": ["__pypackages__/<major.minor>/lib"]
    -}
    -
    -

    This file can be auto-generated with plugin pdm-vscode.

    -

    Enable PEP582 globally, -and make sure VSCode runs using the same user and shell you enabled PEP582 for.

    -
    -Cannot enable PEP582 globally? -

    If for some reason you cannot enable PEP582 globally, you can still configure each "launch" in each project: -set the PYTHONPATH environment variable in your launch configuration, in .vscode/launch.json. -For example, to debug your pytest run:

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    {
    -    "version": "0.2.0",
    -    "configurations": [
    -        {
    -            "name": "pytest",
    -            "type": "python",
    -            "request": "launch",
    -            "module": "pytest",
    -            "args": ["tests"],
    -            "justMyCode": false,
    -            "env": {"PYTHONPATH": "__pypackages__/<major.minor>/lib"}
    -        }
    -    ]
    -}
    -
    -

    If your package resides in a src directory, add it to PYTHONPATH as well:

    -
    1
    "env": {"PYTHONPATH": "src:__pypackages__/<major.minor>/lib"}
    -
    -
    -
    -Using Pylance/Pyright? -

    If you have configured "python.analysis.diagnosticMode": "workspace", -and you see a ton of errors/warnings as a result. -you may need to create pyrightconfig.json in the workspace directory, and fill in the following fields:

    -
    1
    -2
    -3
    {
    -    "exclude": ["__pypackages__"]
    -}
    -
    -

    Then restart the language server or VS Code and you're good to go. -In the future (microsoft/pylance-release#1150), maybe the problem will be solved.

    -
    -
    -Using Jupyter Notebook? -

    If you wish to use pdm to install jupyter notebook and use it in vscode in conjunction with the python extension:

    -
      -
    1. Use pdm add notebook or so to install notebook
    2. -
    3. Add a .env file inside of your project directory with contents like the following:
    4. -
    -
    1
    PYTHONPATH=/your-workspace-path/__pypackages__/<major>.<minor>/lib
    -
    -

    If the above still doesn't work, it's most likely because the environment variable is not properly loaded when the Notebook starts. There are two workarounds.

    -
      -
    1. Run code . in Terminal. It will open a new VSCode window in the current directory with the path set correctly. Use the Jupyter Notebook in the new window
    2. -
    3. If you prefer not to open a new window, run the following at the beginning of your Jupyter Notebook to explicitly set the path:
    4. -
    -
    1
    -2
    import sys
    -sys.path.append('/your-workspace-path/__pypackages__/<major>.<minor>/lib')
    -
    -
    -

    Reference Issue

    -
    -
    -
    -PDM Task Provider -

    In addition, there is a VSCode Task Provider extension available for download.

    -

    This makes it possible for VSCode to automatically detect pdm scripts so they -can be run natively as VSCode Tasks.

    -
    -

    Neovim#

    -

    If using neovim-lsp with -pyright and want your -__pypackages__ directory to be added to the path, you can add this to your -project's pyproject.toml.

    -
    1
    -2
    [tool.pyright]
    -extraPaths = ["__pypackages__/<major.minor>/lib/"]
    -
    -

    Emacs#

    -

    You have a few options, but basically you'll want to tell an LSP client to add __pypackages__ to the paths it looks at. Here are a few options that are available:

    -

    Using pyproject.toml and pyright#

    -

    Add this to your project's pyproject.toml:

    -
    1
    -2
    [tool.pyright]
    -extraPaths = ["__pypackages__/<major.minor>/lib/"]
    -
    -

    eglot + pyright#

    -

    Using pyright and eglot (included in Emacs 29), add the following to your config:

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    (defun get-pdm-packages-path ()
    -  "For the current PDM project, find the path to the packages."
    -  (let ((packages-path (string-trim (shell-command-to-string "pdm info --packages"))))
    -    (concat packages-path "/lib")))
    -
    -(defun my/eglot-workspace-config (server)
    -  "For the current PDM project, dynamically generate a python lsp config."
    -  `(:python\.analysis (:extraPaths ,(vector (get-pdm-packages-path)))))
    -
    -(setq-default eglot-workspace-configuration #'my/eglot-workspace-config)
    -
    -

    You'll want pyright installed either globally, or in your project (probably as a dev dependency). You can add this with, for example:

    -
    1
    pdm add --dev --group devel pyright
    -
    -

    LSP-Mode + lsp-python-ms#

    -

    Below is a sample code snippet showing how to make PDM work with lsp-python-ms in Emacs. Contributed by @linw1995.

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
      ;; TODO: Cache result
    -  (defun linw1995/pdm-get-python-executable (&optional dir)
    -    (let ((pdm-get-python-cmd "pdm info --python"))
    -      (string-trim
    -       (shell-command-to-string
    -        (if dir
    -            (concat "cd "
    -                    dir
    -                    " && "
    -                    pdm-get-python-cmd)
    -          pdm-get-python-cmd)))))
    -
    -  (defun linw1995/pdm-get-packages-path (&optional dir)
    -    (let ((pdm-get-packages-cmd "pdm info --packages"))
    -      (concat (string-trim
    -               (shell-command-to-string
    -                (if dir
    -                    (concat "cd "
    -                            dir
    -                            " && "
    -                            pdm-get-packages-cmd)
    -                  pdm-get-packages-cmd)))
    -              "/lib")))
    -
    -  (use-package lsp-python-ms
    -    :ensure t
    -    :init (setq lsp-python-ms-auto-install-server t)
    -    :hook (python-mode
    -           . (lambda ()
    -               (setq lsp-python-ms-python-executable (linw1995/pdm-get-python-executable))
    -               (setq lsp-python-ms-extra-paths (vector (linw1995/pdm-get-packages-path)))
    -               (require 'lsp-python-ms)
    -               (lsp))))  ; or lsp-deferred
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/project/index.html b/2.10/usage/project/index.html deleted file mode 100644 index 58a4c9b4b4..0000000000 --- a/2.10/usage/project/index.html +++ /dev/null @@ -1,1250 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - New Project - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - - - - - -
    -
    - - - - - - - -

    New Project#

    -

    To start with, create a new project with pdm init:

    -
    1
    -2
    mkdir my-project && cd my-project
    -pdm init
    -
    -

    You will need to answer a few questions, to help PDM to create a pyproject.toml file for you. -For more usages of pdm init, please read Create your project from a template.

    -

    Choose a Python interpreter#

    -

    At first, you need to choose a Python interpreter from a list of Python versions installed on your machine. The interpreter path -will be stored in .pdm-python and used by subsequent commands. You can also change it later with pdm use.

    -

    Alternatively, you can specify the Python interpreter path via PDM_PYTHON environment variable. When it is set, the path saved in .pdm-python will be ignored.

    -

    Virtualenv or not#

    -

    After you select the Python interpreter, PDM will ask you whether you want to create a virtual environment for the project. -If you choose yes, PDM will create a virtual environment in the project root directory, and use it as the Python interpreter -for the project.

    -

    If the selected Python interpreter is in a virtual environment, PDM will use it as the project environment and install dependencies -into it. Otherwise, __pypackages__ will be created in the project root and dependencies will be installed into it.

    -

    For the difference between these two approaches, please refer to the corresponding sections in the docs:

    - -

    Library or Application#

    -

    A library and an application differ in many ways. In short, a library is a package that is intended to be installed and used by other projects. In most cases it also needs to be uploaded to PyPI. An application, on the other hand, is one that is directly facing end users and may need to be deployed into some production environments.

    -

    In PDM, if you choose to create a library, PDM will add a name, version field to the pyproject.toml file, as well as a [build-system] table for the build backend, which is only useful if your project needs to be built and distributed. So you need to manually add these fields to pyproject.toml if you want to change the project from an application to a library. Also, a library project will be installed into the environment when you run pdm install or pdm sync, unless --no-self is specified.

    -

    Set requires-python value#

    -

    You need to set an appropriate requires-python value for your project. This is an important property that affects how dependencies are resolved. Basically, each package's requires-python must cover the project's requires-python range. For example, consider the following setup:

    -
      -
    • Project: requires-python = ">=3.9"
    • -
    • Package foo: requires-python = ">=3.7,<3.11"
    • -
    -

    Resolving the dependencies will cause a ResolutionImpossible:

    -
    1
    -2
    Unable to find a resolution because the following dependencies don't work
    -on all Python versions defined by the project's `requires-python`
    -
    -

    Because the dependency's requires-python is >=3.7,<3.11, it doesn't cover the project's requires-python range of >=3.9. In other words, the project promises to work on Python 3.11 and above, but the dependency doesn't support it. Since PDM creates a cross-platform lockfile that should work on all Python versions within the requires-python range, it can't find a valid resolution. -To fix this, you need add a maximum version to requires-python, like >=3.9,<3.11.

    -

    The value of requires-python is a version specifier as defined in PEP 440. Here are some examples:

    - - - - - - - - - - - - - - - - - - - - - -
    requires-pythonMeaning
    >=3.7Python 3.7 and above
    >=3.7,<3.11Python 3.7, 3.8 and 3.10
    >=3.6,!=3.8.*,!=3.9.*Python 3.6 and above, except 3.8 and 3.9
    -

    Working with Python < 3.7#

    -

    Although PDM run on Python 3.7 and above, you can still have lower Python versions for your working project. But remember, if your project is a library, which needs to be built, published or installed, you make sure the PEP 517 build backend being used supports the lowest Python version you need. For instance, the default backend pdm-backend only works on Python 3.7+, so if you run pdm build on a project with Python 3.6, you will get an error. Most modern build backends have dropped the support for Python 3.6 and lower, so it is highly recommended to upgrade the Python version to 3.7+. Here are the supported Python range for some commonly used build backends, we only list those that support PEP 621 since otherwise PDM can't work with them.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    BackendSupported PythonSupport PEP 621
    pdm-backend>=3.7Yes
    setuptools>=60>=3.7Experimental
    hatchling>=3.7Yes
    flit-core>=3.4>=3.6Yes
    flit-core>=3.2,<3.4>=3.4Yes
    -

    Note that if your project is an application (i.e. without the name metadata), -the above limitation of backends does not apply. Therefore, if you don't need a build backend you can use any Python version >=2.7.

    -

    Import the project from other package managers#

    -

    If you are already using other package manager tools like Pipenv or Poetry, it is easy to migrate to PDM. -PDM provides import command so that you don't have to initialize the project manually, it now supports:

    -
      -
    1. Pipenv's Pipfile
    2. -
    3. Poetry's section in pyproject.toml
    4. -
    5. Flit's section in pyproject.toml
    6. -
    7. requirements.txt format used by pip
    8. -
    9. setuptools setup.py(It requires setuptools to be installed in the project environment. You can do this by configuring venv.with_pip to true for venv and pdm add setuptools for __pypackages__)
    10. -
    -

    Also, when you are executing pdm init or pdm install, PDM can auto-detect possible files to import if your PDM project has not been initialized yet.

    -
    -

    Info

    -

    Converting a setup.py will execute the file with the project interpreter. Make sure setuptools is installed with the interpreter and the setup.py is trusted.

    -
    -

    Working with version control#

    -

    You must commit the pyproject.toml file. You should commit the pdm.lock and pdm.toml file. Do not commit the .pdm-python file.

    -

    The pyproject.toml file must be committed as it contains the project's build metadata and dependencies needed for PDM. -It is also commonly used by other python tools for configuration. Read more about the pyproject.toml file at -Pip documentation.

    -

    You should be committing the pdm.lock file, by doing so you ensure that all installers are using the same versions of dependencies. -To learn how to update dependencies see update existing dependencies.

    -

    pdm.toml contains some project-wide configuration and it may be useful to commit it for sharing.

    -

    .pdm-python stores the Python path used by the current project and doesn't need to be shared.

    -

    Show the current Python environment#

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
    -20
    -21
    -22
    -23
    -24
    -25
    $ pdm info
    -PDM version:
    -  2.0.0
    -Python Interpreter:
    -  /opt/homebrew/opt/python@3.9/bin/python3.9 (3.9)
    -Project Root:
    -  /Users/fming/wkspace/github/test-pdm
    -Project Packages:
    -  /Users/fming/wkspace/github/test-pdm/__pypackages__/3.9
    -
    -# Show environment info
    -$ pdm info --env
    -{
    -  "implementation_name": "cpython",
    -  "implementation_version": "3.8.0",
    -  "os_name": "nt",
    -  "platform_machine": "AMD64",
    -  "platform_release": "10",
    -  "platform_system": "Windows",
    -  "platform_version": "10.0.18362",
    -  "python_full_version": "3.8.0",
    -  "platform_python_implementation": "CPython",
    -  "python_version": "3.8",
    -  "sys_platform": "win32"
    -}
    -
    -

    This command is useful for checking which mode is being used by the project:

    - -

    Now, you have set up a new PDM project and get a pyproject.toml file. Refer to metadata section -about how to write pyproject.toml properly.

    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/publish/index.html b/2.10/usage/publish/index.html deleted file mode 100644 index c409a8c13c..0000000000 --- a/2.10/usage/publish/index.html +++ /dev/null @@ -1,1031 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Build and Publish - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    - - - - - - - -

    Build and Publish#

    -

    If you are developing a library, after adding dependencies to your project, and finishing the coding, it's time to build and publish your package. It is as simple as one command:

    -
    1
    pdm publish
    -
    -

    This will automatically build a wheel and a source distribution(sdist), and upload them to the PyPI index.

    -

    To specify another repository other than PyPI, use the --repository option, the parameter can be either the upload URL or the name of the repository stored in the config file.

    -
    1
    -2
    pdm publish --repository testpypi
    -pdm publish --repository https://test.pypi.org/legacy/
    -
    -

    Publish with trusted publishers#

    -

    You can configure trusted publishers for PyPI so that you don't need to expose the PyPI tokens in the release workflow. To do this, follow -the guide to add a publisher and write the GitHub Actions workflow as below:

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    jobs:
    -  pypi-publish:
    -    name: upload release to PyPI
    -    runs-on: ubuntu-latest
    -    permissions:
    -      # IMPORTANT: this permission is mandatory for trusted publishing
    -      id-token: write
    -    steps:
    -      - uses: actions/checkout@v3
    -
    -      - uses: pdm-project/setup-pdm@v3
    -
    -      - name: Publish package distributions to PyPI
    -        run: pdm publish
    -
    -

    Build and publish separately#

    -

    You can also build the package and upload it in two steps, to allow you to inspect the built artifacts before uploading.

    -
    1
    pdm build
    -
    -

    There are many options to control the build process, depending on the backend used. Refer to the build configuration section for more details.

    -

    The artifacts will be created at dist/ and able to upload to PyPI.

    -
    1
    pdm publish --no-build
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/scripts/index.html b/2.10/usage/scripts/index.html deleted file mode 100644 index a62320b113..0000000000 --- a/2.10/usage/scripts/index.html +++ /dev/null @@ -1,1507 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - PDM Scripts - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    - - - - - - - -

    PDM Scripts#

    -

    Like npm run, with PDM, you can run arbitrary scripts or commands with local packages loaded.

    -

    Arbitrary Scripts#

    -
    1
    pdm run flask run -p 54321
    -
    -

    It will run flask run -p 54321 in the environment that is aware of packages in your project environment.

    -

    User Scripts#

    -

    PDM also supports custom script shortcuts in the optional [tool.pdm.scripts] section of pyproject.toml.

    -

    You can then run pdm run <script_name> to invoke the script in the context of your PDM project. For example:

    -
    1
    -2
    [tool.pdm.scripts]
    -start = "flask run -p 54321"
    -
    -

    And then in your terminal:

    -
    1
    -2
    $ pdm run start
    -Flask server started at http://127.0.0.1:54321
    -
    -

    Any following arguments will be appended to the command:

    -
    1
    -2
    $ pdm run start -h 0.0.0.0
    -Flask server started at http://0.0.0.0:54321
    -
    -
    -

    Yarn-like script shortcuts

    -

    There is a builtin shortcut making all scripts available as root commands -as long as the script does not conflict with any builtin or plugin-contributed command. -Said otherwise, if you have a start script, you can run both pdm run start and pdm start. -But if you have an install script, only pdm run install will run it, -pdm install will still run the builtin install command.

    -
    -

    PDM supports 4 types of scripts:

    -

    cmd#

    -

    Plain text scripts are regarded as normal command, or you can explicitly specify it:

    -
    1
    -2
    [tool.pdm.scripts]
    -start = {cmd = "flask run -p 54321"}
    -
    -

    In some cases, such as when wanting to add comments between parameters, it might be more convenient -to specify the command as an array instead of a string:

    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    [tool.pdm.scripts]
    -start = {cmd = [
    -    "flask",
    -    "run",
    -    # Important comment here about always using port 54321
    -    "-p", "54321"
    -]}
    -
    -

    shell#

    -

    Shell scripts can be used to run more shell-specific tasks, such as pipeline and output redirecting. -This is basically run via subprocess.Popen() with shell=True:

    -
    1
    -2
    [tool.pdm.scripts]
    -filter_error = {shell = "cat error.log|grep CRITICAL > critical.log"}
    -
    -

    call#

    -

    The script can be also defined as calling a python function in the form <module_name>:<func_name>:

    -
    1
    -2
    [tool.pdm.scripts]
    -foobar = {call = "foo_package.bar_module:main"}
    -
    -

    The function can be supplied with literal arguments:

    -
    1
    -2
    [tool.pdm.scripts]
    -foobar = {call = "foo_package.bar_module:main('dev')"}
    -
    -

    composite#

    -

    This script kind execute other defined scripts:

    -
    1
    -2
    -3
    -4
    [tool.pdm.scripts]
    -lint = "flake8"
    -test = "pytest"
    -all = {composite = ["lint", "test"]}
    -
    -

    Running pdm run all will run lint first and then test if lint succeeded.

    -

    You can also provide arguments to the called scripts:

    -
    1
    -2
    -3
    -4
    [tool.pdm.scripts]
    -lint = "flake8"
    -test = "pytest"
    -all = {composite = ["lint mypackage/", "test -v tests/"]}
    -
    -
    -

    Note

    -

    Argument passed on the command line are given to each called task.

    -
    -

    Script Options#

    -

    env#

    -

    All environment variables set in the current shell can be seen by pdm run and will be expanded when executed. -Besides, you can also define some fixed environment variables in your pyproject.toml:

    -
    1
    -2
    -3
    [tool.pdm.scripts]
    -start.cmd = "flask run -p 54321"
    -start.env = {FOO = "bar", FLASK_ENV = "development"}
    -
    -

    Note how we use TOML's syntax to define a composite dictionary.

    -
    -

    Note

    -

    Environment variables specified on a composite task level will override those defined by called tasks.

    -
    -

    env_file#

    -

    You can also store all environment variables in a dotenv file and let PDM read it:

    -
    1
    -2
    -3
    [tool.pdm.scripts]
    -start.cmd = "flask run -p 54321"
    -start.env_file = ".env"
    -
    -

    The variables within the dotenv file will not override any existing environment variables. -If you want the dotenv file to override existing environment variables use the following:

    -
    1
    -2
    -3
    [tool.pdm.scripts]
    -start.cmd = "flask run -p 54321"
    -start.env_file.override = ".env"
    -
    -
    -

    Note

    -

    A dotenv file specified on a composite task level will override those defined by called tasks.

    -
    -

    site_packages#

    -

    To make sure the running environment is properly isolated from the outer Python interpreter, -site-packages from the selected interpreter WON'T be loaded into sys.path, unless any of the following conditions holds:

    -
      -
    1. The executable is from PATH but not inside the __pypackages__ folder.
    2. -
    3. -s/--site-packages flag is following pdm run.
    4. -
    5. site_packages = true is in either the script table or the global setting key _.
    6. -
    -

    Note that site-packages will always be loaded if running with PEP 582 enabled(without the pdm run prefix).

    -

    Shared Options#

    -

    If you want the options to be shared by all tasks run by pdm run, -you can write them under a special key _ in [tool.pdm.scripts] table:

    -
    1
    -2
    -3
    -4
    [tool.pdm.scripts]
    -_.env_file = ".env"
    -start = "flask run -p 54321"
    -migrate_db = "flask db upgrade"
    -
    -

    Besides, inside the tasks, PDM_PROJECT_ROOT environment variable will be set to the project root.

    -

    Arguments placeholder#

    -

    By default, all user provided extra arguments are simply appended to the command (or to all the commands for composite tasks).

    -

    If you want more control over the user provided extra arguments, you can use the {args} placeholder. -It is available for all script types and will be interpolated properly for each:

    -
    1
    -2
    -3
    -4
    [tool.pdm.scripts]
    -cmd = "echo '--before {args} --after'"
    -shell = {shell = "echo '--before {args} --after'"}
    -composite = {composite = ["cmd --something", "shell {args}"]}
    -
    -

    will produce the following interpolations (those are not real scripts, just here to illustrate the interpolation):

    -
     1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    -10
    -11
    -12
    -13
    -14
    $ pdm run cmd --user --provided
    ---before --user --provided --after
    -$ pdm run cmd
    ---before --after
    -$ pdm run shell --user --provided
    ---before --user --provided --after
    -$ pdm run shell
    ---before --after
    -$ pdm run composite --user --provided
    -cmd --something
    -shell --before --user --provided --after
    -$ pdm run composite
    -cmd --something
    -shell --before --after
    -
    -

    You may optionally provide default values that will be used if no user arguments are provided:

    -
    1
    -2
    [tool.pdm.scripts]
    -test = "echo '--before {args:--default --value} --after'"
    -
    -

    will produce the following:

    -
    1
    -2
    -3
    -4
    $ pdm run test --user --provided
    ---before --user --provided --after
    -$ pdm run test
    ---before --default --value --after
    -
    -
    -

    Note

    -

    As soon a placeholder is detected, arguments are not appended anymore. -This is important for composite scripts because if a placeholder -is detected on one of the subtasks, none for the subtasks will have -the arguments appended, you need to explicitly pass the placeholder -to every nested command requiring it.

    -
    -
    -

    Note

    -

    call scripts don't support the {args} placeholder as they have -access to sys.argv directly to handle such complexe cases and more.

    -
    -

    Show the List of Scripts#

    -

    Use pdm run --list/-l to show the list of available script shortcuts:

    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    $ pdm run --list
    -╭─────────────┬───────┬───────────────────────────╮
    -│ Name         Type   Description               │
    -├─────────────┼───────┼───────────────────────────┤
    -│ test_cmd     cmd    flask db upgrade          │
    -│ test_script  call   call a python function    │
    -│ test_shell   shell  shell command             │
    -╰─────────────┴───────┴───────────────────────────╯
    -
    -

    You can add an help option with the description of the script, and it will be displayed in the Description column in the above output.

    -
    -

    Note

    -

    Tasks with a name starting with an underscore (_) are considered internal (helpers...) and are not shown in the listing.

    -
    -

    Pre & Post Scripts#

    -

    Like npm, PDM also supports tasks composition by pre and post scripts, pre script will be run before the given task and post script will be run after.

    -
    1
    -2
    -3
    -4
    [tool.pdm.scripts]
    -pre_compress = "{{ Run BEFORE the `compress` script }}"
    -compress = "tar czvf compressed.tar.gz data/"
    -post_compress = "{{ Run AFTER the `compress` script }}"
    -
    -

    In this example, pdm run compress will run all these 3 scripts sequentially.

    -
    -

    The pipeline fails fast

    -

    In a pipeline of pre - self - post scripts, a failure will cancel the subsequent execution.

    -
    -

    Hook Scripts#

    -

    Under certain situations PDM will look for some special hook scripts for execution:

    -
      -
    • post_init: Run after pdm init
    • -
    • pre_install: Run before installing packages
    • -
    • post_install: Run after packages are installed
    • -
    • pre_lock: Run before dependency resolution
    • -
    • post_lock: Run after dependency resolution
    • -
    • pre_build: Run before building distributions
    • -
    • post_build: Run after distributions are built
    • -
    • pre_publish: Run before publishing distributions
    • -
    • post_publish: Run after distributions are published
    • -
    • pre_script: Run before any script
    • -
    • post_script: Run after any script
    • -
    • pre_run: Run once before run script invocation
    • -
    • post_run: Run once after run script invocation
    • -
    -
    -

    Note

    -

    Pre & post scripts can't receive any arguments.

    -
    -
    -

    Avoid name conflicts

    -

    If there exists an install scripts under [tool.pdm.scripts] table, pre_install -scripts can be triggered by both pdm install and pdm run install. So it is -recommended to not use the preserved names.

    -
    -
    -

    Note

    -

    Composite tasks can also have pre and post scripts. -Called tasks will run their own pre and post scripts.

    -
    -

    Skipping scripts#

    -

    Because, sometimes it is desirable to run a script but without its hooks or pre and post scripts, -there is a --skip=:all which will disable all hooks, pre and post. -There is also --skip=:pre and --skip=:post allowing to respectively -skip all pre_* hooks and all post_* hooks.

    -

    It is also possible to need a pre script but not the post one, -or to need all tasks from a composite tasks except one. -For those use cases, there is a finer grained --skip parameter -accepting a list of tasks or hooks name to exclude.

    -
    1
    pdm run --skip pre_task1,task2 my-composite
    -
    -

    This command will run the my-composite task and skip the pre_task1 hook as well as the task2 and its hooks.

    -

    You can also provide you skip list in PDM_SKIP_HOOKS environment variable -but it will be overridden as soon as the --skip parameter is provided.

    -

    There is more details on hooks and pre/post scripts behavior on the dedicated hooks page.

    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/template/index.html b/2.10/usage/template/index.html deleted file mode 100644 index 23db1e0606..0000000000 --- a/2.10/usage/template/index.html +++ /dev/null @@ -1,1047 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Create Project From a Template - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    -
    - - - -
    -
    - - - - - - - -

    Create Project From a Template#

    -

    Similar to yarn create and npm create, PDM also supports initializing or creating a project from a template. -The template is given as a positional argument of pdm init, in one of the following forms:

    -
      -
    • pdm init flask - Initialize the project from the template https://github.com/pdm-project/template-flask
    • -
    • pdm init https://github.com/frostming/pdm-template-flask - Initialize the project from a Git URL. Both HTTPS and SSH URL are acceptable.
    • -
    • pdm init django@v2 - To check out the specific branch or tag. Full Git URL also supports it.
    • -
    • pdm init /path/to/template - Initialize the project from a template directory on local filesystem.
    • -
    -

    And pdm init will use the default template built in.

    -

    The project will be initialized at the current directory, existing files with the same name will be overwritten. You can also use the -p <path> option to create a project at a new path.

    -

    Contribute a template#

    -

    According to the first form of the template argument, pdm init <name> will refer to the template repository located at https://github.com/pdm-project/template-<name>. To contribute a template, you can create a template repository and establish a request to transfer the -ownership to pdm-project organization(it can be found at the bottom of the repository settings page). The administrators of the organization will review the request and complete the subsequent steps. You will be added as the repository maintainer if the transfer is accepted.

    -

    Requirements for a template#

    -

    A template repository must be a pyproject-based project, which contains a pyproject.toml file with PEP-621 compliant metadata. -No other special config files are required.

    -

    Project name replacement#

    -

    On initialization, the project name in the template will be replaced by the name of the new project. This is done by a recursive full-text search and replace. The import name, which is derived from the project name by replacing all non-alphanumeric characters with underscores and lowercasing, will also be replaced in the same way.

    -

    For example, if the project name is foo-project in the template and you want to initialize a new project named bar-project, the following replacements will be made:

    -
      -
    • foo-project -> bar-project in all .md files and .rst files
    • -
    • foo_project -> bar_project in all .py files
    • -
    • foo_project -> bar_project in the directory name
    • -
    • foo_project.py -> bar_project.py in the file name
    • -
    -

    Therefore, we don't support name replacement if the import name isn't derived from the project name.

    -

    Use other project generators#

    -

    If you are seeking for a more powerful project generator, you can use cookiecutter via --cookiecutter option and copier via --copier option.

    -

    You need to install cookiecutter and copier respectively to use them. You can do this by running pdm self add <package>. -To use them:

    -
    1
    -2
    -3
    pdm init --cookiecutter gh:cjolowicz/cookiecutter-hypermodern-python
    -# or
    -pdm init --copier gh:pawamoy/copier-pdm --UNSAFE
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.10/usage/venv/index.html b/2.10/usage/venv/index.html deleted file mode 100644 index a5beb1f2e2..0000000000 --- a/2.10/usage/venv/index.html +++ /dev/null @@ -1,1337 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Working with Virtual Environments - PDM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    - - - - - - - -
    - -
    - - - - -
    -
    - - - -
    -
    -
    - - - - - - -
    -
    -
    - - - - - - - -
    -
    - - - - - - - -

    Working with Virtual Environments#

    -

    When you run pdm init command, PDM will ask for the Python interpreter to use in the project, which is the base interpreter to install dependencies and run tasks.

    -

    Compared to PEP 582, virtual environments are considered more mature and have better support in the Python ecosystem as well as IDEs. Therefore, virtualenv is the default mode if not configured otherwise.

    -

    Virtual environments will be used if the project interpreter (the interpreter stored in .pdm-python, which can be checked by pdm info) is from a virtualenv.

    -

    Virtualenv auto-creation#

    -

    By default, PDM prefers to use the virtualenv layout as other package managers do. When you run pdm install the first time on a new PDM-managed project, whose Python interpreter is not decided yet, PDM will create a virtualenv in <project_root>/.venv, and install dependencies into it. In the interactive session of pdm init, PDM will also ask to create a virtualenv for you.

    -

    You can choose the backend used by PDM to create a virtualenv. Currently it supports three backends:

    - -

    You can change it by pdm config venv.backend [virtualenv|venv|conda].

    -

    Create a virtualenv yourself#

    -

    You can create more than one virtualenvs with whatever Python version you want.

    -
    1
    -2
    -3
    -4
    -5
    -6
    # Create a virtualenv based on 3.8 interpreter
    -$ pdm venv create 3.8
    -# Assign a different name other than the version string
    -$ pdm venv create --name for-test 3.8
    -# Use venv as the backend to create, support 3 backends: virtualenv(default), venv, conda
    -$ pdm venv create --with venv 3.9
    -
    -

    The location of virtualenvs#

    -

    If no --name is given, PDM will create the venv in <project_root>/.venv. Otherwise, virtualenvs go to the location specified by the venv.location configuration. -They are named as <project_name>-<path_hash>-<name_or_python_version> to avoid name collision. -You can disable the in-project virtualenv creation by pdm config venv.in_project false. And all virtualenvs will be created under venv.location.

    -

    Reuse the virtualenv you created elsewhere#

    -

    You can tell PDM to use a virtualenv you created in preceding steps, with pdm use:

    -
    1
    pdm use -f /path/to/venv
    -
    -

    Virtualenv auto-detection#

    -

    When no interpreter is stored in the project config or PDM_IGNORE_SAVED_PYTHON env var is set, PDM will try to detect possible virtualenvs to use:

    -
      -
    • venv, env, .venv directories in the project root
    • -
    • The currently activated virtualenv, unless PDM_IGNORE_ACTIVE_VENV is set
    • -
    -

    List all virtualenvs created with this project#

    -
    1
    -2
    -3
    -4
    -5
    -6
    $ pdm venv list
    -Virtualenvs created with this project:
    -
    --  3.8.6: C:\Users\Frost Ming\AppData\Local\pdm\pdm\venvs\test-project-8Sgn_62n-3.8.6
    --  for-test: C:\Users\Frost Ming\AppData\Local\pdm\pdm\venvs\test-project-8Sgn_62n-for-test
    --  3.9.1: C:\Users\Frost Ming\AppData\Local\pdm\pdm\venvs\test-project-8Sgn_62n-3.9.1
    -
    -

    Show the path or python interpreter of a virtualenv#

    -
    1
    -2
    $ pdm venv --path for-test
    -$ pdm venv --python for-test
    -
    -

    Remove a virtualenv#

    -
    1
    -2
    -3
    -4
    $ pdm venv remove for-test
    -Virtualenvs created with this project:
    -Will remove: C:\Users\Frost Ming\AppData\Local\pdm\pdm\venvs\test-project-8Sgn_62n-for-test, continue? [y/N]:y
    -Removed C:\Users\Frost Ming\AppData\Local\pdm\pdm\venvs\test-project-8Sgn_62n-for-test
    -
    -

    Activate a virtualenv#

    -

    Instead of spawning a subshell like what pipenv and poetry do, pdm venv doesn't create the shell for you but print the activate command to the console. In this way you won't leave the current shell. You can then feed the output to eval to activate the virtualenv:

    -
    -
    -
    -
    1
    -2
    $ eval $(pdm venv activate for-test)
    -(test-project-for-test) $  # Virtualenv entered
    -
    -
    -
    -
    1
    $ eval (pdm venv activate for-test)
    -
    -
    -
    -
    1
    PS1> Invoke-Expression (pdm venv activate for-test)
    -
    -

    Additionally, if the project interpreter is a venv Python, you can omit the name argument following activate.

    -
    -
    -
    -
    -

    Note

    -

    venv activate does not switch the Python interpreter used by the project. It only changes the shell by injecting the virtualenv paths to environment variables. For the forementioned purpose, use the pdm use command.

    -
    -

    For more CLI usage, see the pdm venv documentation.

    -
    -

    Looking for pdm shell?

    -

    PDM doesn't provide a shell command because many fancy shell functions may not work perfectly in a subshell, which brings a maintenance burden to support all the corner cases. However, you can still gain the ability via the following ways:

    -
      -
    • Use pdm run $SHELL, this will spawn a subshell with the environment variables set properly. The subshell can be quit with exit or Ctrl+D.
    • -
    • Add a shell function to activate the virtualenv, here is an example of BASH function that also works on ZSH:
    • -
    -
    1
    -2
    -3
    -4
    -5
    -6
    -7
    -8
    -9
    pdm() {
    -  local command=$1
    -
    -  if [[ "$command" == "shell" ]]; then
    -      eval $(pdm venv activate)
    -  else
    -      command pdm $@
    -  fi
    -}
    -
    -

    Copy and paste this function to your ~/.bashrc file and restart your shell. Now you can run pdm shell to activate the virtualenv. - The virtualenv can be deactivated with deactivate command as usual.

    -
    -

    Prompt customization#

    -

    By default when you activate a virtualenv, the prompt will show: {project_name}-{python_version}.

    -

    For example if your project is named test-project:

    -
    1
    -2
    $ eval $(pdm venv activate for-test)
    -(test-project-3.10) $  # {project_name} == test-project and {python_version} == 3.10
    -
    -

    The format can be customized before virtualenv creation with the venv.prompt configuration or PDM_VENV_PROMPT environment variable (before a pdm init or pdm venv create). -Available variables are:

    -
      -
    • project_name: name of your project
    • -
    • python_version: version of Python (used by the virtualenv)
    • -
    -
    1
    -2
    -3
    $ PDM_VENV_PROMPT='{project_name}-py{python_version}' pdm venv create --name test-prompt
    -$ eval $(pdm venv activate test-prompt)
    -(test-project-py3.10) $
    -
    -

    Run a command in a virtual environment without activating it#

    -
    1
    -2
    -3
    -4
    -5
    -6
    # Run a script
    -$ pdm run --venv test test
    -# Install packages
    -$ pdm sync --venv test
    -# List the packages installed
    -$ pdm list --venv test
    -
    -

    There are other commands supporting --venv flag or PDM_IN_VENV environment variable, see the CLI reference. You should create the virtualenv with pdm venv create --name <name> before using this feature.

    -

    Switch to a virtualenv as the project environment#

    -

    By default, if you use pdm use and select a non-venv Python, the project will be switched to PEP 582 mode. We also allow you to switch to a named virtual environment via the --venv flag:

    -
    1
    -2
    -3
    -4
    # Switch to a virtualenv named test
    -$ pdm use --venv test
    -# Switch to the in-project venv located at $PROJECT_ROOT/.venv
    -$ pdm use --venv in-project
    -
    -

    Disable virtualenv mode#

    -

    You can disable the auto-creation and auto-detection for virtualenv by pdm config python.use_venv false. -If venv is disabled, PEP 582 mode will always be used even if the selected interpreter is from a virtualenv.

    -

    Including pip in your virtual environment#

    -

    By default PDM will not include pip in virtual environments. -This increases isolation by ensuring that only your dependencies are installed in the virtual environment.

    -

    To install pip once (if for example you want to install arbitrary dependencies in CI) you can run:

    -
    1
    -2
    -3
    -4
    -5
    # Install pip in the virtual environment
    -$ pdm run python -m ensurepip
    -# Install arbitrary dependencies
    -# These dependencies are not checked for conflicts against lockfile dependencies!
    -$ pdm run python -m pip install coverage
    -
    -

    Or you can create the virtual environment with --with-pip:

    -
    1
    $ pdm venv create --with-pip 3.9
    -
    -

    See the ensurepip docs for more details on ensurepip.

    -

    If you want to permanently configure PDM to include pip in virtual environments you can use the venv.with_pip configuration.

    - - - - - - - - -
    -
    - - -
    - -
    - - - - -
    - - - - -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - \ No newline at end of file diff --git a/versions.json b/versions.json index 4dd73fa8f3..40919b6b15 100644 --- a/versions.json +++ b/versions.json @@ -1 +1 @@ -[{"version": "2.12", "title": "2.12", "aliases": ["latest"]}, {"version": "2.11", "title": "2.11", "aliases": []}, {"version": "2.10", "title": "2.10", "aliases": []}, {"version": "dev", "title": "dev", "aliases": []}] \ No newline at end of file +[{"version": "2.12", "title": "2.12", "aliases": ["latest"]}, {"version": "2.11", "title": "2.11", "aliases": []}, {"version": "dev", "title": "dev", "aliases": []}] \ No newline at end of file