python-poetry / website

Source for the official Poetry website
https://python-poetry.org
33 stars 16 forks source link

Can't build website locally #107

Closed iainelder closed 1 year ago

iainelder commented 1 year ago

The local development instructions don't work for me.

When I run make site, eventually I get the following error:

[Errno 2] No such file or directory: 'content/docs/1.2'

A similar issue #36 was reported and closed without a documented solution.

Full terminal output:

$ make site
npm install
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 876 packages, and audited 877 packages in 10s

99 packages are looking for funding
  run `npm fund` for details

17 vulnerabilities (1 low, 6 moderate, 10 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
poetry install
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)
Creating virtualenv website-S2P53JhW-py3.10 in /home/isme/.cache/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 23 installs, 1 update, 0 removals

  • Installing idna (3.3)
  • Installing sniffio (1.3.0)
  • Installing anyio (3.6.1)
  • Installing certifi (2022.6.15)
  • Installing distlib (0.3.6)
  • Installing filelock (3.8.0)
  • Installing h11 (0.12.0)
  • Installing platformdirs (2.5.2)
  • Updating setuptools (65.7.0 -> 65.3.0)
  • Installing cfgv (3.3.1)
  • Installing crashtest (0.3.1)
  • Installing httpcore (0.15.0)
  • Installing identify (2.5.3)
  • Installing nodeenv (1.7.0)
  • Installing pylev (1.4.0)
  • Installing pyyaml (6.0)
  • Installing rfc3986 (1.5.0)
  • Installing toml (0.10.2)
  • Installing virtualenv (20.16.4)
  • Installing cleo (1.0.0a5)
  • Installing httpx (0.23.0)
  • Installing pre-commit (2.20.0)
  • Installing tomli (2.0.1)
  • Installing tomli-w (1.0.0)
poetry run ./bin/website configure 
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)
poetry run ./bin/website docs pull 
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)

  Pulling documentation for version 1.3 as 1.3
Cloning into '.'...
fatal: cannot change to 'https://github.com/python-poetry/poetry.git': No such file or directory
error: failed to initialize sparse-checkout
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

  Pulling documentation for version 1.2 as 1.2
Cloning into '.'...
fatal: cannot change to 'https://github.com/python-poetry/poetry.git': No such file or directory
error: failed to initialize sparse-checkout
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

[Errno 2] No such file or directory: 'content/docs/1.2'
make: *** [Makefile:26: content/docs] Error 1
$ python --version
Python 3.10.10
$ node --version
v18.14.0
$ poetry run bin/website docs pull
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)

  Pulling documentation for version 1.3 as 1.3
Cloning into '.'...
fatal: cannot change to 'https://github.com/python-poetry/poetry.git': No such file or directory
error: failed to initialize sparse-checkout
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

  Pulling documentation for version 1.2 as 1.2
Cloning into '.'...
fatal: cannot change to 'https://github.com/python-poetry/poetry.git': No such file or directory
error: failed to initialize sparse-checkout
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

[Errno 2] No such file or directory: 'content/docs/1.2'

Environment:

neersighted commented 1 year ago

This is something related to your local configuration. As you can see from the log, your local Git client is failing to clone the Poetry sources, which contain the docs content.

Can you please provide the git --version? Are you running under WSL, or is this a normal Ubuntu system with a Ubuntu kernel? Do you have issues cloning any other git repos?

iainelder commented 1 year ago

Git version: 2.25.1

It's a normal Ubuntu system, no WSL involved.

iainelder commented 1 year ago

No issues cloning any other git repos.

neersighted commented 1 year ago

Ah, it looks like we likely require Git 2.26 as a minimum version. If you are unable to update to a newer set of tools, I'd suggest using a container to build the website.

iainelder commented 1 year ago

Git 2.25.1 is the version given by the default Ubuntu apt repository.

I'll see whether using the latest Git version solves the problem.

neersighted commented 1 year ago

Right, I'm not saying that your Git is out of date relative to the OS version -- but it looks like we started requiring features from newer versions without noticing to speed up CI. If the Git version is the issue, we'll probably document the known lower bound and suggest that users who are unable to update use a container (Docker or LXC) or chroot to build.

iainelder commented 1 year ago

I installed Git 2.39.1 from the Ubuntu Git Maintainers PPA.

Now it appears to clone the repo, but it later fails with the following message:

[Errno 2] No such file or directory: 'content/docs/dependency-specification.md'

Output following poetry run ./bin/website docs pull:

poetry run ./bin/website docs pull 
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)

  Pulling documentation for version 1.3 as 1.3
Cloning into '.'...
remote: Enumerating objects: 239, done.
remote: Counting objects: 100% (239/239), done.
remote: Compressing objects: 100% (159/159), done.
remote: Total 239 (delta 1), reused 193 (delta 1), pack-reused 0
Receiving objects: 100% (239/239), 33.53 KiB | 1.29 MiB/s, done.
Resolving deltas: 100% (1/1), done.
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 13 (delta 0), reused 3 (delta 0), pack-reused 0
Receiving objects: 100% (13/13), 85.66 KiB | 2.04 MiB/s, done.
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 14 (delta 0), reused 2 (delta 0), pack-reused 0
Receiving objects: 100% (14/14), 48.58 KiB | 1.73 MiB/s, done.

[Errno 2] No such file or directory: 'content/docs/dependency-specification.md'
make: *** [Makefile:26: content/docs] Error 1
neersighted commented 1 year ago

I suggest you start with a clean clone of the website repo -- it looks like you've got an inconsistent state.

iainelder commented 1 year ago

I did start with a clean clone. I can reproduce the previous output with these commands:

cd "$(mktemp --dir)"
git clone https://github.com/python-poetry/website.git
cd website/
make site
neersighted commented 1 year ago

Your output doesn't make sense -- bin/website won't care about content during docs pull -- it seems like you might have edited down the output? What happens if you poetry run ./bin/website docs pull without the Makefile?

neersighted commented 1 year ago

Also, if you're trying to build locally to test docs changes, I'd suggest make POETRY_REPO=../path/to/poetry site which bypasses this pull stage.

iainelder commented 1 year ago

I am trying to build locally to test docs changes. I'll try your suggestion and share the result.

it seems like you might have edited down the output

I just deleted the stuff before running the pull command because I thought it was irrelevant.

Running the command directly, without the Makefile produces the same error:

$ poetry run ./bin/website docs pull
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)

  Pulling documentation for version 1.3 as 1.3
Cloning into '.'...
remote: Enumerating objects: 239, done.
remote: Counting objects: 100% (239/239), done.
remote: Compressing objects: 100% (159/159), done.
remote: Total 239 (delta 1), reused 193 (delta 1), pack-reused 0
Receiving objects: 100% (239/239), 33.53 KiB | 715.00 KiB/s, done.
Resolving deltas: 100% (1/1), done.
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 13 (delta 0), reused 3 (delta 0), pack-reused 0
Receiving objects: 100% (13/13), 85.66 KiB | 1.32 MiB/s, done.
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 14 (delta 0), reused 2 (delta 0), pack-reused 0
Receiving objects: 100% (14/14), 48.58 KiB | 829.00 KiB/s, done.

[Errno 2] No such file or directory: 'content/docs/dependency-specification.md'
neersighted commented 1 year ago

A regular make site won't let you test local changes (it will instead build the production site), so it's definitely better to simply avoid whatever breakage you're running into. Something must be going seriously awry on your system as the bit that is failing must be the globbing + file writing operation.

iainelder commented 1 year ago

When I clone the Poetry source like this, the site builds and I can browse it locally at http://localhost:1313/.

cd "$(mktemp --dir)"
git clone https://github.com/python-poetry/poetry.git
git clone https://github.com/python-poetry/website.git
cd website/
make POETRY_REPO=../poetry site

Full output from make for reference:

npm install
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 876 packages, and audited 877 packages in 8s

99 packages are looking for funding
  run `npm fund` for details

17 vulnerabilities (1 low, 6 moderate, 10 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
poetry install
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)
Creating virtualenv website-bMxfv_5_-py3.10 in /home/isme/.cache/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 23 installs, 1 update, 0 removals

  • Installing idna (3.3)
  • Installing sniffio (1.3.0)
  • Installing anyio (3.6.1)
  • Installing certifi (2022.6.15)
  • Installing distlib (0.3.6)
  • Installing filelock (3.8.0)
  • Installing h11 (0.12.0)
  • Installing platformdirs (2.5.2)
  • Updating setuptools (65.7.0 -> 65.3.0)
  • Installing cfgv (3.3.1)
  • Installing crashtest (0.3.1)
  • Installing httpcore (0.15.0)
  • Installing identify (2.5.3)
  • Installing nodeenv (1.7.0)
  • Installing pylev (1.4.0)
  • Installing pyyaml (6.0)
  • Installing rfc3986 (1.5.0)
  • Installing toml (0.10.2)
  • Installing virtualenv (20.16.4)
  • Installing cleo (1.0.0a5)
  • Installing httpx (0.23.0)
  • Installing pre-commit (2.20.0)
  • Installing tomli (2.0.1)
  • Installing tomli-w (1.0.0)
poetry run ./bin/website configure --local="../poetry" --editable
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)
poetry run ./bin/website docs pull --local="../poetry" --editable
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version. 
Using python3 (3.10.10)

src/app.js → assets/assets/app.js...
created assets/assets/app.js in 2.9s

> poetry-website@1.0.0 dev
> concurrently --names=assets,server --prefix-colors=cyan.bold,magenta.bold 'rollup --config --watch' 'hugo server --buildDrafts --buildFuture --watch'

[server] Start building sites ... 
[server] hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66 linux/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=gohugoio
[server] 
[server]                    | EN   
[server] -------------------+------
[server]   Pages            | 118  
[server]   Paginator pages  |  24  
[server]   Non-page files   |   0  
[server]   Static files     |  10  
[server]   Processed images |   0  
[server]   Aliases          |  73  
[server]   Sitemaps         |   1  
[server]   Cleaned          |   0  
[server] 
[server] Built in 243 ms
[server] Watching for changes in /tmp/tmp.ZSbdiXAo3j/{poetry,website}
[server] Watching for config changes in /tmp/tmp.ZSbdiXAo3j/website/config.toml
[server] Environment: "development"
[server] Serving pages from memory
[server] Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
[server] Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
[server] Press Ctrl+C to stop
[assets] rollup v2.79.0
[assets] bundles src/app.js → assets/assets/app.js...
[assets] created assets/assets/app.js in 2.9s
[server] 
[server] Change detected, rebuilding site.
[server] 2023-02-12 19:00:45.369 +0100
[server] Total in 12 ms
neersighted commented 1 year ago

It's also worth noting that if you open a docs PR against Poetry, every commit you push will result in a preview build for reviewers.

I'm still not sure why you can't build locally; I am able to do so on Ubuntu 20.04 with an updated Git. I suspect there is something else exotic about your configuration, but at the same time, it's not really relevant as you were never trying to build the website with the upstream sources.

iainelder commented 1 year ago

I opened a PR (https://github.com/python-poetry/poetry/pull/7506), but I don't know if it is properly configured as a "docs PR". It doesn't have the area/docs tag.

I suspect there is something else exotic about your configuration

I wonder what it could be! I'm going to try a little harder to find out, but if I don't, I'll just close this because I have a workaround for my case now.

iainelder commented 1 year ago

I couldn't figure out why it doesn't work in my usual environment, but I don't have to because of the documented workaround.

neersighted commented 1 year ago

It's not really a workaround -- we haven't identified a workaround to let you build the production website, but that wasn't what you wanted to do anyway.