-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mechanism for ensuring datasette/datasette-app-support/etc are at required version #41
Comments
As I add more default plugins in #81 the scope of this issue has expanded to ensuring all of the default dependencies are installed, even if the virtual environment already exists. Relevant code: Lines 186 to 207 in 79fd738
|
Returns the list of currently installed packages as JSON: [
{
"name": "datasette",
"version": "0.59a2"
},
{
"name": "datasette-app-support",
"version": "0.6"
},
{
"name": "datasette-cluster-map",
"version": "0.17.1"
}
] |
I can compare version numbers correctly using Or if I do the comparisons in JavaScript I can use https://www.npmjs.com/package/semver |
The plan:
|
Annoyingly,
|
I used this code to explore the behaviour of const versionsProcess = await execFile(pip_path, [
"list",
"--format",
"json",
]);
const versions = {};
for (const item of JSON.parse(versionsProcess.stdout)) {
versions[item.name] = {
original: item.version,
clean: semver.clean(item.version),
clean_loose: semver.clean(item.version, { loose: true, includePrerelease: true }),
coerce: semver.clean(item.version),
coerce_loose: semver.clean(item.version, { loose: true, includePrerelease: true }),
};
} Partial output: aiofiles: {
original: '0.7.0',
clean: '0.7.0',
clean_loose: '0.7.0',
coerce: '0.7.0',
coerce_loose: '0.7.0'
},
aniso8601: {
original: '7.0.0',
clean: '7.0.0',
clean_loose: '7.0.0',
coerce: '7.0.0',
coerce_loose: '7.0.0'
},
anyio: {
original: '3.3.0',
clean: '3.3.0',
clean_loose: '3.3.0',
coerce: '3.3.0',
coerce_loose: '3.3.0'
},
'asgi-csrf': {
original: '0.9',
clean: null,
clean_loose: null,
coerce: null,
coerce_loose: null
},
asgiref: {
original: '3.4.1',
clean: '3.4.1',
clean_loose: '3.4.1',
coerce: '3.4.1',
coerce_loose: '3.4.1'
},
certifi: {
original: '2021.5.30',
clean: '2021.5.30',
clean_loose: '2021.5.30',
coerce: '2021.5.30',
coerce_loose: '2021.5.30'
},
'charset-normalizer': {
original: '2.0.4',
clean: '2.0.4',
clean_loose: '2.0.4',
coerce: '2.0.4',
coerce_loose: '2.0.4'
},
click: {
original: '8.0.1',
clean: '8.0.1',
clean_loose: '8.0.1',
coerce: '8.0.1',
coerce_loose: '8.0.1'
},
'click-default-group': {
original: '1.2.2',
clean: '1.2.2',
clean_loose: '1.2.2',
coerce: '1.2.2',
coerce_loose: '1.2.2'
},
datasette: {
original: '0.59a2',
clean: null,
clean_loose: null,
coerce: null,
coerce_loose: null
},
'datasette-app-support': {
original: '0.6',
clean: null,
clean_loose: null,
coerce: null,
coerce_loose: null
},
'datasette-cluster-map': {
original: '0.17.1',
clean: '0.17.1',
clean_loose: '0.17.1',
coerce: '0.17.1',
coerce_loose: '0.17.1'
} It's returning |
I'm using version numbers (hopefully) that are valid https://www.python.org/dev/peps/pep-0440/ - which it turns out isn't quite compatible with the |
I just realized I'm re-inventing what So it's safe for me to run |
The new CSV menu item in #29 only works if
datasette-app-support
[.2 ol higher is installed - but the user may have an older~/.datasette-app/venv
virtual environment running.So there needs to be some kind of mechanism to notice that the plugin is an unsupported version and upgrade it.
The text was updated successfully, but these errors were encountered: